dom0/qubes-prefs: do not dupplicate VM checks (#421)

This commit is contained in:
Marek Marczykowski 2012-02-07 13:31:04 +01:00
parent f2204801c3
commit 9f50732ee6

View File

@ -43,14 +43,11 @@ def handle_vm(vms, label, new_value = None):
if vm is None: if vm is None:
print >> sys.stderr, "A VM with the name '{0}' does not exist in the system.".format(new_value) print >> sys.stderr, "A VM with the name '{0}' does not exist in the system.".format(new_value)
exit(1) exit(1)
# Additional checks try:
if label in [ 'default-netvm', 'default-fw-netvm' ] and not vm.is_netvm(): vms.__getattribute__(functions[label][1])(vm)
print >> sys.stderr, "VM '{0}' is not a NetVM".format(new_value) except Exception as e:
exit (1) print >> sys.stderr, "ERROR: {0}".format(str(e))
if label in [ 'default-templatevm' ] and not vm.is_template(): exit(1)
print >> sys.stderr, "VM '{0}' is not a template".format(new_value)
exit (1)
vms.__getattribute__(functions[label][1])(vm)
else: else:
vm = vms.__getattribute__(functions[label][0])() vm = vms.__getattribute__(functions[label][0])()
if vm is not None: if vm is not None: