summaryrefslogtreecommitdiffstats
path: root/overlord
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@mdehaan.rdu.redhat.com>2007-09-25 17:02:26 -0400
committerMichael DeHaan <mdehaan@mdehaan.rdu.redhat.com>2007-09-25 17:02:26 -0400
commit198c90f78f31c2526c72bf35c29ef65d6cae7c45 (patch)
tree9704f7b56817167f178fa88cf1fd28c8cbc352bc /overlord
parentef8aad0268ae9dc9efebd96714ca23e5a5369b49 (diff)
downloadthird_party-func-198c90f78f31c2526c72bf35c29ef65d6cae7c45.tar.gz
third_party-func-198c90f78f31c2526c72bf35c29ef65d6cae7c45.tar.xz
third_party-func-198c90f78f31c2526c72bf35c29ef65d6cae7c45.zip
Adds globbing support for hosts on the command line. If you have not yet used
certmaster/funcd to generate certs, you will now need them in order to use the client for testing.
Diffstat (limited to 'overlord')
-rwxr-xr-xoverlord/client.py31
1 files changed, 24 insertions, 7 deletions
diff --git a/overlord/client.py b/overlord/client.py
index 303a4df..3427e20 100755
--- a/overlord/client.py
+++ b/overlord/client.py
@@ -19,12 +19,16 @@ import optparse
import sys
import xmlrpclib
import traceback
+import glob
+import os
# ===================================
# defaults
# TO DO: some of this may want to come from config later
DEFAULT_PORT = 51234
+CERT_PATH = "/var/lib/func/certmaster/certs"
+
FUNC_USAGE = "Usage: %s [ --help ] [ --verbose ] target.example.org module method arg1 [...]"
# ===================================
@@ -52,15 +56,28 @@ class Client():
of server ids.
"""
- # FIXME: currently globbing is not supported (yet)
- # needs knowledge of the tree of certs
- # will be done soon
+ all_hosts = []
+ all_certs = []
+ seperate_gloobs = spec.split(";")
+ for each_gloob in seperate_gloobs:
+ actual_gloob = "%s/%s.pem" % (CERT_PATH, each_gloob)
+ certs = glob.glob(actual_gloob)
+ for cert in certs:
+ all_certs.append(cert)
+ host = cert.replace(CERT_PATH,"")[1:-4]
+ all_hosts.append(host)
+
+ # debug only:
+ # print all_hosts
+
+ all_urls = []
+ for x in all_hosts:
+ all_urls.append("http://%s:%s" % (x, self.port))
- results = []
+ if self.verbose and len(all_urls) == 0:
+ sys.stderr.write("no hosts matched\n")
- # FIXME: add SSL
- results.append("http://%s:%s" % (spec, self.port))
- return results
+ return all_urls
# -----------------------------------------------