def do(self, args): self.server_spec = self.parentCommand.server_spec # because this is mainly an interactive command, expand the server list and make seperate connections. # to make things look more speedy. minion_set = client.Minions(self.server_spec, port=self.port) if minion_set.overlord_config.puppet_minions: minion_set = client.PuppetMinions(self.server_spec, port=self.port) servers = minion_set.get_all_hosts() for server in servers: if server in minion_set.downed_hosts: continue overlord_obj = client.Overlord(server, interactive=False, verbose=self.verbose, noglobs=True) results = overlord_obj.run("test", "ping", []) if results == 1: print "[ ok ... ] %s" % server else: print "[ FAILED ] %s" % server return 1
def setUp(self): from certmaster.certmaster import CertMaster cm = CertMaster() #firstly create a group of some real ones self.signed_certs = cm.get_signed_certs() #we want a fresh copy :) if os.path.exists(GROUP_TEST): os.remove(GROUP_TEST) self.gfb = GroupFileBuilder() self.the_groups_dict = { "home_group": { 'host': self.signed_certs }, } self.test_dict = {"home_group": self.signed_certs} #create the file self.gfb.create(self.the_groups_dict) #print "The signet certs are : ",cm.get_signed_certs() #self.spec = "@home_group;some*.com" self.spec = "*" self.test_minions = fc.Minions(self.spec, groups_file=GROUP_TEST)
def test_get_hosts_by_group_glob(self): self.setUp() spec = "@home_group;some*.com" tmp_minions = fc.Minions(spec, groups_file=GROUP_TEST) result = tmp_minions.group_class.get_hosts_by_group_glob(spec) #print "test_get_hosts_by_group_glob result is : ",result assert result == self.test_dict["home_group"]
def do(self, args): self.server_spec = self.parentCommand.server_spec minion_set = client.Minions(self.server_spec, port=self.port) servers = minion_set.get_all_hosts() servers.sort() for server in servers: print server
def util_save_change(self): """ Will create a tmp object of groups to pull current changes from conf file """ tmp_minions = fc.Minions("*", groups_file=GROUP_TEST) result = tmp_minions.group_class.get_groups() del tmp_minions #result tobe tested return result
def setUp(self): self.minions = fc.Minions("*", groups_file=GROUP_TEST) import os #we want a fresh copy :) if os.path.exists(GROUP_TEST): os.remove(GROUP_TEST) self.gfb = GroupFileBuilder() self.the_groups_dict = { "home_group": { 'host': ['first', 'second', 'third'] }, } self.test_dict = {"home_group": ['first', 'second', 'third']} #create the file self.gfb.create(self.the_groups_dict)
def __init__(self): self.minions = fc.Minions("@blippy", groups_file=GROUP_TEST)