[asterisk-scf-commits] asterisk-scf/integration/testsuite.git branch "review" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Wed Jun 1 08:20:08 CDT 2011


branch "review" has been updated
       via  0309113225c092e2ed8b9f3ded494fd0d007b2cb (commit)
      from  d238c3e9c3f17ce1ba2df36a445086184032d443 (commit)

Summary of changes:
 remote.py |   24 +++++++++++++++++++-----
 1 files changed, 19 insertions(+), 5 deletions(-)


- Log -----------------------------------------------------------------
commit 0309113225c092e2ed8b9f3ded494fd0d007b2cb
Author: Darren Sessions <dsessions at digium.com>
Date:   Wed Jun 1 08:20:05 2011 -0500

    added read file functions to the remote script as well as some very minor tweaks.

diff --git a/remote.py b/remote.py
index cb177bb..ade4b7b 100755
--- a/remote.py
+++ b/remote.py
@@ -185,13 +185,27 @@ class RemoteManagement(object):
         os.chdir('%s/tmp' % cwd)
         results = self.run('remote', 'archiveDir', [self._which('gzip'), 'tmp.tar'], True)
         return results
+    
+    def readFile(self, fn):
+        return rFile("%s/tmp/%s" % (cwd, fn))
+
+    def rFile(self, fn):
+        try:
+            f = open('%s' % fn, 'rb')
+        except IOError:
+            return {'success':False,'msg':'Failed to open %s.' % fn}
+        except:
+            return {'success':False,'msg':'Unexpected error: %s' % sys.exc_info()[0]}
+        data = xmlrpclib.Binary(f.read())
+        r.close()
+        return {'success':True, 'data':data}
 
     def writeFile(self, fn, fd):
         return self.wFile("%s/tmp/%s" % (cwd, fn), fd)
 
     def wFile(self, fn, fd):
         try:
-            f = open("%s" % fn, "w")
+            f = open('%s' % fn, 'w')
         except IOError:
             return {'success':False,'msg':'Failed to open test results output file: %s/tmp/%s' % (cwd, fn)}
         except:
@@ -202,7 +216,7 @@ class RemoteManagement(object):
 
     def remoteSideRecvFile(self, fn, fd, installPath):
         w = open('%s/tmp/%s' % (cwd, fn), "wb")
-        wc = w.write(fd.data)
+        w.write(fd.data)
         w.close()
         installPath = installPath.replace('!!TMP!!', '%s/tmp' % cwd)
         results = self.run('remoteSideRecvFile', 'tar', ['tar', '-xvf', '%s/tmp/%s' % (cwd, fn), '-C', '%s' % installPath], True)
@@ -220,9 +234,9 @@ class RemoteManagement(object):
             rpc.removeFile(fn)
         except:
             pass
-        r = open('%s/tmp/%s' % (cwd, fn), "rb")
-        results = rpc.remoteSideRecvFile(fn, xmlrpclib.Binary(r.read()), installPath)
-        r.close()
+        f = open('%s/tmp/%s' % (cwd, fn), "rb")
+        results = rpc.remoteSideRecvFile(fn, xmlrpclib.Binary(f.read()), installPath)
+        f.close()
         return results
    
     def whatAreMyIps(self):

-----------------------------------------------------------------------


-- 
asterisk-scf/integration/testsuite.git



More information about the asterisk-scf-commits mailing list