summaryrefslogtreecommitdiffstats
path: root/func
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@redhat.com>2007-10-25 18:12:14 -0400
committerMichael DeHaan <mdehaan@redhat.com>2007-10-25 18:12:14 -0400
commitc90d64659a49179cc06f58ac920542f32125d19b (patch)
treece8b40571e6287e8bc89ce851cf5848b795d5301 /func
parent1b4fbf4c013f9e08cef511f8b88b516d11fb275c (diff)
downloadthird_party-func-c90d64659a49179cc06f58ac920542f32125d19b.tar.gz
third_party-func-c90d64659a49179cc06f58ac920542f32125d19b.tar.xz
third_party-func-c90d64659a49179cc06f58ac920542f32125d19b.zip
Slight changes to make it easier to establish seperate client handles to all servers and walk them, rather
than using the Client as a multiplexer object. In most cases things won't care, but since ping is an interactive command that is not intended to ever be parsed, this gives the impression that things are more speedy for that one command. Syntax is still "func '*' ping"
Diffstat (limited to 'func')
-rwxr-xr-xfunc/overlord/client.py12
-rw-r--r--func/overlord/cmd_modules/ping.py27
2 files changed, 25 insertions, 14 deletions
diff --git a/func/overlord/client.py b/func/overlord/client.py
index f517117..aba82d5 100755
--- a/func/overlord/client.py
+++ b/func/overlord/client.py
@@ -66,7 +66,7 @@ class CommandAutomagic(object):
# this is a module level def so we can use it and isServer() from
# other modules with a Client class
-def expand_servers(spec, port=51234, noglobs=None, verbose=None):
+def expand_servers(spec, port=51234, noglobs=None, verbose=None, just_fqdns=False):
config = read_config(CONFIG_FILE, CMConfig)
"""
Given a regex/blob of servers, expand to a list
@@ -74,7 +74,10 @@ def expand_servers(spec, port=51234, noglobs=None, verbose=None):
"""
if noglobs:
- return [ "https://%s:%s" % (spec, port) ]
+ if not just_fqdns:
+ return [ "https://%s:%s" % (spec, port) ]
+ else:
+ return spec
all_hosts = []
all_certs = []
@@ -89,7 +92,10 @@ def expand_servers(spec, port=51234, noglobs=None, verbose=None):
all_urls = []
for x in all_hosts:
- all_urls.append("https://%s:%s" % (x, port))
+ if not just_fqdns:
+ all_urls.append("https://%s:%s" % (x, port))
+ else:
+ all_urls.append(x)
if verbose and len(all_urls) == 0:
sys.stderr.write("no hosts matched\n")
diff --git a/func/overlord/cmd_modules/ping.py b/func/overlord/cmd_modules/ping.py
index d5f57cc..29fa9d0 100644
--- a/func/overlord/cmd_modules/ping.py
+++ b/func/overlord/cmd_modules/ping.py
@@ -54,17 +54,22 @@ class Ping(client.command.Command):
def do(self, args):
self.server_spec = self.parentCommand.server_spec
- client_obj = client.Client(self.server_spec,
- port=self.options.port,
- interactive=False,
- verbose=self.options.verbose,
- config=self.config)
-
- results = client_obj.run("test", "ping", [])
- for (host,result) in results.iteritems():
- if result == 1:
- print "[ ok ... ] %s" % host
+ # because this is mainly an interactive command, expand the server list and make seperate connections.
+ # to make things look more speedy.
+
+ servers = client.expand_servers(self.server_spec, port=self.options.port, noglobs=None,
+ verbose=self.options.verbose, just_fqdns=True)
+
+ for server in servers:
+
+ client_obj = client.Client(server,port=self.options.port,interactive=False,
+ verbose=self.options.verbose,config=self.config, noglobs=True)
+
+ results = client_obj.run("test", "ping", [])
+ if results == 1:
+ print "[ ok ... ] %s" % server
else:
- print "[ FAILED ] %s" % host
+ print "[ FAILED ] %s" % server
+
return 1