patch func rhel3 compatibility

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

 



The following patch, plus python logging module is an initial steps towards
 rhel3 compatibility.

 I forgot to mention in the certmaster e-mail that it would be nice to come
 up with a conditional around the "from __future__ import generators"

 -greg


 diff --git a/func/forkbomb.py b/func/forkbomb.py
 index 0168e8a..4a581be 100644
 --- a/func/forkbomb.py
 +++ b/func/forkbomb.py
 @@ -31,7 +31,11 @@ def __get_storage(dir):
     dir = os.path.expanduser(dir)
     if not os.path.exists(dir):
         os.makedirs(dir)
 -    return tempfile.mktemp(suffix='', prefix='asynctmp', dir=dir)
 +    tempfile.tempdir = dir
 +    try:
 +        return tempfile.mkstemp(suffix='asynctmp')
 +    except:
 +        return tempfile.mktemp(suffix='asynctmp')

  def __access_buckets(filename,clear,new_key=None,new_value=None):
     """
 @@ -135,6 +139,7 @@ def
 batch_run(pool,callback,nforks=DEFAULT_FORKS,cachedir=DEFAULT_CACHE_DIR):
        # modulus voodoo gets crazy otherwise and bad things happen
        nforks = 1
     shelf_file = __get_storage(cachedir)
 +    print "Shelf_file: %s" % (shelf_file)
     __access_buckets(shelf_file,True,None)
     buckets = __bucketize(pool, nforks)
     __forkbomb(0,buckets,callback,shelf_file)
 diff --git a/func/module_loader.py b/func/module_loader.py
 index 2aa1378..c3a726f 100755
 --- a/func/module_loader.py
 +++ b/func/module_loader.py
 @@ -27,6 +27,12 @@ from inspect import isclass
  from func.minion.modules import func_module
  from func.utils import is_public_valid_method

 +try:
 +  os.walk
 +except:
 +  from aoOSWalk import aoOSWalk as walk
 +  os.walk = walk
 +
  def module_walker(topdir):
     module_files = []
     for root, dirs, files in os.walk(topdir):
 diff --git a/func/overlord/client.py b/func/overlord/client.py
 index 5d930fe..03dad32 100755
 --- a/func/overlord/client.py
 +++ b/func/overlord/client.py
 @@ -460,8 +460,8 @@ class Overlord(object):
         else: #we're directly calling minions, so treat everything
 normally
             spec = self.server_spec
             minionurls = self.minions
 -            #print "Minion_url is :",minionurls
 -            #print "Process server is :",process_server
 +            print "Minion_url is :",minionurls
 +            print "Process server is :",process_server

         if not self.noglobs:
             if self.nforks > 1 or self.async:
 @@ -470,7 +470,8 @@ class Overlord(object):

                     results = forkbomb.batch_run(minionurls,
 process_server, nforks)
                 else:
 -                    minion_info
 =dict(spec=spec,module=module,method=method)
 +#                    minion_info
 =dict(spec=spec,module=module,method=method)
 +                    minion_info =
 {'spec':spec,'module':module,'method':method}
                     results = jobthing.batch_run(minionurls,
 process_server,nforks,**minion_info)
             else:
                 # no need to go through the fork code, we can do this
 directly
 diff --git a/func/overlord/delegation_tools.py
 b/func/overlord/delegation_tools.py
 index 0f3b43e..3367c0f 100644
 --- a/func/overlord/delegation_tools.py
 +++ b/func/overlord/delegation_tools.py
 @@ -15,6 +15,8 @@
  ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  ##

 +from __future__ import generators
 +
  import fnmatch

  class groupby(object):
 diff --git a/func/overlord/groups.py b/func/overlord/groups.py
 index 77010ef..5c4a748 100644
 --- a/func/overlord/groups.py
 +++ b/func/overlord/groups.py
 @@ -42,8 +42,11 @@ class Groups(object):
         self.__parse()

     def __parse(self):
 -
 -        self.cp = ConfigParser.SafeConfigParser()
 +
 +        try:
 +            self.cp = ConfigParser.SafeConfigParser()
 +        except:
 +            self.cp = ConfigParser.ConfigParser()
         self.cp.read(self.__filename)

         #loop through the group_names

_______________________________________________
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