예제 #1
0
 def test_version_error_create(self):
     with test_chef_api(version='0.9.0'):
         with self.assertRaises(ChefAPIVersionError):
             Environment.create(self.random())
 def test_version_error_create(self):
     with test_chef_api(version='0.9.0'):
         with self.assertRaises(ChefAPIVersionError):
             Environment.create(self.random())
예제 #3
0
results = parser.parse_args()
results.chef_client_pem = results.chef_client_pem.replace("~", os.getenv("HOME"))

# Load chef and razor apis
with ChefAPI(results.chef_url, results.chef_client_pem, results.chef_client):
    razor = razor_api(results.razor_ip)

    server = []
    dashboard = []
    agents = []

    # Make sure environment exists, if not create one
    env = "%s-%s-opencenter" % (results.name, results.os)
    if not Search("environment").query("name:%s" % env):
        print "Making environment: %s " % env
        Environment.create(env)

    # Gather the servers in the environment into their roles
    nodes = Search("node").query("name:qa-%s-pool* AND chef_environment:%s" % (results.os, env))
    for n in nodes:
        node = Node(n["name"])
        # print "Found: %s " % node.name
        # print node.attributes['in_use']
        if node.attributes["in_use"] == "server":
            server.append(node.name)
        elif node.attributes["in_use"] == "dashboard":
            dashboard.append(node.name)
        elif node.attributes["in_use"] == "agent":
            agents.append(node.name)
    print "Server: %s " % server
    print "Dashboard: %s " % dashboard
예제 #4
0
results.chef_client_pem = results.chef_client_pem.replace(
    '~', os.getenv("HOME"))

# Load chef and razor apis
with ChefAPI(results.chef_url, results.chef_client_pem, results.chef_client):
    razor = razor_api(results.razor_ip)

    server = []
    dashboard = []
    agents = []

    # Make sure environment exists, if not create one
    env = "%s-%s-opencenter" % (results.name, results.os)
    if not Search("environment").query("name:%s" % env):
        print "Making environment: %s " % env
        Environment.create(env)

    # Gather the servers in the environment into their roles
    nodes = Search('node').query("name:qa-%s-pool* AND chef_environment:%s" %
                                 (results.os, env))
    for n in nodes:
        node = Node(n['name'])
        #print "Found: %s " % node.name
        #print node.attributes['in_use']
        if node.attributes['in_use'] == "server":
            server.append(node.name)
        elif node.attributes['in_use'] == "dashboard":
            dashboard.append(node.name)
        elif node.attributes['in_use'] == "agent":
            agents.append(node.name)
    print "Server: %s " % server