func/logger.py func/minion func/module_loader.py func/utils.py

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

 



 func/logger.py                     |    3 ++-
 func/minion/modules/fact.py        |    2 +-
 func/minion/modules/filetracker.py |    2 +-
 func/minion/modules/func_module.py |    5 ++++-
 func/minion/modules/hardware.py    |    2 +-
 func/minion/modules/mount.py       |    2 +-
 func/minion/modules/networktest.py |    2 +-
 func/minion/modules/process.py     |    2 +-
 func/minion/modules/rpms.py        |    2 +-
 func/minion/modules/service.py     |    2 +-
 func/minion/modules/smart.py       |    2 +-
 func/minion/modules/sysctl.py      |    2 +-
 func/minion/modules/users.py       |    2 +-
 func/minion/modules/yumcmd.py      |    2 +-
 func/minion/server.py              |    2 +-
 func/module_loader.py              |    6 ++++--
 func/utils.py                      |    5 ++++-
 17 files changed, 27 insertions(+), 18 deletions(-)

New commits:
commit 4c8d37f103d346d1c6d66a718b183130a7882818
Author: Andreas Thienemann <andreas.thienemann@xxxxxxxxxxx>
Date:   Mon Mar 29 16:49:10 2010 -0400

    patches to force func back to python 2.3 compat level

diff --git a/func/logger.py b/func/logger.py
index a706ef7..ad9438c 100644
--- a/func/logger.py
+++ b/func/logger.py
@@ -160,7 +160,6 @@ EXCEPTION_LOGGER = 1
 
 class LogFactory(object):
     
-    @staticmethod
     def get_instance(type=STANDART_LOGGER,app_name="direct_log",log_place=None):
         if type == STANDART_LOGGER:
             if not log_place:
@@ -177,3 +176,5 @@ class LogFactory(object):
             return logger
         else:
             return None
+    get_instance = staticmethod(get_instance)
+
diff --git a/func/minion/modules/fact.py b/func/minion/modules/fact.py
index f67f645..b2d87cf 100644
--- a/func/minion/modules/fact.py
+++ b/func/minion/modules/fact.py
@@ -62,7 +62,6 @@ class FactsModule(func_module.FuncModule):
                 return method() 
         return {}
     
-    @func_module.findout
     def grep(self, word):
         """
         Get some info about facts
@@ -86,4 +85,5 @@ class FactsModule(func_module.FuncModule):
 
         #the final collected stuff here
         return result
+    grep = func_module.findout(grep)
         
diff --git a/func/minion/modules/filetracker.py b/func/minion/modules/filetracker.py
index 4643570..156f051 100644
--- a/func/minion/modules/filetracker.py
+++ b/func/minion/modules/filetracker.py
@@ -198,7 +198,6 @@ class FileTracker(func_module.FuncModule):
 
     #==========================================================
     
-    @func_module.findout
     def grep(self, word):
         """
         Some search utility about tracked files
@@ -215,6 +214,7 @@ class FileTracker(func_module.FuncModule):
                     results[self.inventory].append(res)
             
         return results
+    grep = func_module.findout(grep)
     
     
     def __sumfile(self, fobj):
diff --git a/func/minion/modules/func_module.py b/func/minion/modules/func_module.py
index cec8a0b..e02d4a6 100644
--- a/func/minion/modules/func_module.py
+++ b/func/minion/modules/func_module.py
@@ -44,7 +44,10 @@ def log_all(fn):
     
     #a hack for get_arg_methods
     wrapper.overriden_args = inspect.getargspec(fn)
-    wrapper.__name__ = fn.__name__
+    try:
+        wrapper.__name__ = fn.__name__
+    except:
+        wrapper._name_ = fn.__name__
     return wrapper
 
 
diff --git a/func/minion/modules/hardware.py b/func/minion/modules/hardware.py
index e49f203..ce72c2b 100644
--- a/func/minion/modules/hardware.py
+++ b/func/minion/modules/hardware.py
@@ -67,7 +67,6 @@ class HardwareModule(func_module.FuncModule):
             del data["bogomips"]
         return data
 
-    @func_module.findout
     def grep(self,word):
         """
         Find something in hardware info 
@@ -97,6 +96,7 @@ class HardwareModule(func_module.FuncModule):
         
         #get the final result
         return result
+    grep = func_module.findout(grep)
 
 
 
diff --git a/func/minion/modules/mount.py b/func/minion/modules/mount.py
index a30c4c2..f871b38 100644
--- a/func/minion/modules/mount.py
+++ b/func/minion/modules/mount.py
@@ -85,7 +85,6 @@ class MountModule(func_module.FuncModule):
         return self.list()
 
     
-    @func_module.findout
     def grep(self,word):
         """
         Get some info about mounted devices
@@ -99,6 +98,7 @@ class MountModule(func_module.FuncModule):
                     if m_k.lower().find(word)!=-1 or m_v.lower().find(word)!=-1:
                         results[self.list].append({m_k:m_v})
         return results
+    grep = func_module.findout(grep)
                     
         
 
diff --git a/func/minion/modules/networktest.py b/func/minion/modules/networktest.py
index 8928787..4d1d20f 100644
--- a/func/minion/modules/networktest.py
+++ b/func/minion/modules/networktest.py
@@ -54,7 +54,6 @@ class NetworkTest(func_module.FuncModule):
         sock.close()
         return [0, "connection to %s:%s succeeded" % (host, port)]
 
-    @func_module.findout
     def grep(self, word):
         """
         Grep some info from grep test
@@ -70,6 +69,7 @@ class NetworkTest(func_module.FuncModule):
                 results[self.netstat].append(res)
         
         return results
+    grep = func_module.findout(grep)
 
     def __args_to_list(self, args):
         return [arg for arg in args]
diff --git a/func/minion/modules/process.py b/func/minion/modules/process.py
index 55114a8..e1186c9 100644
--- a/func/minion/modules/process.py
+++ b/func/minion/modules/process.py
@@ -224,7 +224,6 @@ class ProcessModule(func_module.FuncModule):
     def loadavg(self):
         return open("/proc/loadavg", "r").readline().strip().split(" ")
 
-    @func_module.findout
     def grep(self, word):
         """
         Some grep info about :
@@ -251,6 +250,7 @@ class ProcessModule(func_module.FuncModule):
         
         
         return results
+    grep = func_module.findout(grep)
     
 
     def register_method_args(self):
diff --git a/func/minion/modules/rpms.py b/func/minion/modules/rpms.py
index 289e099..a788a81 100644
--- a/func/minion/modules/rpms.py
+++ b/func/minion/modules/rpms.py
@@ -45,7 +45,6 @@ class RpmModule(func_module.FuncModule):
                 results.append([name, epoch, version, release, arch])
         return results
 
-    @func_module.findout
     def grep(self, word):
         """
         Grep some info from packages we got from
@@ -59,6 +58,7 @@ class RpmModule(func_module.FuncModule):
                 results[self.inventory].append(res)
         
         return results
+    grep = func_module.findout(grep)
 
     def verify(self, pattern='', flatten=True):
         """
diff --git a/func/minion/modules/service.py b/func/minion/modules/service.py
index c012bcc..b17aac5 100644
--- a/func/minion/modules/service.py
+++ b/func/minion/modules/service.py
@@ -55,7 +55,6 @@ class Service(func_module.FuncModule):
             "enabled" : self.get_enabled()
         }
 
-    @func_module.findout
     def grep(self,word):
         """
         Dig for some useful info in that module ...
@@ -77,6 +76,7 @@ class Service(func_module.FuncModule):
                 final_dict[self.get_running].append(e)
 
         return final_dict
+    grep = func_module.findout(grep)
         
 
 
diff --git a/func/minion/modules/smart.py b/func/minion/modules/smart.py
index 3d9374e..7acccf9 100644
--- a/func/minion/modules/smart.py
+++ b/func/minion/modules/smart.py
@@ -46,7 +46,6 @@ class SmartModule(func_module.FuncModule):
 
         return (cmd.returncode, results)
 
-    @func_module.findout
     def grep(self, word):
         """
         grep some info from grep
@@ -59,6 +58,7 @@ class SmartModule(func_module.FuncModule):
                 if res.lower().find(word)!=-1:
                     results[self.info].append(res)
         return results
+    grep = func_module.findout(grep)
 
     def register_method_args(self):
         """
diff --git a/func/minion/modules/sysctl.py b/func/minion/modules/sysctl.py
index 6edf955..71ecb6c 100644
--- a/func/minion/modules/sysctl.py
+++ b/func/minion/modules/sysctl.py
@@ -31,7 +31,6 @@ class SysctlModule(func_module.FuncModule):
     def set(self, name, value):
         return self.__run("/sbin/sysctl -w %s=%s" % (name, value))
 
-    @func_module.findout
     def grep(self, word):
         """
         Grep info from sysctl
