소스 검색

qvm-tools: do not show scary message on --force-root

When this option is used, the user probably already got that message.
Also some internal scripts are using this (for example template
pre-uninstall script).

Conflicts:
	qvm-tools/qvm-remove
Marek Marczykowski-Górecki 9 년 전
부모
커밋
acbdb3a261
1개의 변경된 파일4개의 추가작업 그리고 7개의 파일을 삭제
  1. 4 7
      qvm-tools/qvm-remove

+ 4 - 7
qvm-tools/qvm-remove

@@ -47,14 +47,11 @@ def main():
         print >> sys.stderr, "A VM with the name '{0}' does not exist in the system.".format(vmname)
         exit(1)
 
-    if hasattr(os, "geteuid") and os.geteuid() == 0:
+    if hasattr(os, "geteuid") and os.geteuid() == 0 and not options.force_root:
         print >> sys.stderr, "*** Running this tool as root is strongly discouraged, this will lead you in permissions problems."
-        if options.force_root:
-            print >> sys.stderr, "Continuing as commanded. You have been warned."
-        else:
-            print >> sys.stderr, "Retry as unprivileged user."
-            print >> sys.stderr, "... or use --force-root to continue anyway."
-            exit(1)
+        print >> sys.stderr, "Retry as unprivileged user."
+        print >> sys.stderr, "... or use --force-root to continue anyway."
+        exit(1)
 
     if vm.is_template():
         dependent_vms = qvm_collection.get_vms_based_on(vm.qid)