Begin Python 3 compatability

* use six.iteritems()
* replace basestring with six.string_types
* convert print statements to functions (they're all debugging and should
  be removed eventually anyway)

* clean up OpenStack copyright: LLC -> Foundation

Change-Id: Icb14212bcb408e63816bfec3922a697bc1a6c946
This commit is contained in:
Dean Troyer 2013-07-03 18:12:58 -05:00
parent 65d2a14e3e
commit dfb0e3e3c1
27 changed files with 107 additions and 82 deletions

View File

@ -1,4 +1,4 @@
# Copyright 2013 OpenStack, LLC. # Copyright 2013 OpenStack Foundation
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain # not use this file except in compliance with the License. You may obtain
@ -16,6 +16,7 @@
"""Agent action implementations""" """Agent action implementations"""
import logging import logging
import six
from cliff import command from cliff import command
from cliff import lister from cliff import lister
@ -70,7 +71,7 @@ class CreateAgent(show.ShowOne):
parsed_args.hypervisor parsed_args.hypervisor
) )
agent = compute_client.agents.create(*args)._info.copy() agent = compute_client.agents.create(*args)._info.copy()
return zip(*sorted(agent.iteritems())) return zip(*sorted(six.iteritems(agent)))
class DeleteAgent(command.Command): class DeleteAgent(command.Command):
@ -160,4 +161,4 @@ class SetAgent(show.ShowOne):
parsed_args.md5hash parsed_args.md5hash
) )
agent = compute_client.agents.update(*args)._info.copy() agent = compute_client.agents.update(*args)._info.copy()
return zip(*sorted(agent.iteritems())) return zip(*sorted(six.iteritems(agent)))

View File

@ -13,9 +13,10 @@
# under the License. # under the License.
# #
"""Console action implementations""" """Compute v2 Console action implementations"""
import logging import logging
import six
import sys import sys
from cliff import command from cliff import command
@ -106,7 +107,6 @@ class ShowConsoleURL(show.ShowOne):
parsed_args.server, parsed_args.server,
) )
print "type: %s" % parsed_args.url_type
if parsed_args.url_type in ['novnc', 'xvpvnc']: if parsed_args.url_type in ['novnc', 'xvpvnc']:
data = server.get_vnc_console(parsed_args.url_type) data = server.get_vnc_console(parsed_args.url_type)
if parsed_args.url_type in ['spice']: if parsed_args.url_type in ['spice']:
@ -114,8 +114,7 @@ class ShowConsoleURL(show.ShowOne):
if not data: if not data:
return ({}, {}) return ({}, {})
print "data: %s" % data['console']
info = {} info = {}
info.update(data['console']) info.update(data['console'])
return zip(*sorted(info.iteritems())) return zip(*sorted(six.iteritems(info)))

View File

@ -1,4 +1,4 @@
# Copyright 2013 OpenStack, LLC. # Copyright 2013 OpenStack Foundation
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain # not use this file except in compliance with the License. You may obtain
@ -16,6 +16,7 @@
"""Flavor action implementations""" """Flavor action implementations"""
import logging import logging
import six
from cliff import command from cliff import command
from cliff import lister from cliff import lister
@ -110,7 +111,7 @@ class CreateFlavor(show.ShowOne):
flavor = compute_client.flavors.create(*args)._info.copy() flavor = compute_client.flavors.create(*args)._info.copy()
flavor.pop("links") flavor.pop("links")
return zip(*sorted(flavor.iteritems())) return zip(*sorted(six.iteritems(flavor)))
class DeleteFlavor(command.Command): class DeleteFlavor(command.Command):
@ -182,4 +183,4 @@ class ShowFlavor(show.ShowOne):
parsed_args.flavor)._info.copy() parsed_args.flavor)._info.copy()
flavor.pop("links") flavor.pop("links")
return zip(*sorted(flavor.iteritems())) return zip(*sorted(six.iteritems(flavor)))

View File

@ -16,6 +16,7 @@
"""Floating IP action implementations""" """Floating IP action implementations"""
import logging import logging
import six
from cliff import command from cliff import command
from cliff import lister from cliff import lister
@ -75,7 +76,7 @@ class CreateFloatingIP(show.ShowOne):
info = {} info = {}
info.update(floating_ip._info) info.update(floating_ip._info)
return zip(*sorted(info.iteritems())) return zip(*sorted(six.iteritems(info)))
class DeleteFloatingIP(command.Command): class DeleteFloatingIP(command.Command):

View File

@ -16,6 +16,7 @@
"""Hypervisor action implementations""" """Hypervisor action implementations"""
import logging import logging
import six
from cliff import lister from cliff import lister
from cliff import show from cliff import show
@ -79,4 +80,4 @@ class ShowHypervisor(show.ShowOne):
hypervisor["service_host"] = hypervisor["service"]["host"] hypervisor["service_host"] = hypervisor["service"]["host"]
del hypervisor["service"] del hypervisor["service"]
return zip(*sorted(hypervisor.iteritems())) return zip(*sorted(six.iteritems(hypervisor)))

View File

@ -17,6 +17,7 @@
import logging import logging
import os import os
import six
import sys import sys
from cliff import command from cliff import command
@ -71,7 +72,7 @@ class CreateKeypair(show.ShowOne):
if public_key: if public_key:
info.update(keypair._info) info.update(keypair._info)
del info['public_key'] del info['public_key']
return zip(*sorted(info.iteritems())) return zip(*sorted(six.iteritems(info)))
else: else:
sys.stdout.write(keypair.private_key) sys.stdout.write(keypair.private_key)
return ({}, {}) return ({}, {})
@ -148,7 +149,7 @@ class ShowKeypair(show.ShowOne):
info.update(keypair._info['keypair']) info.update(keypair._info['keypair'])
if not parsed_args.public_key: if not parsed_args.public_key:
del info['public_key'] del info['public_key']
return zip(*sorted(info.iteritems())) return zip(*sorted(six.iteritems(info)))
else: else:
# NOTE(dtroyer): a way to get the public key in a similar form # NOTE(dtroyer): a way to get the public key in a similar form
# as the private key in the create command # as the private key in the create command

View File

@ -293,7 +293,7 @@ class CreateServer(show.ShowOne):
# NOTE(vish): multiple copies of the same hint will # NOTE(vish): multiple copies of the same hint will
# result in a list of values # result in a list of values
if key in hints: if key in hints:
if isinstance(hints[key], basestring): if isinstance(hints[key], six.string_types):
hints[key] = [hints[key]] hints[key] = [hints[key]]
hints[key] += [value] hints[key] += [value]
else: else:
@ -343,7 +343,7 @@ class CreateServer(show.ShowOne):
raise SystemExit raise SystemExit
details = _prep_server_detail(compute_client, server) details = _prep_server_detail(compute_client, server)
return zip(*sorted(details.iteritems())) return zip(*sorted(six.iteritems(details)))
class DeleteServer(command.Command): class DeleteServer(command.Command):
@ -728,7 +728,7 @@ class RebuildServer(show.ShowOne):
raise SystemExit raise SystemExit
details = _prep_server_detail(compute_client, server) details = _prep_server_detail(compute_client, server)
return zip(*sorted(details.iteritems())) return zip(*sorted(six.iteritems(details)))
class RemoveServerVolume(command.Command): class RemoveServerVolume(command.Command):
@ -974,7 +974,7 @@ class ShowServer(show.ShowOne):
else: else:
data = _prep_server_detail(compute_client, server) data = _prep_server_detail(compute_client, server)
return zip(*sorted(data.iteritems())) return zip(*sorted(six.iteritems(data)))
class SuspendServer(command.Command): class SuspendServer(command.Command):

View File

