Replaces uuid.uuid4 with uuidutils.generate_uuid()
Change-Id: I27f8babfc8a995f3433cc1f94526b87bd70a4757
This commit is contained in:
parent
514aeb9e6d
commit
979233cfb1
|
@ -28,7 +28,6 @@ from eventlet.green import socket
|
||||||
import hashlib
|
import hashlib
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import uuid
|
|
||||||
|
|
||||||
from OpenSSL import crypto
|
from OpenSSL import crypto
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
|
@ -36,6 +35,7 @@ from oslo_log import log as logging
|
||||||
from oslo_utils import encodeutils
|
from oslo_utils import encodeutils
|
||||||
from oslo_utils import excutils
|
from oslo_utils import excutils
|
||||||
from oslo_utils import timeutils
|
from oslo_utils import timeutils
|
||||||
|
from oslo_utils import uuidutils
|
||||||
from oslo_versionedobjects import fields
|
from oslo_versionedobjects import fields
|
||||||
import six
|
import six
|
||||||
|
|
||||||
|
@ -236,7 +236,7 @@ def validate_key_cert(key_file, cert_file):
|
||||||
'ce': ce})
|
'ce': ce})
|
||||||
|
|
||||||
try:
|
try:
|
||||||
data = str(uuid.uuid4())
|
data = uuidutils.generate_uuid()
|
||||||
# On Python 3, explicitly encode to UTF-8 to call crypto.sign() which
|
# On Python 3, explicitly encode to UTF-8 to call crypto.sign() which
|
||||||
# requires bytes. Otherwise, it raises a deprecation warning (and
|
# requires bytes. Otherwise, it raises a deprecation warning (and
|
||||||
# will raise an error later).
|
# will raise an error later).
|
||||||
|
|
|
@ -12,10 +12,10 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import uuid
|
|
||||||
|
|
||||||
from oslo_db.sqlalchemy import models
|
from oslo_db.sqlalchemy import models
|
||||||
from oslo_utils import timeutils
|
from oslo_utils import timeutils
|
||||||
|
from oslo_utils import uuidutils
|
||||||
from sqlalchemy import BigInteger
|
from sqlalchemy import BigInteger
|
||||||
from sqlalchemy import Boolean
|
from sqlalchemy import Boolean
|
||||||
from sqlalchemy import Column
|
from sqlalchemy import Column
|
||||||
|
@ -103,7 +103,7 @@ class Artifact(BASE, ArtifactBase):
|
||||||
__protected_attributes__ = set(["created_at", "updated_at"])
|
__protected_attributes__ = set(["created_at", "updated_at"])
|
||||||
|
|
||||||
id = Column(String(36), primary_key=True,
|
id = Column(String(36), primary_key=True,
|
||||||
default=lambda: str(uuid.uuid4()))
|
default=lambda: uuidutils.generate_uuid())
|
||||||
name = Column(String(255), nullable=False)
|
name = Column(String(255), nullable=False)
|
||||||
type_name = Column(String(255), nullable=False)
|
type_name = Column(String(255), nullable=False)
|
||||||
version_prefix = Column(BigInteger().with_variant(Integer, "sqlite"),
|
version_prefix = Column(BigInteger().with_variant(Integer, "sqlite"),
|
||||||
|
@ -182,7 +182,7 @@ class ArtifactTag(BASE, ArtifactBase):
|
||||||
{'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'},)
|
{'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'},)
|
||||||
|
|
||||||
id = Column(String(36), primary_key=True, nullable=False,
|
id = Column(String(36), primary_key=True, nullable=False,
|
||||||
default=lambda: str(uuid.uuid4()))
|
default=lambda: uuidutils.generate_uuid())
|
||||||
artifact_id = Column(String(36), ForeignKey('glare_artifacts.id'),
|
artifact_id = Column(String(36), ForeignKey('glare_artifacts.id'),
|
||||||
nullable=False)
|
nullable=False)
|
||||||
artifact = relationship(Artifact,
|
artifact = relationship(Artifact,
|
||||||
|
@ -198,7 +198,7 @@ class ArtifactProperty(BASE, ArtifactBase):
|
||||||
Index('ix_glare_artifact_properties_name', 'name'),
|
Index('ix_glare_artifact_properties_name', 'name'),
|
||||||
{'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'},)
|
{'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'},)
|
||||||
id = Column(String(36), primary_key=True, nullable=False,
|
id = Column(String(36), primary_key=True, nullable=False,
|
||||||
default=lambda: str(uuid.uuid4()))
|
default=lambda: uuidutils.generate_uuid())
|
||||||
artifact_id = Column(String(36), ForeignKey('glare_artifacts.id'),
|
artifact_id = Column(String(36), ForeignKey('glare_artifacts.id'),
|
||||||
nullable=False)
|
nullable=False)
|
||||||
artifact = relationship(Artifact,
|
artifact = relationship(Artifact,
|
||||||
|
@ -220,7 +220,7 @@ class ArtifactBlob(BASE, ArtifactBase):
|
||||||
Index('ix_glare_artifact_blobs_name', 'name'),
|
Index('ix_glare_artifact_blobs_name', 'name'),
|
||||||
{'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'},)
|
{'mysql_engine': 'InnoDB', 'mysql_charset': 'utf8'},)
|
||||||
id = Column(String(36), primary_key=True, nullable=False,
|
id = Column(String(36), primary_key=True, nullable=False,
|
||||||
default=lambda: str(uuid.uuid4()))
|
default=lambda: uuidutils.generate_uuid())
|
||||||
artifact_id = Column(String(36), ForeignKey('glare_artifacts.id'),
|
artifact_id = Column(String(36), ForeignKey('glare_artifacts.id'),
|
||||||
nullable=False)
|
nullable=False)
|
||||||
name = Column(String(255), nullable=False)
|
name = Column(String(255), nullable=False)
|
||||||
|
|
|
@ -14,11 +14,11 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
import uuid
|
|
||||||
|
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_utils import timeutils
|
from oslo_utils import timeutils
|
||||||
|
from oslo_utils import uuidutils
|
||||||
from oslo_versionedobjects import base
|
from oslo_versionedobjects import base
|
||||||
from oslo_versionedobjects import fields
|
from oslo_versionedobjects import fields
|
||||||
import six
|
import six
|
||||||
|
@ -260,7 +260,7 @@ class BaseArtifact(base.VersionedObject):
|
||||||
msg = _("visibility is not allowed in a request "
|
msg = _("visibility is not allowed in a request "
|
||||||
"for artifact create.")
|
"for artifact create.")
|
||||||
raise exception.BadRequest(msg)
|
raise exception.BadRequest(msg)
|
||||||
values['id'] = str(uuid.uuid4())
|
values['id'] = uuidutils.generate_uuid()
|
||||||
values['owner'] = context.tenant
|
values['owner'] = context.tenant
|
||||||
values['created_at'] = timeutils.utcnow()
|
values['created_at'] = timeutils.utcnow()
|
||||||
values['updated_at'] = values['created_at']
|
values['updated_at'] = values['created_at']
|
||||||
|
|
|
@ -12,10 +12,10 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import uuid
|
|
||||||
|
|
||||||
import jsonschema
|
import jsonschema
|
||||||
from jsonschema import exceptions as json_exceptions
|
from jsonschema import exceptions as json_exceptions
|
||||||
|
from oslo_utils import uuidutils
|
||||||
from oslo_versionedobjects import fields
|
from oslo_versionedobjects import fields
|
||||||
import semantic_version
|
import semantic_version
|
||||||
import six
|
import six
|
||||||
|
@ -81,7 +81,7 @@ class BlobFieldType(fields.FieldType):
|
||||||
if not isinstance(value, dict):
|
if not isinstance(value, dict):
|
||||||
raise ValueError(_("Blob value must be dict. Got %s type instead")
|
raise ValueError(_("Blob value must be dict. Got %s type instead")
|
||||||
% type(value))
|
% type(value))
|
||||||
value.setdefault('id', str(uuid.uuid4()))
|
value.setdefault('id', uuidutils.generate_uuid())
|
||||||
try:
|
try:
|
||||||
jsonschema.validate(value, BlobFieldType.BLOB_SCHEMA)
|
jsonschema.validate(value, BlobFieldType.BLOB_SCHEMA)
|
||||||
except json_exceptions.ValidationError as e:
|
except json_exceptions.ValidationError as e:
|
||||||
|
|
|
@ -12,9 +12,9 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import uuid
|
|
||||||
|
|
||||||
from oslo_serialization import jsonutils
|
from oslo_serialization import jsonutils
|
||||||
|
from oslo_utils import uuidutils
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
from glare.tests import functional
|
from glare.tests import functional
|
||||||
|
@ -31,21 +31,21 @@ class TestArtifact(functional.FunctionalTest):
|
||||||
|
|
||||||
users = {
|
users = {
|
||||||
'user1': {
|
'user1': {
|
||||||
'id': str(uuid.uuid4()),
|
'id': uuidutils.generate_uuid(),
|
||||||
'tenant_id': str(uuid.uuid4()),
|
'tenant_id': uuidutils.generate_uuid(),
|
||||||
'token': str(uuid.uuid4()),
|
'token': uuidutils.generate_uuid(),
|
||||||
'role': 'member'
|
'role': 'member'
|
||||||
},
|
},
|
||||||
'user2': {
|
'user2': {
|
||||||
'id': str(uuid.uuid4()),
|
'id': uuidutils.generate_uuid(),
|
||||||
'tenant_id': str(uuid.uuid4()),
|
'tenant_id': uuidutils.generate_uuid(),
|
||||||
'token': str(uuid.uuid4()),
|
'token': uuidutils.generate_uuid(),
|
||||||
'role': 'member'
|
'role': 'member'
|
||||||
},
|
},
|
||||||
'admin': {
|
'admin': {
|
||||||
'id': str(uuid.uuid4()),
|
'id': uuidutils.generate_uuid(),
|
||||||
'tenant_id': str(uuid.uuid4()),
|
'tenant_id': uuidutils.generate_uuid(),
|
||||||
'token': str(uuid.uuid4()),
|
'token': uuidutils.generate_uuid(),
|
||||||
'role': 'admin'
|
'role': 'admin'
|
||||||
},
|
},
|
||||||
'anonymous': {
|
'anonymous': {
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import uuid
|
|
||||||
|
|
||||||
import fixtures
|
import fixtures
|
||||||
import glance_store as store
|
import glance_store as store
|
||||||
|
@ -22,6 +21,7 @@ import jsonpatch
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_config import fixture as cfg_fixture
|
from oslo_config import fixture as cfg_fixture
|
||||||
from oslo_policy import policy as os_policy
|
from oslo_policy import policy as os_policy
|
||||||
|
from oslo_utils import uuidutils
|
||||||
import testtools
|
import testtools
|
||||||
|
|
||||||
from glare.api.middleware import context
|
from glare.api.middleware import context
|
||||||
|
@ -41,21 +41,21 @@ class BaseTestCase(testtools.TestCase):
|
||||||
|
|
||||||
self.users = {
|
self.users = {
|
||||||
'user1': {
|
'user1': {
|
||||||
'id': str(uuid.uuid4()),
|
'id': uuidutils.generate_uuid(),
|
||||||
'tenant_id': str(uuid.uuid4()),
|
'tenant_id': uuidutils.generate_uuid(),
|
||||||
'token': str(uuid.uuid4()),
|
'token': uuidutils.generate_uuid(),
|
||||||
'roles': ['member']
|
'roles': ['member']
|
||||||
},
|
},
|
||||||
'user2': {
|
'user2': {
|
||||||
'id': str(uuid.uuid4()),
|
'id': uuidutils.generate_uuid(),
|
||||||
'tenant_id': str(uuid.uuid4()),
|
'tenant_id': uuidutils.generate_uuid(),
|
||||||
'token': str(uuid.uuid4()),
|
'token': uuidutils.generate_uuid(),
|
||||||
'roles': ['member']
|
'roles': ['member']
|
||||||
},
|
},
|
||||||
'admin': {
|
'admin': {
|
||||||
'id': str(uuid.uuid4()),
|
'id': uuidutils.generate_uuid(),
|
||||||
'tenant_id': str(uuid.uuid4()),
|
'tenant_id': uuidutils.generate_uuid(),
|
||||||
'token': str(uuid.uuid4()),
|
'token': uuidutils.generate_uuid(),
|
||||||
'roles': ['admin']
|
'roles': ['admin']
|
||||||
},
|
},
|
||||||
'anonymous': {
|
'anonymous': {
|
||||||
|
|
Loading…
Reference in New Issue