summaryrefslogtreecommitdiffstats
path: root/func
diff options
context:
space:
mode:
authorAdrian Likins <alikins@grimlock.devel.redhat.com>2007-10-24 14:34:46 -0400
committerAdrian Likins <alikins@grimlock.devel.redhat.com>2007-10-24 14:34:46 -0400
commitbb56e5bf579267d4bc76883ebddcc7c0f8a8852c (patch)
tree2c7ee275149336990a15dab3f1335e8fa731280e /func
parentf01c90d5bdd39dd4061276985233b4880783116a (diff)
downloadthird_party-func-bb56e5bf579267d4bc76883ebddcc7c0f8a8852c.tar.gz
third_party-func-bb56e5bf579267d4bc76883ebddcc7c0f8a8852c.tar.xz
third_party-func-bb56e5bf579267d4bc76883ebddcc7c0f8a8852c.zip
change copyfile cmd line to transmit file contents as binary blobs
change copyfile minion module to accept blobs, add checksum_blob for doing plain blobs
Diffstat (limited to 'func')
-rw-r--r--func/minion/modules/copyfile.py14
-rw-r--r--func/overlord/cmd_modules/copyfile.py4
2 files changed, 14 insertions, 4 deletions
diff --git a/func/minion/modules/copyfile.py b/func/minion/modules/copyfile.py
index a4f91f0..6c81098 100644
--- a/func/minion/modules/copyfile.py
+++ b/func/minion/modules/copyfile.py
@@ -20,6 +20,10 @@ from modules import func_module
class CopyFile(func_module.FuncModule):
+ version = "0.0.1"
+ api_version = "0.0.2"
+
+
def __init__(self):
self.methods = {
@@ -28,6 +32,12 @@ class CopyFile(func_module.FuncModule):
}
func_module.FuncModule.__init__(self)
+ def _checksum_blob(self, blob):
+ CHUNK=2**16
+ thissum = sha.new()
+ thissum.update(blob)
+ return thissum.hexdigest()
+
def checksum(self, thing):
CHUNK=2**16
@@ -60,7 +70,7 @@ class CopyFile(func_module.FuncModule):
if not os.path.exists(dirpath):
os.makedirs(dirpath)
- remote_sum = self.checksum(filebuf)
+ remote_sum = self._checksum_blob(filebuf.data)
local_sum = 0
if os.path.exists(filepath):
local_sum = self.checksum(filepath)
@@ -74,7 +84,7 @@ class CopyFile(func_module.FuncModule):
# do the new write
try:
fo = open(filepath, 'w')
- fo.write(filebuf)
+ fo.write(filebuf.data)
fo.close()
del fo
except (IOError, OSError), e:
diff --git a/func/overlord/cmd_modules/copyfile.py b/func/overlord/cmd_modules/copyfile.py
index 9a6f54d..ff1f148 100644
--- a/func/overlord/cmd_modules/copyfile.py
+++ b/func/overlord/cmd_modules/copyfile.py
@@ -70,7 +70,7 @@ class CopyFile(client.command.Command):
gid = st.st_gid
-
- results = client_obj.run("copyfile", "copyfile", [self.options.remotepath, fb,
+ data = xmlrpclib.Binary(fb)
+ results = client_obj.run("copyfile", "copyfile", [self.options.remotepath, data,
mode, uid, gid])