sahara-scenario: improve the python3 compatibility
Few fixes in less-used code paths. Change-Id: I91932b12ae7b00420cb9db56d1358dd6a34d2e48
This commit is contained in:
parent
23af1543a2
commit
139df1c07f
|
@ -301,7 +301,7 @@ class BaseTestCase(base.BaseTestCase):
|
|||
for param, value in six.iteritems(job['configs']):
|
||||
configs['configs'][param] = str(value)
|
||||
if job.get('args'):
|
||||
configs['args'] = map(str, job['args'])
|
||||
configs['args'] = list(map(str, job['args']))
|
||||
return configs
|
||||
|
||||
def _run_job(self, job_id, input_id, output_id, configs):
|
||||
|
@ -557,7 +557,7 @@ class BaseTestCase(base.BaseTestCase):
|
|||
|
||||
@track_result("Set flavor")
|
||||
def _get_flavor_id(self, flavor):
|
||||
if isinstance(flavor, str):
|
||||
if isinstance(flavor, six.string_types):
|
||||
return self.nova.get_flavor_id(flavor)
|
||||
else:
|
||||
# if the name already exists, use it
|
||||
|
|
|
@ -26,6 +26,7 @@ from novaclient import exceptions as nova_exc
|
|||
from oslo_utils import uuidutils
|
||||
from saharaclient.api import base as saharaclient_base
|
||||
from saharaclient import client as sahara_client
|
||||
import six
|
||||
from swiftclient import client as swift_client
|
||||
from swiftclient import exceptions as swift_exc
|
||||
from tempest.lib import exceptions as exc
|
||||
|
@ -206,7 +207,8 @@ class NovaClient(Client):
|
|||
|
||||
def get_flavor_id(self, flavor_name):
|
||||
if (uuidutils.is_uuid_like(flavor_name) or
|
||||
(isinstance(flavor_name, str) and flavor_name.isdigit())):
|
||||
(isinstance(flavor_name, six.string_types) and
|
||||
flavor_name.isdigit())):
|
||||
return flavor_name
|
||||
for flavor in self.nova_client.flavors.list():
|
||||
if flavor.name == flavor_name:
|
||||
|
|
Loading…
Reference in New Issue