Use designate.utils.generate_uuid instead of str(uuid.uuid4)
This patch replaces str(uuid.uuid4) with designate.utils.generate_uuid Change-Id: I424a13f9d241930414bfb4c4508fc56de2df0dcc Closes-Bug: #1656765
This commit is contained in:
parent
d7bedee680
commit
423e539e1e
@ -15,11 +15,11 @@
|
||||
# under the License.
|
||||
import os
|
||||
import logging
|
||||
import uuid
|
||||
|
||||
from requests import auth
|
||||
import kerberos
|
||||
|
||||
from designate.utils import generate_uuid
|
||||
from designate.backend.impl_ipa import IPAAuthError
|
||||
from designate.i18n import _LW
|
||||
from designate.i18n import _LE
|
||||
@ -31,7 +31,7 @@ LOG = logging.getLogger(__name__)
|
||||
class IPAAuth(auth.AuthBase):
|
||||
def __init__(self, keytab, hostname):
|
||||
# store the kerberos credentials in memory rather than on disk
|
||||
os.environ['KRB5CCNAME'] = "MEMORY:" + str(uuid.uuid4())
|
||||
os.environ['KRB5CCNAME'] = "MEMORY:" + generate_uuid()
|
||||
self.token = None
|
||||
self.keytab = keytab
|
||||
self.hostname = hostname
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
import sys
|
||||
import logging
|
||||
import uuid
|
||||
import pprint
|
||||
import json
|
||||
import copy
|
||||
@ -264,7 +263,7 @@ def main():
|
||||
assert(zone)
|
||||
|
||||
# create a fake subdomain of this zone
|
||||
domname = "%s.%s" % (uuid.uuid4(), zone['idnsname'])
|
||||
domname = "%s.%s" % (utils.generate_uuid(), zone['idnsname'])
|
||||
args = copy.copy(zone)
|
||||
del args['idnsname']
|
||||
args['version'] = version
|
||||
|
@ -16,12 +16,13 @@
|
||||
# under the License.
|
||||
import os
|
||||
import sys
|
||||
import uuid
|
||||
|
||||
from designateclient import v1
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
|
||||
from designate.utils import generate_uuid
|
||||
|
||||
|
||||
cfg.CONF.register_cli_opts([
|
||||
cfg.StrOpt("domain_id", help="ID of domain to use."),
|
||||
@ -51,6 +52,6 @@ if __name__ == '__main__':
|
||||
msg = "Creating %s records", cfg.CONF.records
|
||||
LOG.info(msg)
|
||||
for i in range(0, cfg.CONF.records):
|
||||
name = '%s.%s' % (str(uuid.uuid4()), domain.name)
|
||||
name = '%s.%s' % (generate_uuid(), domain.name)
|
||||
record = {"name": name, "type": "A", "data": "10.0.0.1"}
|
||||
client.records.create(domain, record)
|
||||
|
@ -18,13 +18,13 @@
|
||||
|
||||
import math
|
||||
import time
|
||||
import uuid
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
import retrying
|
||||
import tooz.coordination
|
||||
|
||||
from designate.utils import generate_uuid
|
||||
from designate.i18n import _LI
|
||||
from designate.i18n import _LW
|
||||
from designate.i18n import _LE
|
||||
@ -64,7 +64,7 @@ class CoordinationMixin(object):
|
||||
self._coordinator = None
|
||||
|
||||
def start(self):
|
||||
self._coordination_id = ":".join([CONF.host, str(uuid.uuid4())])
|
||||
self._coordination_id = ":".join([CONF.host, generate_uuid()])
|
||||
|
||||
if CONF.coordination.backend_url is not None:
|
||||
backend_url = cfg.CONF.coordination.backend_url
|
||||
|
@ -13,17 +13,16 @@
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
import uuid
|
||||
|
||||
import six
|
||||
from oslo_log import log as logging
|
||||
|
||||
from designate.utils import generate_uuid
|
||||
from designate.network_api import base
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
POOL = dict([(str(uuid.uuid4()), '192.168.2.%s' % i) for i in
|
||||
POOL = dict([(generate_uuid(), '192.168.2.%s' % i) for i in
|
||||
range(0, 254)])
|
||||
ALLOCATIONS = {}
|
||||
|
||||
|
@ -13,9 +13,6 @@
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import uuid
|
||||
|
||||
from oslo_log import log
|
||||
import oslo_messaging as messaging
|
||||
from mock import call
|
||||
@ -24,6 +21,7 @@ from mock import patch
|
||||
|
||||
from designate import exceptions
|
||||
from designate import objects
|
||||
from designate.utils import generate_uuid
|
||||
from designate.backend import impl_fake
|
||||
from designate.central import rpcapi as central_rpcapi
|
||||
from designate.mdns import rpcapi as mdns_rpcapi
|
||||
@ -79,7 +77,7 @@ class PoolManagerServiceNoopTest(PoolManagerTestCase):
|
||||
def _build_zones(self, n, action, status):
|
||||
return [
|
||||
self._build_zone("zone%02X.example" % cnt, action,
|
||||
status, id=str(uuid.uuid4()))
|
||||
status, id=generate_uuid())
|
||||
for cnt in range(n)
|
||||
]
|
||||
|
||||
|
@ -13,7 +13,6 @@
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
import uuid
|
||||
import math
|
||||
|
||||
import mock
|
||||
@ -23,6 +22,7 @@ from oslo_log import log as logging
|
||||
|
||||
from designate import exceptions
|
||||
from designate import objects
|
||||
from designate.utils import generate_uuid
|
||||
from designate.storage.base import Storage as StorageBase
|
||||
from designate.utils import DEFAULT_MDNS_PORT
|
||||
|
||||
@ -154,7 +154,7 @@ class StorageTestCase(object):
|
||||
def test_paging_marker_not_found(self):
|
||||
with testtools.ExpectedException(exceptions.MarkerNotFound):
|
||||
self.storage.find_pool_attributes(
|
||||
self.admin_context, marker=str(uuid.uuid4()), limit=5)
|
||||
self.admin_context, marker=generate_uuid(), limit=5)
|
||||
|
||||
def test_paging_marker_invalid(self):
|
||||
with testtools.ExpectedException(exceptions.InvalidMarker):
|
||||
|
@ -17,8 +17,6 @@
|
||||
"""
|
||||
Unit test Backend
|
||||
"""
|
||||
import uuid
|
||||
|
||||
from designateclient import exceptions
|
||||
from mock import patch
|
||||
from mock import NonCallableMagicMock
|
||||
@ -28,6 +26,7 @@ import fixtures
|
||||
import oslotest.base
|
||||
import testtools
|
||||
|
||||
from designate.utils import generate_uuid
|
||||
from designate import objects
|
||||
from designate.backend import impl_designate
|
||||
|
||||
@ -35,7 +34,7 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def create_zone():
|
||||
id_ = str(uuid.uuid4())
|
||||
id_ = generate_uuid()
|
||||
return objects.Zone(
|
||||
id=id_,
|
||||
name='%s-example.com.' % id_,
|
||||
|
@ -18,7 +18,6 @@
|
||||
Unit test Producer tasks
|
||||
"""
|
||||
import datetime
|
||||
import uuid
|
||||
|
||||
from oslo_utils import timeutils
|
||||
from oslotest import base as test
|
||||
@ -26,6 +25,7 @@ import fixtures
|
||||
import mock
|
||||
import testtools
|
||||
|
||||
from designate.utils import generate_uuid
|
||||
from designate.central import rpcapi as central_api
|
||||
from designate import context
|
||||
from designate import rpc
|
||||
@ -87,7 +87,7 @@ class PeriodicTest(TaskTest):
|
||||
ctxt = mock.Mock()
|
||||
iterer = self.task._iter_zones(ctxt)
|
||||
|
||||
items = [RoObject(id=str(uuid.uuid4())) for i in range(0, 5)]
|
||||
items = [RoObject(id=generate_uuid()) for i in range(0, 5)]
|
||||
central.find_zones.return_value = items
|
||||
|
||||
# Iterate through the items causing the "paging" to be done.
|
||||
@ -156,7 +156,7 @@ class PeriodicExistsTest(TaskTest):
|
||||
|
||||
def test_emit_exists(self):
|
||||
zone = RoObject(
|
||||
id=str(uuid.uuid4()))
|
||||
id=generate_uuid())
|
||||
|
||||
with mock.patch.object(self.task, '_iter_zones') as iter_:
|
||||
iter_.return_value = [zone]
|
||||
@ -237,7 +237,7 @@ class PeriodicSecondaryRefreshTest(TaskTest):
|
||||
def test_refresh_zone(self):
|
||||
transferred = timeutils.utcnow(True) - datetime.timedelta(minutes=62)
|
||||
zone = RoObject(
|
||||
id=str(uuid.uuid4()),
|
||||
id=generate_uuid(),
|
||||
transferred_at=datetime.datetime.isoformat(transferred),
|
||||
refresh=3600)
|
||||
|
||||
@ -251,7 +251,7 @@ class PeriodicSecondaryRefreshTest(TaskTest):
|
||||
# Dummy zone object
|
||||
transferred = timeutils.utcnow(True) - datetime.timedelta(minutes=50)
|
||||
zone = RoObject(
|
||||
id=str(uuid.uuid4()),
|
||||
id=generate_uuid(),
|
||||
transferred_at=datetime.datetime.isoformat(transferred),
|
||||
refresh=3600)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user