mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-12-22 13:34:07 +03:00
virtinst: util: Remove unused validate_uuid
We let libvirt error nowadays
This commit is contained in:
parent
87d19ebf36
commit
184b96a815
@ -60,26 +60,6 @@ def libvirt_collision(collision_cb, val):
|
||||
return check
|
||||
|
||||
|
||||
def validate_uuid(val):
|
||||
if not isinstance(val, str):
|
||||
raise ValueError(_("UUID must be a string."))
|
||||
|
||||
form = re.match("[a-fA-F0-9]{8}[-]([a-fA-F0-9]{4}[-]){3}[a-fA-F0-9]{12}$",
|
||||
val)
|
||||
if form is None:
|
||||
form = re.match("[a-fA-F0-9]{32}$", val)
|
||||
if form is None:
|
||||
raise ValueError(
|
||||
_("UUID must be a 32-digit hexadecimal number. It may take "
|
||||
"the form xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx or may "
|
||||
"omit hyphens altogether."))
|
||||
|
||||
else: # UUID had no dashes, so add them in
|
||||
val = (val[0:8] + "-" + val[8:12] + "-" + val[12:16] +
|
||||
"-" + val[16:20] + "-" + val[20:32])
|
||||
return val
|
||||
|
||||
|
||||
def validate_name(name_type, val):
|
||||
# Rather than try and match libvirt's regex, just forbid things we
|
||||
# know don't work
|
||||
|
Loading…
Reference in New Issue
Block a user