@@ -44,6 +43,7 @@ class SysctlModule(func_module.FuncModule):
                 results[self.list].append(res)
         
         return results
+    grep = func_module.findout(grep)
 
             
     def register_method_args(self):
diff --git a/func/minion/modules/users.py b/func/minion/modules/users.py
index de5c7bd..ca84fa0 100644
--- a/func/minion/modules/users.py
+++ b/func/minion/modules/users.py
@@ -479,7 +479,6 @@ class UsersModule(func_module.FuncModule):
     """Returns group info for all users on the target system(s)."""
     return self.groups_inventory()
   
-  @func_module.findout
   def grep(self, word):
     """
     Grep some info from user_list and
@@ -496,6 +495,7 @@ class UsersModule(func_module.FuncModule):
     results[self.user_list].extend([res for res in user_list if res.lower().find(word)!=-1])
     results[self.group_list].extend([res for res in group_list if res.lower().find(word)!=-1])
     return results
+  grep = func_module.findout(grep)
 
 # CONVERSION METHODS
   def user_to_uid(self,user):
diff --git a/func/minion/modules/yumcmd.py b/func/minion/modules/yumcmd.py
index 93e96b2..b615ce2 100644
--- a/func/minion/modules/yumcmd.py
+++ b/func/minion/modules/yumcmd.py
@@ -71,7 +71,6 @@ class Yum(func_module.FuncModule):
 
         return map(str, pkg_list)
     
-    @func_module.findout
     def grep(self, word):
         """
         Grep info from module
@@ -81,6 +80,7 @@ class Yum(func_module.FuncModule):
         results[self.check_update].extend([res for res in update_res if res.lower().find(word)!=-1])
         
         return results
+    grep = func_module.findout(grep)
     
     def register_method_args(self):
         """
diff --git a/func/minion/server.py b/func/minion/server.py
index e2c4ed7..3c9d357 100644
--- a/func/minion/server.py
+++ b/func/minion/server.py
@@ -105,7 +105,6 @@ class XmlRpcInterface(object):
         pass
     
     import func.minion.modules.func_module as fm
-    @fm.findout
     def grep(self,word):
         """
         Finding the wanted word
@@ -128,6 +127,7 @@ class XmlRpcInterface(object):
                 return_dict[self.list_methods]=m
 
         return return_dict
+    grep = fm.findout(grep)
 
 
     def inventory(self):
diff --git a/func/module_loader.py b/func/module_loader.py
index f7dcd90..fbc98e2 100644
--- a/func/module_loader.py
+++ b/func/module_loader.py
@@ -108,13 +108,15 @@ def load_modules(path='func/minion/modules/', main_class=func_module.FuncModule,
             # A module that raises an ImportError is (for now) simply not loaded.
             errmsg = _("Import error while loading %s module: %s")
             log.warning(errmsg % (mod_imp_name, e))
-            log.warning("%s" % traceback.format_exc())
+            etype, value, tb = sys.exc_info()
+            log.warning(traceback.format_exception(etype, value, tb))
             bad_mods[mod_imp_name] = True
             continue
         except:
             errmsg = _("Could not load %s module")
             log.warning(errmsg % (mod_imp_name))
-            log.warning("%s" % traceback.format_exc())
+            etype, value, tb = sys.exc_info()
+            log.warning(traceback.format_exception(etype, value, tb))
             bad_mods[mod_imp_name] = True
             continue
 
diff --git a/func/utils.py b/func/utils.py
index 011b902..d4ca37b 100644
--- a/func/utils.py
+++ b/func/utils.py
@@ -161,7 +161,10 @@ def get_fresh_method_instance(function_ref):
         except Exception,e:
             #something went wrong so we return the normal reference value
             return function_ref
-        return getattr(fresh_instance,function_ref.__name__)
+       	try:
+            return getattr(fresh_instance,function_ref.__name__)
+	except AttributeError:
+            return getattr(fresh_instance,function_ref._name_)
 
 def should_log(args):
     if args and type(args[len(args)-1]) == dict and args[len(args)-1].has_key('__logger__') and args[len(args)-1]['__logger__'] == True:


_______________________________________________
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