2 commits - func/minion

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

 



 func/minion/modules/nagios-check.py |   52 -----------------------------
 func/minion/modules/nagios_check.py |   64 ++++++++++++++++++++++++++++++++++++
 2 files changed, 64 insertions(+), 52 deletions(-)

New commits:
commit bc9a9eb64697ce2cf9f8f7adf59286a3c0de6883
Author: Tim Bielawa <tbielawa@xxxxxxxxxx>
Date:   Thu Oct 20 13:10:31 2011 -0400

    Rename nagios-check.py to nagios_check.py

diff --git a/func/minion/modules/nagios-check.py b/func/minion/modules/nagios-check.py
deleted file mode 100644
index dc1fbd4..0000000
--- a/func/minion/modules/nagios-check.py
+++ /dev/null
@@ -1,64 +0,0 @@
-# Copyright 2007, Red Hat, Inc
-# James Bowes <jbowes@xxxxxxxxxx>
-# Seth Vidal modified command.py to be nagios-check.py
-#
-# This software may be freely redistributed under the terms of the GNU
-# general public license.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-"""
-Arbitrary command execution module for func.
-"""
-
-from certmaster.config import BaseConfig, Option
-import func_module
-try:
-    import subprocess
-#Needed for compatibility with Python < 2.4
-except ImportError:
-    from func.minion import sub_process as subprocess
-
-class NagiosCheck(func_module.FuncModule):
-
-    version = "0.0.2"
-    api_version = "0.0.1"
-    description = "Runs Nagios checks."
-
-    class Config(BaseConfig):
-        nagios_path = Option('/usr/lib/nagios/plugins')
-
-    def run(self, check_command):
-        """
-        Runs a Nagios check gathering the return code, stdout, and stderr 
-        as a tuple.
-        """
-        command = '%s/%s' % (self.options.nagios_path, check_command)
-
-        cmdref = subprocess.Popen(command.split(),
-                                   stdout=subprocess.PIPE,
-                                   stderr=subprocess.PIPE, 
-                                   shell=False, close_fds=True)
-        
-        data = cmdref.communicate()
-        return (cmdref.returncode, data[0], data[1])
-
-    def register_method_args(self):
-        """
-        Implementing argument getter part
-        """
-
-        return{
-                'run':{
-                    'args':{
-                        'check_command':{
-                            'type':'string',
-                            'optional':False,
-                            'description':"The command to be checked"
-                            }
-                        },
-                    'description':"Runs a nagios check returning the return code"
-                    }
-                }
diff --git a/func/minion/modules/nagios_check.py b/func/minion/modules/nagios_check.py
new file mode 100644
index 0000000..dc1fbd4
--- /dev/null
+++ b/func/minion/modules/nagios_check.py
@@ -0,0 +1,64 @@
+# Copyright 2007, Red Hat, Inc
+# James Bowes <jbowes@xxxxxxxxxx>
+# Seth Vidal modified command.py to be nagios-check.py
+#
+# This software may be freely redistributed under the terms of the GNU
+# general public license.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+"""
+Arbitrary command execution module for func.
+"""
+
+from certmaster.config import BaseConfig, Option
+import func_module
+try:
+    import subprocess
+#Needed for compatibility with Python < 2.4
+except ImportError:
+    from func.minion import sub_process as subprocess
+
+class NagiosCheck(func_module.FuncModule):
+
+    version = "0.0.2"
+    api_version = "0.0.1"
+    description = "Runs Nagios checks."
+
+    class Config(BaseConfig):
+        nagios_path = Option('/usr/lib/nagios/plugins')
+
+    def run(self, check_command):
+        """
+        Runs a Nagios check gathering the return code, stdout, and stderr 
+        as a tuple.
+        """
+        command = '%s/%s' % (self.options.nagios_path, check_command)
+
+        cmdref = subprocess.Popen(command.split(),
+                                   stdout=subprocess.PIPE,
+                                   stderr=subprocess.PIPE, 
+                                   shell=False, close_fds=True)
+        
+        data = cmdref.communicate()
+        return (cmdref.returncode, data[0], data[1])
+
+    def register_method_args(self):
+        """
+        Implementing argument getter part
+        """
+
+        return{
+                'run':{
+                    'args':{
+                        'check_command':{
+                            'type':'string',
+                            'optional':False,
+                            'description':"The command to be checked"
+                            }
+                        },
+                    'description':"Runs a nagios check returning the return code"
+                    }
+                }


commit 365a259b490651c6efd92480a6393365b5bfaf25
Author: Erinn Looney-Triggs <erinn.looneytriggs@xxxxxxxxx>
Date:   Fri Sep 30 10:38:02 2011 -0800

    Clean up nagios-check module. Allow it to work with config files, change class name to avoid collision, import sub_process properly and allow it to work with subprocess when needed.

diff --git a/func/minion/modules/nagios-check.py b/func/minion/modules/nagios-check.py
index c080e56..dc1fbd4 100644
--- a/func/minion/modules/nagios-check.py
+++ b/func/minion/modules/nagios-check.py
@@ -10,26 +10,38 @@
 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
 """
-Abitrary command execution module for func.
+Arbitrary command execution module for func.
 """
 
+from certmaster.config import BaseConfig, Option
 import func_module
-import sub_process
+try:
+    import subprocess
+#Needed for compatibility with Python < 2.4
+except ImportError:
+    from func.minion import sub_process as subprocess
 
-class Nagios(func_module.FuncModule):
+class NagiosCheck(func_module.FuncModule):
 
-    version = "0.0.1"
+    version = "0.0.2"
     api_version = "0.0.1"
-    description = "Runs nagios checks."
+    description = "Runs Nagios checks."
+
+    class Config(BaseConfig):
+        nagios_path = Option('/usr/lib/nagios/plugins')
 
     def run(self, check_command):
         """
-        Runs a nagios check returning the return code, stdout, and stderr as a tuple.
+        Runs a Nagios check gathering the return code, stdout, and stderr 
+        as a tuple.
         """
-        nagios_path='/usr/lib/nagios/plugins'
-        command = '%s/%s' % (nagios_path, check_command)
+        command = '%s/%s' % (self.options.nagios_path, check_command)
 
-        cmdref = sub_process.Popen(command.split(),stdout=sub_process.PIPE,stderr=sub_process.PIPE, shell=False, close_fds=True)
+        cmdref = subprocess.Popen(command.split(),
+                                   stdout=subprocess.PIPE,
+                                   stderr=subprocess.PIPE, 
+                                   shell=False, close_fds=True)
+        
         data = cmdref.communicate()
         return (cmdref.returncode, data[0], data[1])
 


_______________________________________________
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