@ -1,3 +1,4 @@
# Copyright 2012 OpenStack Foundation
# Copyright 2013 Nebula Inc. # Copyright 2013 Nebula Inc.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -13,9 +14,10 @@
# under the License. # under the License.
# #
"""EC2 Credentials action implementations""" """Identity v2 EC2 Credentials action implementations"""
import logging import logging
import six
from cliff import command from cliff import command
from cliff import lister from cliff import lister
@ -68,7 +70,7 @@ class CreateEC2Creds(show.ShowOne):
info = {} info = {}
info.update(creds._info) info.update(creds._info)
return zip(*sorted(info.iteritems())) return zip(*sorted(six.iteritems(info)))
class DeleteEC2Creds(command.Command): class DeleteEC2Creds(command.Command):
@ -178,4 +180,4 @@ class ShowEC2Creds(show.ShowOne):
info = {} info = {}
info.update(creds._info) info.update(creds._info)
return zip(*sorted(info.iteritems())) return zip(*sorted(six.iteritems(info)))

View File

@ -1,4 +1,4 @@
# Copyright 2012-2013 OpenStack, LLC. # Copyright 2012-2013 OpenStack Foundation
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain # not use this file except in compliance with the License. You may obtain
@ -16,6 +16,7 @@
"""Endpoint action implementations""" """Endpoint action implementations"""
import logging import logging
import six
from cliff import command from cliff import command
from cliff import lister from cliff import lister
@ -71,7 +72,7 @@ class CreateEndpoint(show.ShowOne):
info.update(endpoint._info) info.update(endpoint._info)
info['service_name'] = service.name info['service_name'] = service.name
info['service_type'] = service.type info['service_type'] = service.type
return zip(*sorted(info.iteritems())) return zip(*sorted(six.iteritems(info)))
class DeleteEndpoint(command.Command): class DeleteEndpoint(command.Command):
@ -183,7 +184,7 @@ class ShowEndpoint(show.ShowOne):
url = identity_client.service_catalog.url_for(**kwargs) url = identity_client.service_catalog.url_for(**kwargs)
info = {'%s.%s' % (parsed_args.service, parsed_args.type): url} info = {'%s.%s' % (parsed_args.service, parsed_args.type): url}
return zip(*sorted(info.iteritems())) return zip(*sorted(six.iteritems(info)))
else: else:
# The Identity 2.0 API doesn't support retrieving a single # The Identity 2.0 API doesn't support retrieving a single
# endpoint so we have to do this ourselves # endpoint so we have to do this ourselves
@ -211,4 +212,4 @@ class ShowEndpoint(show.ShowOne):
ep.service_id) ep.service_id)
info['service_name'] = service.name info['service_name'] = service.name
info['service_type'] = service.type info['service_type'] = service.type
return zip(*sorted(info.iteritems())) return zip(*sorted(six.iteritems(info)))

View File

@ -1,4 +1,4 @@
# Copyright 2012-2013 OpenStack, LLC. # Copyright 2012-2013 OpenStack Foundation
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain # not use this file except in compliance with the License. You may obtain
@ -16,6 +16,7 @@
"""Role action implementations""" """Role action implementations"""
import logging import logging
import six
from cliff import command from cliff import command
from cliff import lister from cliff import lister
@ -61,7 +62,7 @@ class AddRole(show.ShowOne):
info = {} info = {}
info.update(role._info) info.update(role._info)
return zip(*sorted(info.iteritems())) return zip(*sorted(six.iteritems(info)))
class CreateRole(show.ShowOne): class CreateRole(show.ShowOne):
@ -84,7 +85,7 @@ class CreateRole(show.ShowOne):
info = {} info = {}
info.update(role._info) info.update(role._info)
return zip(*sorted(info.iteritems())) return zip(*sorted(six.iteritems(info)))
class DeleteRole(command.Command): class DeleteRole(command.Command):
@ -229,4 +230,4 @@ class ShowRole(show.ShowOne):
info = {} info = {}
info.update(role._info) info.update(role._info)
return zip(*sorted(info.iteritems())) return zip(*sorted(six.iteritems(info)))

View File

