qvm-prefs: fix validation of 'timezone' property
This should be done in QubesVm class (property setter). But since we're going to rewrite both qvm-prefs and QubesVm, settle on smaller change for now. QubesOS/qubes-issues#1184
This commit is contained in:
parent
d2617917be
commit
28cc933c4c
@ -473,9 +473,12 @@ def set_timezone(vms, vm, args):
|
||||
print >> sys.stderr, "Missing value ('localtime' or timeoffset in seconds)!"
|
||||
return False
|
||||
|
||||
if not args[0].isdigit() and args[0].lower() == 'localtime':
|
||||
print >> sys.stderr, "Invalid timezone value!"
|
||||
return False
|
||||
try:
|
||||
int(args[0])
|
||||
except ValueError:
|
||||
if args[0].lower() != 'localtime':
|
||||
print >> sys.stderr, "Invalid timezone value!"
|
||||
return False
|
||||
|
||||
vm.timezone = args[0]
|
||||
return True
|
||||
|
Loading…
Reference in New Issue
Block a user