summaryrefslogtreecommitdiffstats
path: root/func/overlord
diff options
context:
space:
mode:
authorAdrian Likins <alikins@grimlock.devel.redhat.com>2008-01-29 13:55:38 -0500
committerAdrian Likins <alikins@grimlock.devel.redhat.com>2008-01-29 13:55:38 -0500
commit8eb6ad3f85fb0a8c8cf45842d846b1887a6e69a1 (patch)
tree98dcf8782379eab3b4ca5bd406f0f38c3eda31c7 /func/overlord
parentf099101e300bf7e23ccddcccb4dad73114a834f0 (diff)
downloadthird_party-func-8eb6ad3f85fb0a8c8cf45842d846b1887a6e69a1.tar.gz
third_party-func-8eb6ad3f85fb0a8c8cf45842d846b1887a6e69a1.tar.xz
third_party-func-8eb6ad3f85fb0a8c8cf45842d846b1887a6e69a1.zip
clean up expand servers a little bit
Diffstat (limited to 'func/overlord')
-rwxr-xr-xfunc/overlord/client.py32
1 files changed, 21 insertions, 11 deletions
diff --git a/func/overlord/client.py b/func/overlord/client.py
index f33bc4b..2403adf 100755
--- a/func/overlord/client.py
+++ b/func/overlord/client.py
@@ -62,6 +62,23 @@ 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" % each_gloob
+ return hosts
+
# ===================================
# this is a module level def so we can use it and isServer() from
# other modules with a Client class
@@ -83,22 +100,15 @@ def expand_servers(spec, port=51234, noglobs=None, verbose=None, just_fqdns=Fals
else:
return spec
- group_class = groups.Groups()
- group_dict = group_class.get_groups()
+ group_dict = get_groups()
all_hosts = []
all_certs = []
seperate_gloobs = spec.split(";")
- new_hosts = []
-
- # we notate groups with @foo annotation, so look for that in the hostnamegoo
- for each_gloob in seperate_gloobs:
- if each_gloob[0] == '@':
- if group_dict.has_key(each_gloob[1:]):
- new_hosts = new_hosts + group_dict[each_gloob[1:]]
- else:
- print "group %s not defined" % each_gloob
+
+ new_hosts = get_hosts_by_groupgoo(group_dict, spec)
+ seperate_gloobs = spec.split(";")
seperate_gloobs = seperate_gloobs + new_hosts
for each_gloob in seperate_gloobs:
actual_gloob = "%s/%s.cert" % (config.certroot, each_gloob)