@ -16,6 +16,7 @@
"""Service action implementations""" """Service action implementations"""
import logging import logging
import six
from cliff import command from cliff import command
from cliff import lister from cliff import lister
@ -58,7 +59,7 @@ class CreateService(show.ShowOne):
info = {} info = {}
info.update(service._info) info.update(service._info)
return zip(*sorted(info.iteritems())) return zip(*sorted(six.iteritems(info)))
class DeleteService(command.Command): class DeleteService(command.Command):
@ -136,11 +137,11 @@ class ShowService(show.ShowOne):
if parsed_args.catalog: if parsed_args.catalog:
endpoints = identity_client.service_catalog.get_endpoints( endpoints = identity_client.service_catalog.get_endpoints(
service_type=parsed_args.service) service_type=parsed_args.service)
for (service, service_endpoints) in endpoints.iteritems(): for (service, service_endpoints) in six.iteritems(endpoints):
if service_endpoints: if service_endpoints:
info = {"type": service} info = {"type": service}
info.update(service_endpoints[0]) info.update(service_endpoints[0])
return zip(*sorted(info.iteritems())) return zip(*sorted(six.iteritems(info)))
msg = ("No service catalog with a type, name or ID of '%s' " msg = ("No service catalog with a type, name or ID of '%s' "
"exists." % (parsed_args.service)) "exists." % (parsed_args.service))
@ -166,4 +167,4 @@ class ShowService(show.ShowOne):
info = {} info = {}
info.update(service._info) info.update(service._info)
return zip(*sorted(info.iteritems())) return zip(*sorted(six.iteritems(info)))

View File

@ -1,4 +1,4 @@
# Copyright 2012-2013 OpenStack, LLC. # Copyright 2012-2013 OpenStack Foundation
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain # not use this file except in compliance with the License. You may obtain
@ -16,6 +16,7 @@
"""Tenant action implementations""" """Tenant action implementations"""
import logging import logging
import six
import sys import sys
from cliff import command from cliff import command
@ -64,7 +65,7 @@ class CreateTenant(show.ShowOne):
info = {} info = {}
info.update(tenant._info) info.update(tenant._info)
return zip(*sorted(info.iteritems())) return zip(*sorted(six.iteritems(info)))
class DeleteTenant(command.Command): class DeleteTenant(command.Command):
@ -191,4 +192,4 @@ class ShowTenant(show.ShowOne):
info = {} info = {}
info.update(tenant._info) info.update(tenant._info)
return zip(*sorted(info.iteritems())) return zip(*sorted(six.iteritems(info)))

View File

@ -1,4 +1,4 @@
# Copyright 2012-2013 OpenStack, LLC. # Copyright 2012-2013 OpenStack Foundation
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain # not use this file except in compliance with the License. You may obtain
@ -16,6 +16,7 @@
"""Identity v2.0 User action implementations""" """Identity v2.0 User action implementations"""
import logging import logging
import six
import sys import sys
from cliff import command from cliff import command
@ -79,7 +80,7 @@ class CreateUser(show.ShowOne):
info = {} info = {}
info.update(user._info) info.update(user._info)
return zip(*sorted(info.iteritems())) return zip(*sorted(six.iteritems(info)))
class DeleteUser(command.Command): class DeleteUser(command.Command):
@ -219,4 +220,4 @@ class ShowUser(show.ShowOne):
info = {} info = {}
info.update(user._info) info.update(user._info)
return zip(*sorted(info.iteritems())) return zip(*sorted(six.iteritems(info)))

View File

@ -1,4 +1,4 @@
# Copyright 2012-2013 OpenStack, LLC. # Copyright 2012-2013 OpenStack Foundation
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain # not use this file except in compliance with the License. You may obtain
@ -16,6 +16,7 @@
"""Identity v3 Credential action implementations""" """Identity v3 Credential action implementations"""
import logging import logging
import six
import sys import sys
from cliff import command from cliff import command
@ -72,7 +73,7 @@ class CreateCredential(show.ShowOne):
parsed_args.data, parsed_args.data,
project=project) project=project)
return zip(*sorted(credential._info.iteritems())) return zip(*sorted(six.iteritems(credential._info)))
class DeleteCredential(command.Command): class DeleteCredential(command.Command):
@ -191,4 +192,4 @@ class ShowCredential(show.ShowOne):
credential = utils.find_resource(identity_client.credentials, credential = utils.find_resource(identity_client.credentials,
parsed_args.credential) parsed_args.credential)
return zip(*sorted(credential._info.iteritems())) return zip(*sorted(six.iteritems(credential._info)))

View File

@ -1,4 +1,4 @@
# Copyright 2012-2013 OpenStack, LLC. # Copyright 2012-2013 OpenStack Foundation
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain # not use this file except in compliance with the License. You may obtain
@ -16,6 +16,7 @@
"""Identity v3 Domain action implementations""" """Identity v3 Domain action implementations"""
import logging import logging
import six
import sys import sys
from cliff import command from cliff import command
@ -65,7 +66,7 @@ class CreateDomain(show.ShowOne):
enabled=parsed_args.enabled, enabled=parsed_args.enabled,
) )
return zip(*sorted(domain._info.iteritems())) return zip(*sorted(six.iteritems(domain._info)))
class DeleteDomain(command.Command): class DeleteDomain(command.Command):
@ -185,4 +186,4 @@ class ShowDomain(show.ShowOne):
domain = utils.find_resource(identity_client.domains, domain = utils.find_resource(identity_client.domains,
parsed_args.domain) parsed_args.domain)
return zip(*sorted(domain._info.iteritems())) return zip(*sorted(six.iteritems(domain._info)))

View File

@ -1,4 +1,4 @@
# Copyright 2012-2013 OpenStack, LLC. # Copyright 2012-2013 OpenStack Foundation
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain # not use this file except in compliance with the License. You may obtain
@ -16,6 +16,7 @@
"""Identity v3 Endpoint action implementations""" """Identity v3 Endpoint action implementations"""
import logging import logging
import six
import sys import sys
from cliff import command from cliff import command
@ -83,7 +84,7 @@ class CreateEndpoint(show.ShowOne):
info.update(endpoint._info) info.update(endpoint._info)
info['service_name'] = service.name info['service_name'] = service.name
info['service_type'] = service.type info['service_type'] = service.type
return zip(*sorted(info.iteritems())) return zip(*sorted(six.iteritems(info)))
class DeleteEndpoint(command.Command): class DeleteEndpoint(command.Command):
@ -239,4 +240,4 @@ class ShowEndpoint(show.ShowOne):
info.update(endpoint._info) info.update(endpoint._info)
info['service_name'] = service.name info['service_name'] = service.name
info['service_type'] = service.type info['service_type'] = service.type
return zip(*sorted(info.iteritems())) return zip(*sorted(six.iteritems(info)))

View File

@ -1,4 +1,4 @@
# Copyright 2012-2013 OpenStack, LLC. # Copyright 2012-2013 OpenStack Foundation
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain # not use this file except in compliance with the License. You may obtain
@ -16,6 +16,7 @@
"""Group action implementations""" """Group action implementations"""
import logging import logging
import six
import sys import sys
from cliff import command from cliff import command
@ -138,7 +139,7 @@ class CreateGroup(show.ShowOne):
info = {} info = {}
info.update(group._info) info.update(group._info)
return zip(*sorted(info.iteritems())) return zip(*sorted(six.iteritems(info)))
class DeleteGroup(command.Command): class DeleteGroup(command.Command):
@ -375,4 +376,4 @@ class ShowGroup(show.ShowOne):
info = {} info = {}
info.update(group._info) info.update(group._info)
return zip(*sorted(info.iteritems())) return zip(*sorted(six.iteritems(info)))

View File

@ -1,4 +1,4 @@
# Copyright 2012-2013 OpenStack, LLC. # Copyright 2012-2013 OpenStack Foundation
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain # not use this file except in compliance with the License. You may obtain
@ -16,6 +16,7 @@
"""Identity v3 OAuth action implementations""" """Identity v3 OAuth action implementations"""
import logging import logging
import six
import sys import sys
from cliff import command from cliff import command
@ -65,7 +66,7 @@ class AuthenticateAccessToken(show.ShowOne):
keystone_token = oauth_client.authenticate( keystone_token = oauth_client.authenticate(
parsed_args.consumer_key, parsed_args.consumer_secret, parsed_args.consumer_key, parsed_args.consumer_secret,
parsed_args.access_key, parsed_args.access_secret) parsed_args.access_key, parsed_args.access_secret)
return zip(*sorted(keystone_token.iteritems())) return zip(*sorted(six.iteritems(keystone_token)))
class AuthorizeRequestToken(show.ShowOne): class AuthorizeRequestToken(show.ShowOne):
@ -97,7 +98,7 @@ class AuthorizeRequestToken(show.ShowOne):
parsed_args.request_key, parsed_args.roles) parsed_args.request_key, parsed_args.roles)
info = {} info = {}
info.update(verifier_pin._info) info.update(verifier_pin._info)
return zip(*sorted(info.iteritems())) return zip(*sorted(six.iteritems(info)))
class CreateAccessToken(show.ShowOne): class CreateAccessToken(show.ShowOne):
@ -146,7 +147,7 @@ class CreateAccessToken(show.ShowOne):
parsed_args.consumer_key, parsed_args.consumer_secret, parsed_args.consumer_key, parsed_args.consumer_secret,
parsed_args.request_key, parsed_args.request_secret, parsed_args.request_key, parsed_args.request_secret,
parsed_args.verifier) parsed_args.verifier)
return zip(*sorted(access_token.iteritems())) return zip(*sorted(six.iteritems(access_token)))
class CreateConsumer(show.ShowOne): class CreateConsumer(show.ShowOne):
@ -171,7 +172,7 @@ class CreateConsumer(show.ShowOne):
) )
info = {} info = {}
info.update(consumer._info) info.update(consumer._info)
return zip(*sorted(info.iteritems())) return zip(*sorted(six.iteritems(info)))
class CreateRequestToken(show.ShowOne): class CreateRequestToken(show.ShowOne):
@ -207,7 +208,7 @@ class CreateRequestToken(show.ShowOne):
parsed_args.consumer_key, parsed_args.consumer_key,
parsed_args.consumer_secret, parsed_args.consumer_secret,
parsed_args.roles) parsed_args.roles)
return zip(*sorted(request_token.iteritems())) return zip(*sorted(six.iteritems(request_token)))
class DeleteConsumer(command.Command): class DeleteConsumer(command.Command):
@ -366,7 +367,7 @@ class ShowAuthorizationPin(show.ShowOne):
parsed_args.request_id) parsed_args.request_id)
info = {} info = {}
info.update(data._info) info.update(data._info)
return zip(*sorted(info.iteritems())) return zip(*sorted(six.iteritems(info)))
class ShowConsumer(show.ShowOne): class ShowConsumer(show.ShowOne):
@ -391,4 +392,4 @@ class ShowConsumer(show.ShowOne):
info = {} info = {}
info.update(consumer._info) info.update(consumer._info)
return zip(*sorted(info.iteritems())) return zip(*sorted(six.iteritems(info)))

View File

@ -1,4 +1,4 @@
# Copyright 2012-2013 OpenStack, LLC. # Copyright 2012-2013 OpenStack Foundation
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain # not use this file except in compliance with the License. You may obtain
@ -16,6 +16,7 @@
"""Identity v3 Policy action implementations""" """Identity v3 Policy action implementations"""
import logging import logging
import six
import sys import sys
from cliff import command from cliff import command
@ -54,7 +55,7 @@ class CreatePolicy(show.ShowOne):
blob, type=parsed_args.type blob, type=parsed_args.type
) )
return zip(*sorted(policy._info.iteritems())) return zip(*sorted(six.iteritems(policy._info)))
class DeletePolicy(command.Command): class DeletePolicy(command.Command):
@ -172,7 +173,7 @@ class ShowPolicy(show.ShowOne):
policy = utils.find_resource(identity_client.policies, policy = utils.find_resource(identity_client.policies,
parsed_args.policy) parsed_args.policy)
return zip(*sorted(policy._info.iteritems())) return zip(*sorted(six.iteritems(policy._info)))
def _read_blob_file_contents(blob_file): def _read_blob_file_contents(blob_file):

View File

@ -1,4 +1,4 @@
# Copyright 2012-2013 OpenStack, LLC. # Copyright 2012-2013 OpenStack Foundation
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain # not use this file except in compliance with the License. You may obtain
@ -16,6 +16,7 @@
"""Project action implementations""" """Project action implementations"""
import logging import logging
import six
import sys import sys
from cliff import command from cliff import command
@ -78,7 +79,7 @@ class CreateProject(show.ShowOne):
info = {} info = {}
info.update(project._info) info.update(project._info)
return zip(*sorted(info.iteritems())) return zip(*sorted(six.iteritems(info)))
class DeleteProject(command.Command): class DeleteProject(command.Command):
@ -213,4 +214,4 @@ class ShowProject(show.ShowOne):
info = {} info = {}
info.update(project._info) info.update(project._info)
return zip(*sorted(info.iteritems())) return zip(*sorted(six.iteritems(info)))

View File

@ -1,4 +1,4 @@
# Copyright 2012-2013 OpenStack, LLC. # Copyright 2012-2013 OpenStack Foundation
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain # not use this file except in compliance with the License. You may obtain
@ -16,6 +16,7 @@
"""Identity v3 Role action implementations""" """Identity v3 Role action implementations"""
import logging import logging
import six
import sys import sys
from cliff import command from cliff import command
@ -123,7 +124,7 @@ class CreateRole(show.ShowOne):
identity_client = self.app.client_manager.identity identity_client = self.app.client_manager.identity
role = identity_client.roles.create(parsed_args.name) role = identity_client.roles.create(parsed_args.name)
return zip(*sorted(role._info.iteritems())) return zip(*sorted(six.iteritems(role._info)))
class DeleteRole(command.Command): class DeleteRole(command.Command):
@ -296,4 +297,4 @@ class ShowRole(show.ShowOne):
role = utils.find_resource(identity_client.roles, role = utils.find_resource(identity_client.roles,
parsed_args.role) parsed_args.role)
return zip(*sorted(role._info.iteritems())) return zip(*sorted(six.iteritems(role._info)))

View File

@ -1,4 +1,4 @@
# Copyright 2012-2013 OpenStack, LLC. # Copyright 2012-2013 OpenStack Foundation
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain # not use this file except in compliance with the License. You may obtain
@ -16,6 +16,7 @@
"""Identity v3 Service action implementations""" """Identity v3 Service action implementations"""
import logging import logging
import six
import sys import sys
from cliff import command from cliff import command
@ -62,7 +63,7 @@ class CreateService(show.ShowOne):
parsed_args.type, parsed_args.type,
parsed_args.enabled) parsed_args.enabled)
return zip(*sorted(service._info.iteritems())) return zip(*sorted(six.iteritems(service._info)))
class DeleteService(command.Command): class DeleteService(command.Command):
@ -178,4 +179,4 @@ class ShowService(show.ShowOne):
service = utils.find_resource(identity_client.services, service = utils.find_resource(identity_client.services,
parsed_args.service) parsed_args.service)
return zip(*sorted(service._info.iteritems())) return zip(*sorted(six.iteritems(service._info)))

View File

@ -1,4 +1,4 @@
# Copyright 2012-2013 OpenStack, LLC. # Copyright 2012-2013 OpenStack Foundation
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain # not use this file except in compliance with the License. You may obtain
@ -16,6 +16,7 @@
"""Identity v3 User action implementations""" """Identity v3 User action implementations"""
import logging import logging
import six
import sys import sys
from cliff import command from cliff import command
@ -106,7 +107,7 @@ class CreateUser(show.ShowOne):
info = {} info = {}
info.update(user._info) info.update(user._info)
return zip(*sorted(info.iteritems())) return zip(*sorted(six.iteritems(info)))
class DeleteUser(command.Command): class DeleteUser(command.Command):
@ -355,4 +356,4 @@ class ShowUser(show.ShowOne):
info = {} info = {}
info.update(user._info) info.update(user._info)
return zip(*sorted(info.iteritems())) return zip(*sorted(six.iteritems(info)))

View File

@ -1,4 +1,4 @@
# Copyright 2012-2013 OpenStack, LLC. # Copyright 2012-2013 OpenStack Foundation
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may # Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain # not use this file except in compliance with the License. You may obtain
@ -16,6 +16,7 @@
"""Volume v1 Backup action implementations""" """Volume v1 Backup action implementations"""
import logging import logging
import six
from cliff import command from cliff import command
from cliff import lister from cliff import lister
@ -68,7 +69,7 @@ class CreateBackup(show.ShowOne):
) )
backup._info.pop('links') backup._info.pop('links')
return zip(*sorted(backup._info.iteritems())) return zip(*sorted(six.iteritems(backup._info)))
class DeleteBackup(command.Command): class DeleteBackup(command.Command):
@ -163,4 +164,4 @@ class ShowBackup(show.ShowOne):
backup = utils.find_resource(volume_client.backups, backup = utils.find_resource(volume_client.backups,
parsed_args.backup) parsed_args.backup)
backup._info.pop('links') backup._info.pop('links')
return zip(*sorted(backup._info.iteritems())) return zip(*sorted(six.iteritems(backup._info)))

View File

@ -16,6 +16,7 @@
"""Volume v1 Snapshot action implementations""" """Volume v1 Snapshot action implementations"""
import logging import logging
import six
import sys import sys
from cliff import command from cliff import command
@ -69,7 +70,7 @@ class CreateSnapshot(show.ShowOne):
parsed_args.description parsed_args.description
) )
return zip(*sorted(snapshot._info.iteritems())) return zip(*sorted(six.iteritems(snapshot._info)))
class DeleteSnapshot(command.Command): class DeleteSnapshot(command.Command):
@ -175,4 +176,4 @@ class ShowSnapshot(show.ShowOne):
snapshot = utils.find_resource(volume_client.volume_snapshots, snapshot = utils.find_resource(volume_client.volume_snapshots,
parsed_args.snapshot) parsed_args.snapshot)
return zip(*sorted(snapshot._info.iteritems())) return zip(*sorted(six.iteritems(snapshot._info)))

View File

@ -16,6 +16,7 @@
"""Volume v1 Type action implementations""" """Volume v1 Type action implementations"""
import logging import logging
import six
from cliff import command from cliff import command
from cliff import lister from cliff import lister
@ -62,7 +63,7 @@ class CreateVolumeType(show.ShowOne):
info = {} info = {}
info.update(volume_type._info) info.update(volume_type._info)
return zip(*sorted(info.iteritems())) return zip(*sorted(six.iteritems(info)))
class DeleteVolumeType(command.Command): class DeleteVolumeType(command.Command):

View File

@ -16,6 +16,7 @@
"""Volume v1 Volume action implementations""" """Volume v1 Volume action implementations"""
import logging import logging
import six
from cliff import command from cliff import command
from cliff import lister from cliff import lister
@ -124,7 +125,7 @@ class CreateVolume(show.ShowOne):
{'properties': utils.format_dict(volume._info.pop('metadata'))} {'properties': utils.format_dict(volume._info.pop('metadata'))}
) )
return zip(*sorted(volume._info.iteritems())) return zip(*sorted(six.iteritems(volume._info)))
class DeleteVolume(command.Command): class DeleteVolume(command.Command):
@ -322,7 +323,7 @@ class ShowVolume(show.ShowOne):
{'properties': utils.format_dict(volume._info.pop('metadata'))} {'properties': utils.format_dict(volume._info.pop('metadata'))}
) )
return zip(*sorted(volume._info.iteritems())) return zip(*sorted(six.iteritems(volume._info)))
class UnsetVolume(command.Command): class UnsetVolume(command.Command):