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
This commit is contained in:
Marek Marczykowski-Górecki 2015-05-23 04:41:49 +02:00
parent 449554f404
commit acbdb3a261

View File

@ -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)