Skip to content

Commit 9ec1cf3

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Begin Python 3 compatability"
2 parents 978c2e7 + dfb0e3e commit 9ec1cf3

27 files changed

Lines changed: 107 additions & 82 deletions

‎openstackclient/compute/v2/agent.py‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2013 OpenStack, LLC.
1+
# Copyright 2013 OpenStack Foundation
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License"); you may
44
# not use this file except in compliance with the License. You may obtain
@@ -16,6 +16,7 @@
1616
"""Agent action implementations"""
1717

1818
import logging
19+
import six
1920

2021
from cliff import command
2122
from cliff import lister
@@ -70,7 +71,7 @@ def take_action(self, parsed_args):
7071
parsed_args.hypervisor
7172
)
7273
agent = compute_client.agents.create(*args)._info.copy()
73-
return zip(*sorted(agent.iteritems()))
74+
return zip(*sorted(six.iteritems(agent)))
7475

7576

7677
class DeleteAgent(command.Command):
@@ -160,4 +161,4 @@ def take_action(self, parsed_args):
160161
parsed_args.md5hash
161162
)
162163
agent = compute_client.agents.update(*args)._info.copy()
163-
return zip(*sorted(agent.iteritems()))
164+
return zip(*sorted(six.iteritems(agent)))

‎openstackclient/compute/v2/console.py‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313
# under the License.
1414
#
1515

16-
"""Console action implementations"""
16+
"""Compute v2 Console action implementations"""
1717

1818
import logging
19+
import six
1920
import sys
2021

2122
from cliff import command
@@ -106,16 +107,14 @@ def take_action(self, parsed_args):
106107
parsed_args.server,
107108
)
108109

109-
print "type: %s" % parsed_args.url_type
110110
if parsed_args.url_type in ['novnc', 'xvpvnc']:
111111
data = server.get_vnc_console(parsed_args.url_type)
112112
if parsed_args.url_type in ['spice']:
113113
data = server.get_spice_console(parsed_args.url_type)
114114

115115
if not data:
116116
return ({}, {})
117-
print "data: %s" % data['console']
118117

119118
info = {}
120119
info.update(data['console'])
121-
return zip(*sorted(info.iteritems()))
120+
return zip(*sorted(six.iteritems(info)))

‎openstackclient/compute/v2/flavor.py‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2013 OpenStack, LLC.
1+
# Copyright 2013 OpenStack Foundation
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License"); you may
44
# not use this file except in compliance with the License. You may obtain
@@ -16,6 +16,7 @@
1616
"""Flavor action implementations"""
1717

1818
import logging
19+
import six
1920

2021
from cliff import command
2122
from cliff import lister
@@ -110,7 +111,7 @@ def take_action(self, parsed_args):
110111
flavor = compute_client.flavors.create(*args)._info.copy()
111112
flavor.pop("links")
112113

113-
return zip(*sorted(flavor.iteritems()))
114+
return zip(*sorted(six.iteritems(flavor)))
114115

115116

116117
class DeleteFlavor(command.Command):
@@ -182,4 +183,4 @@ def take_action(self, parsed_args):
182183
parsed_args.flavor)._info.copy()
183184
flavor.pop("links")
184185

185-
return zip(*sorted(flavor.iteritems()))
186+
return zip(*sorted(six.iteritems(flavor)))

‎openstackclient/compute/v2/floatingip.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"""Floating IP action implementations"""
1717

1818
import logging
19+
import six
1920

2021
from cliff import command
2122
from cliff import lister
@@ -75,7 +76,7 @@ def take_action(self, parsed_args):
7576

7677
info = {}
7778
info.update(floating_ip._info)
78-
return zip(*sorted(info.iteritems()))
79+
return zip(*sorted(six.iteritems(info)))
7980

8081

8182
class DeleteFloatingIP(command.Command):

‎openstackclient/compute/v2/hypervisor.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"""Hypervisor action implementations"""
1717

1818
import logging
19+
import six
1920

2021
from cliff import lister
2122
from cliff import show
@@ -79,4 +80,4 @@ def take_action(self, parsed_args):
7980
hypervisor["service_host"] = hypervisor["service"]["host"]
8081
del hypervisor["service"]
8182

82-
return zip(*sorted(hypervisor.iteritems()))
83+
return zip(*sorted(six.iteritems(hypervisor)))

‎openstackclient/compute/v2/keypair.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import logging
1919
import os
20+
import six
2021
import sys
2122

2223
from cliff import command
@@ -71,7 +72,7 @@ def take_action(self, parsed_args):
7172
if public_key:
7273
info.update(keypair._info)
7374
del info['public_key']
74-
return zip(*sorted(info.iteritems()))
75+
return zip(*sorted(six.iteritems(info)))
7576
else:
7677
sys.stdout.write(keypair.private_key)
7778
return ({}, {})
@@ -148,7 +149,7 @@ def take_action(self, parsed_args):
148149
info.update(keypair._info['keypair'])
149150
if not parsed_args.public_key:
150151
del info['public_key']
151-
return zip(*sorted(info.iteritems()))
152+
return zip(*sorted(six.iteritems(info)))
152153
else:
153154
# NOTE(dtroyer): a way to get the public key in a similar form
154155
# as the private key in the create command

‎openstackclient/compute/v2/server.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ def take_action(self, parsed_args):
294294
# NOTE(vish): multiple copies of the same hint will
295295
# result in a list of values
296296
if key in hints:
297-
if isinstance(hints[key], basestring):
297+
if isinstance(hints[key], six.string_types):
298298
hints[key] = [hints[key]]
299299
hints[key] += [value]
300300
else:
@@ -344,7 +344,7 @@ def take_action(self, parsed_args):
344344
raise SystemExit
345345

346346
details = _prep_server_detail(compute_client, server)
347-
return zip(*sorted(details.iteritems()))
347+
return zip(*sorted(six.iteritems(details)))
348348

349349

350350
class DeleteServer(command.Command):
@@ -729,7 +729,7 @@ def take_action(self, parsed_args):
729729
raise SystemExit
730730

731731
details = _prep_server_detail(compute_client, server)
732-
return zip(*sorted(details.iteritems()))
732+
return zip(*sorted(six.iteritems(details)))
733733

734734

735735
class RemoveServerVolume(command.Command):
@@ -975,7 +975,7 @@ def take_action(self, parsed_args):
975975
else:
976976
data = _prep_server_detail(compute_client, server)
977977

978-
return zip(*sorted(data.iteritems()))
978+
return zip(*sorted(six.iteritems(data)))
979979

980980

981981
class SshServer(command.Command):

‎openstackclient/identity/v2_0/ec2creds.py‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Copyright 2012 OpenStack Foundation
12
# Copyright 2013 Nebula Inc.
23
#
34
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -13,9 +14,10 @@
1314
# under the License.
1415
#
1516

16-
"""EC2 Credentials action implementations"""
17+
"""Identity v2 EC2 Credentials action implementations"""
1718

1819
import logging
20+
import six
1921

2022
from cliff import command
2123
from cliff import lister
@@ -68,7 +70,7 @@ def take_action(self, parsed_args):
6870

6971
info = {}
7072
info.update(creds._info)
71-
return zip(*sorted(info.iteritems()))
73+
return zip(*sorted(six.iteritems(info)))
7274

7375

7476
class DeleteEC2Creds(command.Command):
@@ -178,4 +180,4 @@ def take_action(self, parsed_args):
178180

179181
info = {}
180182
info.update(creds._info)
181-
return zip(*sorted(info.iteritems()))
183+
return zip(*sorted(six.iteritems(info)))

‎openstackclient/identity/v2_0/endpoint.py‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2012-2013 OpenStack, LLC.
1+
# Copyright 2012-2013 OpenStack Foundation
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License"); you may
44
# not use this file except in compliance with the License. You may obtain
@@ -16,6 +16,7 @@
1616
"""Endpoint action implementations"""
1717

1818
import logging
19+
import six
1920

2021
from cliff import command
2122
from cliff import lister
@@ -71,7 +72,7 @@ def take_action(self, parsed_args):
7172
info.update(endpoint._info)
7273
info['service_name'] = service.name
7374
info['service_type'] = service.type
74-
return zip(*sorted(info.iteritems()))
75+
return zip(*sorted(six.iteritems(info)))
7576

7677

7778
class DeleteEndpoint(command.Command):
@@ -183,7 +184,7 @@ def take_action(self, parsed_args):
183184

184185
url = identity_client.service_catalog.url_for(**kwargs)
185186
info = {'%s.%s' % (parsed_args.service, parsed_args.type): url}
186-
return zip(*sorted(info.iteritems()))
187+
return zip(*sorted(six.iteritems(info)))
187188
else:
188189
# The Identity 2.0 API doesn't support retrieving a single
189190
# endpoint so we have to do this ourselves
@@ -211,4 +212,4 @@ def take_action(self, parsed_args):
211212
ep.service_id)
212213
info['service_name'] = service.name
213214
info['service_type'] = service.type
214-
return zip(*sorted(info.iteritems()))
215+
return zip(*sorted(six.iteritems(info)))

‎openstackclient/identity/v2_0/role.py‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2012-2013 OpenStack, LLC.
1+
# Copyright 2012-2013 OpenStack Foundation
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License"); you may
44
# not use this file except in compliance with the License. You may obtain
@@ -16,6 +16,7 @@
1616
"""Role action implementations"""
1717

1818
import logging
19+
import six
1920

2021
from cliff import command
2122
from cliff import lister
@@ -61,7 +62,7 @@ def take_action(self, parsed_args):
6162

6263
info = {}
6364
info.update(role._info)
64-
return zip(*sorted(info.iteritems()))
65+
return zip(*sorted(six.iteritems(info)))
6566

6667

6768
class CreateRole(show.ShowOne):
@@ -84,7 +85,7 @@ def take_action(self, parsed_args):
8485

8586
info = {}
8687
info.update(role._info)
87-
return zip(*sorted(info.iteritems()))
88+
return zip(*sorted(six.iteritems(info)))
8889

8990

9091
class DeleteRole(command.Command):
@@ -229,4 +230,4 @@ def take_action(self, parsed_args):
229230

230231
info = {}
231232
info.update(role._info)
232-
return zip(*sorted(info.iteritems()))
233+
return zip(*sorted(six.iteritems(info)))

0 commit comments

Comments
 (0)