diff options
author | Michael DeHaan <mdehaan@redhat.com> | 2008-02-21 15:20:05 -0500 |
---|---|---|
committer | Michael DeHaan <mdehaan@redhat.com> | 2008-02-21 15:20:05 -0500 |
commit | afbe0786ee0f6855c461c975cac4940f01fc5208 (patch) | |
tree | ec501ab99e0920efde0ba9f221a2205b80e3ee10 /func | |
parent | 3ded42779d940e09a539d535af8b8d1f4b39634f (diff) | |
download | func-afbe0786ee0f6855c461c975cac4940f01fc5208.tar.gz func-afbe0786ee0f6855c461c975cac4940f01fc5208.tar.xz func-afbe0786ee0f6855c461c975cac4940f01fc5208.zip |
Fixing func "*" ping functionality, which had an earlier reference to expand_servers that is no longer supported. To do this, I've exposed an additional method in the client.minions() API. Also some more work done on func "check" command to diagnose setup problems.
Diffstat (limited to 'func')
-rwxr-xr-x | func/overlord/client.py | 7 | ||||
-rw-r--r-- | func/overlord/cmd_modules/check.py | 31 | ||||
-rw-r--r-- | func/overlord/cmd_modules/ping.py | 4 |
3 files changed, 35 insertions, 7 deletions
diff --git a/func/overlord/client.py b/func/overlord/client.py index f07e526..fdcf875 100755 --- a/func/overlord/client.py +++ b/func/overlord/client.py @@ -105,6 +105,7 @@ class Minions(object): def _get_new_hosts(self): self.new_hosts = self.group_class.get_hosts_by_groupgoo(self.spec) + return self.new_hosts def _get_all_hosts(self): seperate_gloobs = self.spec.split(";") @@ -116,6 +117,12 @@ class Minions(object): self.all_certs.append(cert) host = cert.replace(self.config.certroot,"")[1:-5] self.all_hosts.append(host) + return self.all_hosts + + def get_all_hosts(self): + self._get_new_hosts() + self._get_all_hosts() + return self.all_hosts def get_urls(self): self._get_new_hosts() diff --git a/func/overlord/cmd_modules/check.py b/func/overlord/cmd_modules/check.py index 58c2b97..cf1badb 100644 --- a/func/overlord/cmd_modules/check.py +++ b/func/overlord/cmd_modules/check.py @@ -56,6 +56,10 @@ class CheckAction(client.command.Command): print "* FQDN is detected as %s, verify that is correct" % hostname self.check_iptables() + if not os.getuid() == 0: + print "* root is required to run these setup tests" + return + if self.check_minion: # check that funcd is running @@ -66,9 +70,6 @@ class CheckAction(client.command.Command): if self.check_certmaster: - # check UID - # FIXME: todo - # check that certmasterd is running self.check_service("certmasterd") @@ -79,7 +80,27 @@ class CheckAction(client.command.Command): # FIXME: TODO # construct a client handle and see if any hosts are reachable - + self.server_spec = self.parentCommand.server_spec + + client_obj = client.Client( + self.server_spec, + port=self.port, + interactive=False, + verbose=False, + config=self.config + ) + results = client_obj.test.add(1,2) + hosts = results.keys() + if len(hosts) == 0: + print "* no systems have signed certs" + else: + failed = 0 + for x in hosts: + if results[x] != 3: + failed = failed+1 + if failed != 0: + print "* unable to connect to %s registered minions from overlord" % failed + print "* run func '*' ping to check status" # see if any of our certs have expired @@ -106,7 +127,7 @@ class CheckAction(client.command.Command): cert_dir = config.cert_dir # FIXME: don't hardcode port master_uri = "http://%s:51235/" % config.certmaster - print "* minion is set to talk to host '%s' for certs in /etc/func/minion.conf" % config.certmaster + print "* this minion is configured in /etc/func/minion.conf to talk to host '%s' for certs, verify that is correct" % config.certmaster # this will be a 501, unsupported GET, but we should be # able to tell if we can make contact connect_ok = True diff --git a/func/overlord/cmd_modules/ping.py b/func/overlord/cmd_modules/ping.py index e056f0b..438e2a9 100644 --- a/func/overlord/cmd_modules/ping.py +++ b/func/overlord/cmd_modules/ping.py @@ -52,8 +52,8 @@ class Ping(client.command.Command): # 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) + minion_set = client.Minions(self.server_spec, port=self.options.port) + servers = minion_set.get_all_hosts() for server in servers: |