func/overlord scripts/func-ps-compare scripts/func-yum

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 func/overlord/client.py           |    7 +++++++
 func/overlord/cmd_modules/grep.py |    4 ++--
 func/overlord/cmd_modules/ping.py |    5 +----
 scripts/func-ps-compare           |    2 +-
 scripts/func-yum                  |    2 +-
 5 files changed, 12 insertions(+), 8 deletions(-)

New commits:
commit f48e501bfc17aaab9c3eb20989356832559651d5
Author: S.Ã?aÄ?lar Onur <caglar@xxxxxxxx>
Date:   Wed May 25 20:31:21 2011 -0400

    introduce a new function called get_all_up_hosts which returns host list - downed host list so that scripts (func-yum and func-ps-compare) and modules (ping and grep) can relay on it

diff --git a/func/overlord/client.py b/func/overlord/client.py
index c893bae..3fd2fc2 100644
--- a/func/overlord/client.py
+++ b/func/overlord/client.py
@@ -244,6 +244,13 @@ class Minions(object):
         #we keep it all the time as a set so
         return list(self.all_hosts)
 
+    def get_all_up_hosts(self):
+        """
+        Get current host list excluding down nodes
+        """
+        #we keep it all the time as a set so
+        return list(set(self.get_all_hosts()) - set(self.downed_hosts))
+
     def get_urls(self, hosts=[]):
         if not hosts:
             self._get_new_hosts()
diff --git a/func/overlord/cmd_modules/grep.py b/func/overlord/cmd_modules/grep.py
index acb97df..1175f95 100644
--- a/func/overlord/cmd_modules/grep.py
+++ b/func/overlord/cmd_modules/grep.py
@@ -89,7 +89,7 @@ class Grep(base_command.BaseCommand):
 
         for host in host_modules.keys():
             host_only_mc = self.overlord_obj._mc(host, noglobs=True)
-            host_only_mc.get_all_hosts()
+            host_only_mc.get_all_up_hosts()
             self.overlord_obj.minions_class = host_only_mc
             for module in host_modules[host]:
                 if self.options.modules and module in self.options.modules:
@@ -125,7 +125,7 @@ class Grep(base_command.BaseCommand):
         if not hasattr(self, 'overlord_obj'):
             self.getOverlord()
 
-        hosts = self.overlord_obj.minions_class.get_all_hosts()
+        hosts = self.overlord_obj.minions_class.get_all_up_hosts()
         existent_minions_class = self.overlord_obj.minions_class # keep a copy
         if not hosts:
             raise Exception("No minions on system!")
diff --git a/func/overlord/cmd_modules/ping.py b/func/overlord/cmd_modules/ping.py
index 747a7da..420ab6f 100644
--- a/func/overlord/cmd_modules/ping.py
+++ b/func/overlord/cmd_modules/ping.py
@@ -52,12 +52,9 @@ class Ping(base_command.BaseCommand):
         minion_set = client.Minions(self.server_spec, port=self.port)
         if minion_set.overlord_config.puppet_minions:
             minion_set = client.PuppetMinions(self.server_spec, port=self.port)
-        servers = minion_set.get_all_hosts()
+        servers = minion_set.get_all_up_hosts()
 
         for server in servers:
-            if server in minion_set.downed_hosts:
-                continue
-
             overlord_obj = client.Overlord(server,
                                            interactive=False,
                                            verbose=self.verbose,
diff --git a/scripts/func-ps-compare b/scripts/func-ps-compare
index cc2bfb8..4190a81 100755
--- a/scripts/func-ps-compare
+++ b/scripts/func-ps-compare
@@ -10,7 +10,7 @@ from func.utils import is_error
 
 def get_host_list(hosts):
     fc = fclient.Client(hosts)
-    host_list = fc.minions_class.get_all_hosts() # grumble
+    host_list = fc.minions_class.get_all_up_hosts()
     return host_list
     
     
diff --git a/scripts/func-yum b/scripts/func-yum
index 3ed9390..23b388b 100755
--- a/scripts/func-yum
+++ b/scripts/func-yum
@@ -464,7 +464,7 @@ def search(hosts, opts, search_str, target=None):
 
 def get_host_list(hosts):
     fc = fclient.Client(hosts)
-    host_list = fc.minions_class.get_all_hosts() # grumble
+    host_list = fc.minions_class.get_all_up_hosts()
     return host_list
     
 def main(args):


_______________________________________________
Func-list mailing list
Func-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/func-list

[Index of Archives]     [Fedora Users]     [Linux Networking]     [Fedora Legacy List]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux