Merge "More Python 3 porting: filter and map, one import"

This commit is contained in:
Zuul 2018-06-29 21:47:49 +00:00 committed by Gerrit Code Review
commit d1107c9653
8 changed files with 14 additions and 9 deletions

View File

@ -1,7 +1,7 @@
- project:
check:
jobs:
- openstack-tox-py35:
- python-tempestconf-tox-py35:
voting: false
- python-tempestconf-tox-cover
- python-tempestconf-tempest-devstack-admin
@ -17,6 +17,11 @@
- python-tempestconf-tempest-packstack-demo
- tripleo-ci-centos-7-containers-multinode
- job:
name: python-tempestconf-tox-py35
parent: openstack-tox-py35
description: Temporary local job which runs unit tests with py35
- job:
name: python-tempestconf-tox-cover
parent: openstack-tox

View File

@ -91,7 +91,7 @@ class VersionedService(Service):
for version in body['versions']:
if version['status'] != "DEPRECATED":
versions.append(version)
return map(lambda x: x['id'], versions)
return list(map(lambda x: x['id'], versions))
def no_port_cut_url(self):
# if there is no port defined, cut the url from version to the end

View File

@ -25,7 +25,7 @@ class ComputeService(VersionedService):
def set_extensions(self):
body = self.do_get(self.service_url + '/extensions')
body = json.loads(body)
self.extensions = map(lambda x: x['alias'], body['extensions'])
self.extensions = list(map(lambda x: x['alias'], body['extensions']))
def set_versions(self):
url, top_level = self.no_port_cut_url()

View File

@ -40,7 +40,7 @@ class IdentityService(VersionedService):
body = self.do_get(self.service_url + '/extensions')
body = json.loads(body)
values = body['extensions']['values']
self.extensions = map(lambda x: x['alias'], values)
self.extensions = list(map(lambda x: x['alias'], values))
return
# Keystone api changed in v3, the concept of extensions changed. Right
# now, all the existing extensions are part of keystone core api, so,

View File

@ -124,8 +124,8 @@ class ImageService(VersionedService):
return self.client.show_image(image_id)
except exceptions.NotFound:
pass
found = filter(lambda x: x['name'] == image_name,
self.client.list_images()['images'])
found = [x for x in self.client.list_images()['images']
if x['name'] == image_name]
if found:
return found[0]
else:

View File

@ -23,7 +23,7 @@ class NetworkService(VersionedService):
def set_extensions(self):
body = self.do_get(self.service_url + '/v2.0/extensions.json')
body = json.loads(body)
self.extensions = map(lambda x: x['alias'], body['extensions'])
self.extensions = list(map(lambda x: x['alias'], body['extensions']))
def create_tempest_networks(self, has_neutron, conf, network_id):
LOG.info("Setting up network")

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from base import VersionedService
from config_tempest.services.base import VersionedService
class LoadBalancerService(VersionedService):

View File

@ -25,7 +25,7 @@ class VolumeService(VersionedService):
def set_extensions(self):
body = self.do_get(self.service_url + '/extensions')
body = json.loads(body)
self.extensions = map(lambda x: x['alias'], body['extensions'])
self.extensions = list(map(lambda x: x['alias'], body['extensions']))
def set_versions(self):
url, top_level = self.no_port_cut_url()