diff options
author | Adrian Likins <alikins@grimlock.devel.redhat.com> | 2008-02-12 12:55:40 -0500 |
---|---|---|
committer | Adrian Likins <alikins@grimlock.devel.redhat.com> | 2008-02-12 12:55:40 -0500 |
commit | bca510c2645ff24e5373dc0e7ff978ba7184693d (patch) | |
tree | 382244b194a4a89dbae3a78344fdbf53f22de436 /func | |
parent | 745205f6a225b391eef790274f776d8d38694908 (diff) | |
download | func-bca510c2645ff24e5373dc0e7ff978ba7184693d.tar.gz func-bca510c2645ff24e5373dc0e7ff978ba7184693d.tar.xz func-bca510c2645ff24e5373dc0e7ff978ba7184693d.zip |
move some methods into the Groups class.
Diffstat (limited to 'func')
-rwxr-xr-x | func/overlord/client.py | 36 | ||||
-rw-r--r-- | func/overlord/groups.py | 12 |
2 files changed, 30 insertions, 18 deletions
diff --git a/func/overlord/client.py b/func/overlord/client.py index cf1009c..9eef8b1 100755 --- a/func/overlord/client.py +++ b/func/overlord/client.py @@ -64,22 +64,22 @@ class CommandAutomagic(object): return self.clientref.run(module,method,args,nforks=self.nforks) -def get_groups(): - group_class = groups.Groups() - return group_class.get_groups() - - -def get_hosts_by_groupgoo(groups, groupgoo): - group_gloobs = groupgoo.split(':') - hosts = [] - for group_gloob in group_gloobs: - if not group_gloob[0] == "@": - continue - if groups.has_key(group_gloob[1:]): - hosts = hosts + groups[group_gloob[1:]] - else: - print "group %s not defined" % group_gloob - return hosts +#def get_groups(): +# group_class = groups.Groups() +# return group_class.get_groups() + + +#def get_hosts_by_groupgoo(groups, groupgoo): +# group_gloobs = groupgoo.split(':') +# hosts = [] +# for group_gloob in group_gloobs: +# if not group_gloob[0] == "@": +# continue +# if groups.has_key(group_gloob[1:]): +# hosts = hosts + groups[group_gloob[1:]] +# else: +# print "group %s not defined" % group_gloob +# return hosts # =================================== # this is a module level def so we can use it and isServer() from @@ -102,13 +102,13 @@ def expand_servers(spec, port=51234, noglobs=None, verbose=None, just_fqdns=Fals else: return spec - group_dict = get_groups() + group_class = groups.Groups() all_hosts = [] all_certs = [] seperate_gloobs = spec.split(";") - new_hosts = get_hosts_by_groupgoo(group_dict, spec) + new_hosts = group_class.get_hosts_by_groupgoo(spec) seperate_gloobs = spec.split(";") seperate_gloobs = seperate_gloobs + new_hosts diff --git a/func/overlord/groups.py b/func/overlord/groups.py index 8eaf28e..b392032 100644 --- a/func/overlord/groups.py +++ b/func/overlord/groups.py @@ -83,6 +83,18 @@ class Groups(object): def get_groups(self): return self.groups + def get_hosts_by_groupgoo(self, groupgoo): + group_gloobs = groupgoo.split(':') + hosts = [] + for group_gloob in group_gloobs: + if not group_gloob[0] == "@": + continue + if self.groups.has_key(group_gloob[1:]): + hosts = hosts + self.groups[group_gloob[1:]] + else: + print "group %s not defined" % group_gloob + return hosts + def main(): |