[et-mgmt-tools] [PATCH] check a UUID format

S.Sakamoto fj0588di at aa.jp.fujitsu.com
Wed Apr 4 04:11:24 UTC 2007


Hi

When, for confirmation of a UUID check,
I install it by virt-intall by an invalid UUID,
(e.g."uuid=12345678-abcd-1234-cdef-1234567890abc"),
virt-install is carried out without an error being given.

So, here's the patch adds to check a UUID with the number of the characters:

Signed-off-by: Shigeki Sakamoto <fj0588di at aa.jp.fujitsu.com>


Thanks,
Shigeki Sakamoto.


==========================================================
diff -r a0cd4816ebfd virtinst/Guest.py
--- a/virtinst/Guest.py Mon Apr 02 16:10:04 2007 -0400
+++ b/virtinst/Guest.py Wed Apr 04 11:39:12 2007 +0900
@@ -417,9 +417,9 @@ class Guest(object):
         return self._uuid
     def set_uuid(self, val):
         # need better validation
-        form = re.match("[a-fA-F0-9]{8}[-]([a-fA-F0-9]{4}[-]){3}[a-fA-F0-9]{12}", val)
+        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)
+            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:




More information about the et-mgmt-tools mailing list