Revision 59072e7e lib/config.py

b/lib/config.py
43 43
from ganeti import objects
44 44

  
45 45

  
46
def _my_uuidgen():
47
  """Poor-man's uuidgen using the uuidgen binary.
48

  
49
  """
50
  result = utils.RunCmd(["uuidgen", "-r"])
51
  if result.failed:
52
    return None
53
  return result.stdout.rstrip('\n')
54

  
55

  
56
try:
57
  import uuid
58
  _uuidgen = uuid.uuid4
59
except ImportError:
60
  _uuidgen = _my_uuidgen
61

  
62

  
63 46
class ConfigWriter:
64 47
  """The interface to the cluster configuration.
65 48

  
......
149 132
      existing.update(exceptions)
150 133
    retries = 64
151 134
    while retries > 0:
152
      unique_id = _uuidgen()
135
      unique_id = utils.GetUUID()
153 136
      if unique_id not in existing and unique_id is not None:
154 137
        break
155 138
    else:

Also available in: Unified diff