2 commits - func/minion

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

 



 func/minion/modules/disk.py |   60 ++++++++++++++++++++++++++++++++++++++++++++
 func/minion/modules/rpms.py |    5 ++-
 2 files changed, 64 insertions(+), 1 deletion(-)

New commits:
commit dc1c1cc68829166443e5bd3a6e351f461809d465
Author: Greg Swift <gregswift@xxxxxxxxx>
Date:   Mon Jun 14 11:40:58 2010 -0400

    new module: disk, currently just provides df -P or df -P /partition

diff --git a/func/minion/modules/disk.py b/func/minion/modules/disk.py
new file mode 100644
index 0000000..f9a2c55
--- /dev/null
+++ b/func/minion/modules/disk.py
@@ -0,0 +1,60 @@
+#
+# Copyright 2009
+# Greg Swift <gregswift@xxxxxxxxx>
+#
+# 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.
+
+import func_module
+from func.minion import sub_process
+
+class DiskModule(func_module.FuncModule):
+    version = "0.0.1"
+    api_version = "0.0.1"
+    description = "Gathering disk related information"
+
+    def usage(self, partition=None):
+        """
+        Returns the results of df -P
+        """
+        results = {}
+        # splitting the command variable out into a list does not seem to function
+        # in the tests I have run
+        command = '/bin/df -P'
+        if (partition):
+            command += ' %s' % (partition)
+        cmdref = sub_process.Popen(command, stdout=sub_process.PIPE,
+                                   stderr=sub_process.PIPE, shell=True,
+                                   close_fds=True)
+        (stdout, stderr) = cmdref.communicate()
+        for disk in stdout.split('\n'):
+            if (disk.startswith('Filesystem') or not disk):
+                continue
+            (device, total, used, available, percentage, mount) = disk.split()
+            results[mount] = {'device':device,
+                              'total':int(total),
+                              'used':int(used),
+                              'available':int(available),
+                              'percentage':int(percentage[:-1])}
+        return results
+
+    def register_method_args(self):
+        """
+        The argument export method
+        """
+        return {
+                'usage':{
+                    'args':{
+                        'partition': {
+                            'type':'string',
+                            'optional':True,
+                            'description':'A specific partition to get usage data for',
+                            }
+                        },
+                    'description':'Gather disk usage information'
+                    }
+                }


commit e1e4348b71873ae721aa13b434a78efbbe3e336a
Author: Seth Vidal <skvidal@xxxxxxxxxxxxxxxxx>
Date:   Mon Jun 14 11:38:17 2010 -0400

    sort the results from the simple glob/list/inventory commands
    so we don't have to do it overlord-side

diff --git a/func/minion/modules/rpms.py b/func/minion/modules/rpms.py
index a788a81..a325d6f 100644
--- a/func/minion/modules/rpms.py
+++ b/func/minion/modules/rpms.py
@@ -43,6 +43,7 @@ class RpmModule(func_module.FuncModule):
                                                    release, arch))
             else:
                 results.append([name, epoch, version, release, arch])
+        results.sort()
         return results
 
     def grep(self, word):
@@ -56,8 +57,9 @@ class RpmModule(func_module.FuncModule):
         for res in inventory_res:
             if res.lower().find(word)!= -1:
                 results[self.inventory].append(res)
-        
+        results.sort()
         return results
+        
     grep = func_module.findout(grep)
 
     def verify(self, pattern='', flatten=True):
@@ -115,6 +117,7 @@ class RpmModule(func_module.FuncModule):
                                                        release, arch))
             else:
                 results.append([name, epoch, version, release, arch])
+        results.sort()
         return results
 
     def register_method_args(self):


_______________________________________________
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