You are viewing a plain text version of this content. The canonical link for it is here.
Posted to tashi-commits@incubator.apache.org by st...@apache.org on 2010/04/21 04:53:00 UTC

svn commit: r936155 - in /incubator/tashi/trunk/src/tashi: dfs/vfs.py nodemanager/nodemanagerservice.py

Author: stroucki
Date: Wed Apr 21 04:52:59 2010
New Revision: 936155

URL: http://svn.apache.org/viewvc?rev=936155&view=rev
Log:
use shutil for file manipulation, rather than system()

Modified:
    incubator/tashi/trunk/src/tashi/dfs/vfs.py
    incubator/tashi/trunk/src/tashi/nodemanager/nodemanagerservice.py

Modified: incubator/tashi/trunk/src/tashi/dfs/vfs.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/tashi/dfs/vfs.py?rev=936155&r1=936154&r2=936155&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/dfs/vfs.py (original)
+++ incubator/tashi/trunk/src/tashi/dfs/vfs.py Wed Apr 21 04:52:59 2010
@@ -15,6 +15,9 @@
 # specific language governing permissions and limitations
 # under the License.    
 
+# implementation of dfs interface functions
+
+import shutil
 import os
 import os.path
 from dfsinterface import DfsInterface
@@ -23,19 +26,24 @@ class Vfs(DfsInterface):
 	def __init__(self, config):
 		DfsInterface.__init__(self, config)
 		self.prefix = self.config.get("Vfs", "prefix")
-	
+
+# why do these three need to be separate?	
 	def copyTo(self, localSrc, dst):
-		(si, so, se) = os.popen3("cp %s %s" % (localSrc, 
-						       os.path.join(self.prefix, dst)))
-		so.readlines()
+		shutil.copy(localSrc, os.path.join(self.prefix, dst))
+# just assuming this works
 		return None
 	
 	def copyFrom(self, src, localDst):
-		(si, so, se) = os.popen3("cp %s %s" % (os.path.join(self.prefix, src),
-						       localDst))
-		so.readlines()
+		shutil.copy(os.path.join(self.prefix, src), localDst)
+# just assuming this works
 		return None
 
+	def copy(self, src, dst):
+		shutil.copy(os.path.join(self.prefix, src),
+			    os.path.join(self.prefix, dst))
+# just assuming this works
+		return None
+	
 	def list(self, path):
 		try:
 			return os.listdir(os.path.join(self.prefix, path))
@@ -49,15 +57,9 @@ class Vfs(DfsInterface):
 		return os.stat(os.path.join(self.prefix, path))
 	
 	def move(self, src, dst):
-		(si, so, se) = os.popen3("mv %s %s" % (os.path.join(self.prefix, src), 
-						       os.path.join(self.prefix, dst)))
-		so.readlines()
-		return None
-	
-	def copy(self, src, dst):
-		(si, so, se) = os.popen3("cp %s %s" % (os.path.join(self.prefix, src), 
-						       os.path.join(self.prefix, dst)))
-		so.readlines()
+		shutil.move(os.path.join(self.prefix, src), 
+			    os.path.join(self.prefix, dst))
+# just assuming this works
 		return None
 	
 	def mkdir(self, path):

Modified: incubator/tashi/trunk/src/tashi/nodemanager/nodemanagerservice.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/tashi/nodemanager/nodemanagerservice.py?rev=936155&r1=936154&r2=936155&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/nodemanager/nodemanagerservice.py (original)
+++ incubator/tashi/trunk/src/tashi/nodemanager/nodemanagerservice.py Wed Apr 21 04:52:59 2010
@@ -75,6 +75,7 @@ class NodeManagerService(object):
 			f.close()
 			self.instances = cPickle.loads(data)
 		except Exception, e:
+# this fails reasonably often. should probably not be a verbose exception
 			self.log.exception('Failed to load VM info from %s' % (self.infoFile))
 			self.instances = {}