python3 - 2to3 + miscell obvious tweaks
[sfa.git] / sfa / planetlab / nodemanager.py
index eb00fdc..2e755d9 100644 (file)
@@ -1,5 +1,5 @@
 import tempfile
-import commands
+import subprocess
 import os
 
 
@@ -18,7 +18,7 @@ class NodeManager:
         method = self.method
         sfa_slice_prefix = self.config.SFA_CM_SLICE_PREFIX
         sfa_slice = sfa_slice_prefix + "_sfacm"
-        python = "/usr/bin/python"
+        python = "/usr/bin/python2"
         vserver_path = "/vservers/%s" % (sfa_slice)
         script_path = "/tmp/"
         path = "%(vserver_path)s/%(script_path)s" % locals()
@@ -40,11 +40,11 @@ print s.%(method)s%(args)s"""  % locals()
             f.close()
             # make the file executeable
             chmod_cmd = "/bin/chmod 775 %(filename)s" % locals()
-            (status, output) = commands.getstatusoutput(chmod_cmd)
+            (status, output) = subprocess.getstatusoutput(chmod_cmd)
 
             # execute the commad as a slice with root NM privs
             cmd = 'su - %(sfa_slice)s -c "%(python)s %(scriptname)s"' % locals()
-            (status, output) = commands.getstatusoutput(cmd)
+            (status, output) = subprocess.getstatusoutput(cmd)
             return (status, output)
         finally:
             os.unlink(filename)