2 commits - AUTHORS func/minion func/overlord func/utils.py

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

 



 AUTHORS                 |    1 +
 func/minion/server.py   |    2 +-
 func/overlord/client.py |    2 +-
 func/utils.py           |   13 ++++++++++---
 4 files changed, 13 insertions(+), 5 deletions(-)

New commits:
commit e5dcb8d9aa5ed9b8e24fc570c82c65fea43d7746
Author: John Eckersberg <jeckersb@xxxxxxxxxx>
Date:   Tue Apr 13 15:40:56 2010 -0400

    Backwards compatibility for xmlrpc Binary encoding
    
    This will allow older minions to continue working with a newer
    overlord but the inverse is not possible without some relatively
    intrusive changes
    
    (Thanks to Adam DeBuysscher)

diff --git a/AUTHORS b/AUTHORS
index 8cfa477..87fb8b8 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -17,6 +17,7 @@ Additional patches and contributions by ...
    Jasper Capel <capel@xxxxxxxxxxxx>
    Louis Coilliot <louis.coilliot@xxxxxxxxx>
    Eli Criffield <elicriffield@xxxxxxxxx>
+   Adam DeBuysscher <adebuyss@xxxxxxxxx>
    John Eckersberg <jeckersb@xxxxxxxxxx>
    Luca Foppiano <lfoppiano@xxxxxxxxxxxxx>
    Matt Hicks <mhicks@xxxxxxxxxx>
diff --git a/func/overlord/client.py b/func/overlord/client.py
index b9f8d76..4e924c6 100644
--- a/func/overlord/client.py
+++ b/func/overlord/client.py
@@ -786,7 +786,7 @@ class Overlord(object):
                 if self.interactive:
                     print retval
 
-                retval = func_utils.deep_base64(retval)
+                retval = func_utils.deep_base64(retval,1)
 
             except Exception, e:
                 (t, v, tb) = sys.exc_info()
diff --git a/func/utils.py b/func/utils.py
index d4ca37b..f184013 100644
--- a/func/utils.py
+++ b/func/utils.py
@@ -171,22 +171,29 @@ def should_log(args):
         return True
     return False
 
-def deep_base64(ds):
+def deep_base64(ds, mode = 0):
     """
     Run through an arbitrary datastructure of dicts / lists / tuples
     to find all strings and base 64 encode/decode them with
     xmlrpclib.Binary objects.
+
+    mode 0 - flip, 1 - force decode, 2 - force encode
+
     """
     from xmlrpclib import Binary
 
     if isinstance(ds, Binary):
+        if mode == 2:
+             return ds
         return ds.data
 
     if isinstance(ds, basestring):
+        if mode == 1:
+             return ds
         return Binary(ds)
 
     if isinstance(ds, list) or isinstance(ds, tuple):
-        cleaned = map(lambda x: deep_base64(x), ds)
+        cleaned = map(lambda x: deep_base64(x,mode), ds)
         if isinstance(ds, tuple):
             cleaned = tuple(cleaned)
         return cleaned
@@ -194,7 +201,7 @@ def deep_base64(ds):
     if isinstance(ds, dict):
         cleaned = {}
         for k,v in ds.iteritems():
-            cleaned[deep_base64(k)] = deep_base64(v)
+            cleaned[deep_base64(k)] = deep_base64(v,mode)
         return cleaned
 
     return ds


commit a171dd6d0dc2ee098a8bfab30b6e413fc70f8217
Author: John Eckersberg <jeckersb@xxxxxxxxxx>
Date:   Tue Apr 13 15:38:36 2010 -0400

    encode tracebacks

diff --git a/func/minion/server.py b/func/minion/server.py
index 3c9d357..101868d 100644
--- a/func/minion/server.py
+++ b/func/minion/server.py
@@ -331,7 +331,7 @@ class FuncSSLXMLRPCServer(AuthedXMLRPCServer.AuthedSSLXMLRPCServer,
         except:
             (t, v, tb) = sys.exc_info()
             rc = utils.nice_exception(t, v, tb)
-            return rc
+            return futils.deep_base64(rc)
 
     def auth_cb(self, request, client_address):
         peer_cert = request.get_peer_certificate()


_______________________________________________
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