Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
snf-ganeti
Commits
24818e8f
Commit
24818e8f
authored
Nov 05, 2007
by
Michael Hanselmann
Browse files
Rename utils.GetUUID to utils.NewUUID.
Reviewed-by: schreiberal
parent
8ee53a06
Changes
4
Hide whitespace changes
Inline
Side-by-side
lib/config.py
View file @
24818e8f
...
...
@@ -133,7 +133,7 @@ class ConfigWriter:
existing
.
update
(
exceptions
)
retries
=
64
while
retries
>
0
:
unique_id
=
utils
.
Get
UUID
()
unique_id
=
utils
.
New
UUID
()
if
unique_id
not
in
existing
and
unique_id
is
not
None
:
break
else
:
...
...
lib/utils.py
View file @
24818e8f
...
...
@@ -847,7 +847,7 @@ def GetHomeDir(user, default=None):
return
result
.
pw_dir
def
Get
UUID
():
def
New
UUID
():
"""Returns a random UUID.
"""
...
...
qa/qa_cluster.py
View file @
24818e8f
...
...
@@ -164,7 +164,7 @@ def TestClusterCopyfile():
"""gnt-cluster copyfile"""
master
=
qa_config
.
GetMasterNode
()
uniqueid
=
utils
.
Get
UUID
()
uniqueid
=
utils
.
New
UUID
()
# Create temporary file
f
=
tempfile
.
NamedTemporaryFile
()
...
...
@@ -188,8 +188,8 @@ def TestClusterCommand():
"""gnt-cluster command"""
master
=
qa_config
.
GetMasterNode
()
uniqueid
=
utils
.
Get
UUID
()
rfile
=
"/tmp/gnt%s"
%
utils
.
Get
UUID
()
uniqueid
=
utils
.
New
UUID
()
rfile
=
"/tmp/gnt%s"
%
utils
.
New
UUID
()
rcmd
=
utils
.
ShellQuoteArgs
([
'echo'
,
'-n'
,
uniqueid
])
cmd
=
utils
.
ShellQuoteArgs
([
'gnt-cluster'
,
'command'
,
"%s >%s"
%
(
rcmd
,
rfile
)])
...
...
test/ganeti.utils_unittest.py
View file @
24818e8f
...
...
@@ -541,14 +541,14 @@ class TestListVisibleFiles(unittest.TestCase):
self
.
_test
(
files
,
expected
)
class
Test
Get
UUID
(
unittest
.
TestCase
):
"""Test case for
Get
UUID"""
class
Test
New
UUID
(
unittest
.
TestCase
):
"""Test case for
New
UUID"""
_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
.
Get
UUID
()))
self
.
failUnless
(
self
.
_re_uuid
.
match
(
utils
.
New
UUID
()))
if
__name__
==
'__main__'
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment