components/openstack/heat/patches/03-uuid-format.patch
changeset 2110 6983cfc62f1d
parent 2109 ed516b43cefc
child 2111 4988638320c4
equal deleted inserted replaced
2109:ed516b43cefc 2110:6983cfc62f1d
     1 In-house patch to force the conversion of UUIDs to UUID version 4.
       
     2 libuuid in Solaris does not set the version of UUID correctly (bug
       
     3 15391420).
       
     4 --- heat-2013.2.3/heat/common/short_id.py.orig	2014-06-26 11:03:04.050413825 -0600
       
     5 +++ heat-2013.2.3/heat/common/short_id.py	2014-06-26 11:04:48.397644826 -0600
       
     6 @@ -38,9 +38,10 @@
       
     7      The supplied UUID must be a version 4 UUID object.
       
     8      '''
       
     9      if isinstance(source_uuid, basestring):
       
    10 -        source_uuid = uuid.UUID(source_uuid)
       
    11 -    if source_uuid.version != 4:
       
    12 -        raise ValueError('Invalid UUID version (%d)' % source_uuid.version)
       
    13 +        try:
       
    14 +            source_uuid = uuid.UUID(source_uuid, version=4)
       
    15 +        except ValueError:
       
    16 +            raise ValueError('Invalid UUID: %s' % source_uuid)
       
    17  
       
    18      # The "time" field of a v4 UUID contains 60 random bits
       
    19      # (see RFC4122, Section 4.4)