diff options
author | Jenkins <jenkins@review.openstack.org> | 2015-03-25 15:52:58 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2015-03-25 15:52:58 +0000 |
commit | c20857ca1ef9b61bbb814a961144b61e4f33c108 (patch) | |
tree | b6d3743cdc4f5149b4dc1bf7d8409792878c98b0 | |
parent | 4558df52848dc09a064bf30d36abf0deebf5f2ec (diff) | |
parent | 4a2cd4251140b8271ffe3bea3cec580c1882ec7e (diff) | |
download | tempest-lib-c20857ca1ef9b61bbb814a961144b61e4f33c108.tar.gz |
Merge "Add optional prefix parameter to rand_name function"
-rw-r--r-- | tempest_lib/common/utils/data_utils.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tempest_lib/common/utils/data_utils.py b/tempest_lib/common/utils/data_utils.py index eec2474..dc799fe 100644 --- a/tempest_lib/common/utils/data_utils.py +++ b/tempest_lib/common/utils/data_utils.py @@ -27,12 +27,14 @@ def rand_uuid_hex(): return uuid.uuid4().hex -def rand_name(name=''): +def rand_name(name='', prefix=None): randbits = str(random.randint(1, 0x7fffffff)) + rand_name = randbits if name: - return name + '-' + randbits - else: - return randbits + rand_name = name + '-' + rand_name + if prefix: + rand_name = prefix + '-' + rand_name + return rand_name def rand_url(): |