Commits

Thayne Harbaugh committed d0ca739

Error messages were incomplete; add error message to run as user root

Comments (0)

Files changed (1)

 class Cmd_exception(Exception):
     def __init__(self, cmd_info):
         self.cmd_info = cmd_info
-        Exception.__init__(self, cmd_info.stderr)
+        Exception.__init__(self, "%s: %s" % (cmd_info.cmdv[0], cmd_info.stderr))
 
 
 def run_cmd(cmdv, cwd=None, input=None):
     try:
         cmd_info = run_cmd(['umount', path])
     except Cmd_exception as excp:
-        raise Mount_exception(excp.cmd_info.stderr, excp.cmd_info.retcode)
+        raise Mount_exception(str(excp), excp.cmd_info.retcode)
     return
 
 
             raise Exception("Failed to locate udev for " + devname)
  
         if not detect_bdevs(found_udevs):
-            raise Exception("ERROR: device '%s' does not appear to be present")
+            raise Exception("ERROR: device '%s' does not appear to be present" % devname)
  
         udevs.append(found_udevs[0])
  
  
     except Exception as excp:
         print >> sys.stderr, excp
+        if 0 != os.getuid():
+            print >> sys.stderr, "Do you need to be root?"
         sys.exit(os.EX_SOFTWARE)
  
     if len(udevs) == 0: