summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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