replaced syscall with os.popen
authorft
Fri, 06 Jun 2014 11:43:10 +0200
changeset 1147c25c3d6db2
parent 10 b9b23dd0ba4d
child 12 ee0ff4b21221
replaced syscall with os.popen
src/encryptionprovider.py
     1.1 --- a/src/encryptionprovider.py	Fri Jun 06 10:47:55 2014 +0200
     1.2 +++ b/src/encryptionprovider.py	Fri Jun 06 11:43:10 2014 +0200
     1.3 @@ -132,23 +132,18 @@
     1.4  
     1.5  def isDeviceMountedAtMountpoint (device, mountpoint):
     1.6      command = ("/bin/df %s | /usr/bin/tail -1 | awk '{print $1}'" %(mountpoint,))
     1.7 +    pipe = os.popen(command)
     1.8 +    result = pipe.read()
     1.9      
    1.10 -    #result = os.popen(command)
    1.11 -    
    1.12 -    result = runExternalScripts(command)
    1.13 -    
    1.14 -    if (result["retcode"] != 0):
    1.15 -        LOG.error ("Retcode: %s" %(result["retcode"],))
    1.16 -        LOG.error ("stdout: %s" %(result["stdout"],))
    1.17 -        LOG.error ("stderr: %s" %(result["stderr"],))
    1.18 -        sys.stderr.write("%s" %(result["stderr"],))
    1.19 +    if (pipe.close() != None):
    1.20 +        LOG.error ("error: %s" %(result,))
    1.21          exit (1)
    1.22      
    1.23 -    if (result["stdout"] == device):
    1.24 -        LOG.debug ("Result stdout: %s" %(result["stdout"],))
    1.25 +    if (result == device):
    1.26 +        LOG.debug ("Result: %s" %(result,))
    1.27          return True
    1.28      else:
    1.29 -        LOG.debug ("Result stdout: %s" %(result["stdout"],))
    1.30 +        LOG.debug ("Result: %s" %(result,))
    1.31          return False
    1.32      
    1.33