Skip to content

Commit

Permalink
Removed usages of uuidutils.generate_uuid()
Browse files Browse the repository at this point in the history
Fixes bug #1253497

Change-Id: I620798b36ffa52ba2404ecfb16378adf12d921cf
  • Loading branch information
Andrew Lazarev committed Nov 25, 2013
1 parent f6940e3 commit c61d052
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
5 changes: 3 additions & 2 deletions savanna/db/sqlalchemy/models.py
Expand Up @@ -13,19 +13,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import uuid

import six
import sqlalchemy as sa
from sqlalchemy.orm import relationship

from savanna.db.sqlalchemy import model_base as mb
from savanna.db.sqlalchemy import types as st
from savanna.openstack.common import uuidutils


## Helpers

def _generate_unicode_uuid():
return six.text_type(uuidutils.generate_uuid())
return six.text_type(uuid.uuid4())


def _id_column():
Expand Down
6 changes: 4 additions & 2 deletions savanna/plugins/vanilla/plugin.py
Expand Up @@ -13,12 +13,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import uuid

from oslo.config import cfg
import six

from savanna import conductor
from savanna import context
from savanna.openstack.common import log as logging
from savanna.openstack.common import uuidutils
from savanna.plugins.general import exceptions as ex
from savanna.plugins.general import utils
from savanna.plugins import provisioning as p
Expand Down Expand Up @@ -174,7 +176,7 @@ def _extract_configs_to_extra(self, cluster):
extra = dict()

if hive:
extra['hive_mysql_passwd'] = uuidutils.generate_uuid()
extra['hive_mysql_passwd'] = six.text_type(uuid.uuid4())

for ng in cluster.node_groups:
extra[ng.id] = {
Expand Down
5 changes: 3 additions & 2 deletions savanna/service/edp/job_manager.py
Expand Up @@ -14,13 +14,14 @@
# limitations under the License.

import datetime
import uuid

from oslo.config import cfg
import six

from savanna import conductor as c
from savanna import context
from savanna.openstack.common import log
from savanna.openstack.common import uuidutils
from savanna.plugins import base as plugin_base
from savanna.plugins.general import utils as u
from savanna.service.edp.binary_retrievers import dispatch
Expand Down Expand Up @@ -175,7 +176,7 @@ def upload_workflow_file(where, job_dir, wf_xml, hdfs_user):
def create_workflow_dir(where, job, hdfs_user):
constructed_dir = '/user/%s/' % hdfs_user
constructed_dir = _add_postfix(constructed_dir)
constructed_dir += '%s/%s' % (job.name, uuidutils.generate_uuid())
constructed_dir += '%s/%s' % (job.name, six.text_type(uuid.uuid4()))
with remote.get_remote(where) as r:
h.create_dir(r, constructed_dir, hdfs_user)

Expand Down
12 changes: 7 additions & 5 deletions savanna/tests/unit/utils/test_api_validator.py
Expand Up @@ -13,10 +13,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import uuid

import jsonschema
import six
import unittest2

from savanna.openstack.common import uuidutils
from savanna.utils import api_validator


Expand Down Expand Up @@ -149,10 +151,10 @@ def test_validate_uuid(self):
"format": "uuid",
}

uuid = uuidutils.generate_uuid()
id = six.text_type(uuid.uuid4())

self._validate_success(schema, uuid)
self._validate_failure(schema, uuid.replace("-", ""))
self._validate_success(schema, id)
self._validate_failure(schema, id.replace("-", ""))

def test_validate_hostname(self):
schema = {
Expand Down Expand Up @@ -235,7 +237,7 @@ def test_validate_flavor(self):
self._validate_success(schema, 1)
self._validate_success(schema, "0")
self._validate_success(schema, "1")
self._validate_success(schema, uuidutils.generate_uuid())
self._validate_success(schema, six.text_type(uuid.uuid4()))
self._validate_failure(schema, True)
self._validate_failure(schema, 0.1)
self._validate_failure(schema, "0.1")
Expand Down

0 comments on commit c61d052

Please sign in to comment.