Commit 24818e8f authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

Rename utils.GetUUID to utils.NewUUID.

Reviewed-by: schreiberal
parent 8ee53a06
......@@ -133,7 +133,7 @@ class ConfigWriter:
existing.update(exceptions)
retries = 64
while retries > 0:
unique_id = utils.GetUUID()
unique_id = utils.NewUUID()
if unique_id not in existing and unique_id is not None:
break
else:
......
......@@ -847,7 +847,7 @@ def GetHomeDir(user, default=None):
return result.pw_dir
def GetUUID():
def NewUUID():
"""Returns a random UUID.
"""
......
......@@ -164,7 +164,7 @@ def TestClusterCopyfile():
"""gnt-cluster copyfile"""
master = qa_config.GetMasterNode()
uniqueid = utils.GetUUID()
uniqueid = utils.NewUUID()
# Create temporary file
f = tempfile.NamedTemporaryFile()
......@@ -188,8 +188,8 @@ def TestClusterCommand():
"""gnt-cluster command"""
master = qa_config.GetMasterNode()
uniqueid = utils.GetUUID()
rfile = "/tmp/gnt%s" % utils.GetUUID()
uniqueid = utils.NewUUID()
rfile = "/tmp/gnt%s" % utils.NewUUID()
rcmd = utils.ShellQuoteArgs(['echo', '-n', uniqueid])
cmd = utils.ShellQuoteArgs(['gnt-cluster', 'command',
"%s >%s" % (rcmd, rfile)])
......
......@@ -541,14 +541,14 @@ class TestListVisibleFiles(unittest.TestCase):
self._test(files, expected)
class TestGetUUID(unittest.TestCase):
"""Test case for GetUUID"""
class TestNewUUID(unittest.TestCase):
"""Test case for NewUUID"""
_re_uuid = re.compile('^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-'
'[a-f0-9]{4}-[a-f0-9]{12}$')
def runTest(self):
self.failUnless(self._re_uuid.match(utils.GetUUID()))
self.failUnless(self._re_uuid.match(utils.NewUUID()))
if __name__ == '__main__':
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment