Adds changes related to py3 compatibility
This patch replaces map() and zip() with six.moves.map() and six.moves.zip() respectively to provide py2/3 compatibility. Change-Id: I2e4b61c67ee34247f4c9e77f593df18d9dfd574b Partially-Implements: blueprint designate-py3
This commit is contained in:
parent
7d5c1ecff8
commit
fa5f6c4b56
designateclient
@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
"""
|
||||
import six
|
||||
from tempest_lib.cli import output_parser
|
||||
|
||||
|
||||
@ -51,7 +52,7 @@ class FieldValueModel(Model):
|
||||
class ListEntryModel(Model):
|
||||
|
||||
def __init__(self, fields, values):
|
||||
for k, v in zip(fields, values):
|
||||
for k, v in six.moves.zip(fields, values):
|
||||
setattr(self, k, v)
|
||||
|
||||
|
||||
|
@ -58,7 +58,7 @@ class ShowBlacklistCommand(show.ShowOne):
|
||||
client = self.app.client_manager.dns
|
||||
data = client.blacklists.get(parsed_args.id)
|
||||
_format_blacklist(data)
|
||||
return zip(*sorted(six.iteritems(data)))
|
||||
return six.moves.zip(*sorted(six.iteritems(data)))
|
||||
|
||||
|
||||
class CreateBlacklistCommand(show.ShowOne):
|
||||
@ -80,7 +80,7 @@ class CreateBlacklistCommand(show.ShowOne):
|
||||
parsed_args.pattern, parsed_args.description)
|
||||
|
||||
_format_blacklist(data)
|
||||
return zip(*sorted(six.iteritems(data)))
|
||||
return six.moves.zip(*sorted(six.iteritems(data)))
|
||||
|
||||
|
||||
class SetBlacklistCommand(show.ShowOne):
|
||||
@ -114,7 +114,7 @@ class SetBlacklistCommand(show.ShowOne):
|
||||
updated = client.blacklists.update(parsed_args.id, data)
|
||||
|
||||
_format_blacklist(updated)
|
||||
return zip(*sorted(six.iteritems(updated)))
|
||||
return six.moves.zip(*sorted(six.iteritems(updated)))
|
||||
|
||||
|
||||
class DeleteBlacklistCommand(command.Command):
|
||||
|
@ -50,7 +50,7 @@ class ListRecordSetsCommand(lister.Lister):
|
||||
cols = self.columns
|
||||
data = client.recordsets.list(parsed_args.zone_id)
|
||||
|
||||
map(_format_recordset, data)
|
||||
six.moves.map(_format_recordset, data)
|
||||
return cols, (utils.get_item_properties(s, cols) for s in data)
|
||||
|
||||
|
||||
@ -70,7 +70,7 @@ class ShowRecordSetCommand(show.ShowOne):
|
||||
data = client.recordsets.get(parsed_args.zone_id, parsed_args.id)
|
||||
|
||||
_format_recordset(data)
|
||||
return zip(*sorted(six.iteritems(data)))
|
||||
return six.moves.zip(*sorted(six.iteritems(data)))
|
||||
|
||||
|
||||
class CreateRecordSetCommand(show.ShowOne):
|
||||
@ -101,7 +101,7 @@ class CreateRecordSetCommand(show.ShowOne):
|
||||
ttl=parsed_args.ttl)
|
||||
|
||||
_format_recordset(data)
|
||||
return zip(*sorted(six.iteritems(data)))
|
||||
return six.moves.zip(*sorted(six.iteritems(data)))
|
||||
|
||||
|
||||
class SetRecordSetCommand(show.ShowOne):
|
||||
@ -149,7 +149,7 @@ class SetRecordSetCommand(show.ShowOne):
|
||||
|
||||
_format_recordset(updated)
|
||||
|
||||
return zip(*sorted(six.iteritems(updated)))
|
||||
return six.moves.zip(*sorted(six.iteritems(updated)))
|
||||
|
||||
|
||||
class DeleteRecordSetCommand(command.Command):
|
||||
|
@ -58,7 +58,7 @@ class ShowFloatingIPCommand(show.ShowOne):
|
||||
client = self.app.client_manager.dns
|
||||
data = client.floatingips.get(parsed_args.floatingip_id)
|
||||
_format_floatingip(data)
|
||||
return zip(*sorted(six.iteritems(data)))
|
||||
return six.moves.zip(*sorted(six.iteritems(data)))
|
||||
|
||||
|
||||
class SetFloatingIPCommand(show.ShowOne):
|
||||
@ -102,7 +102,7 @@ class SetFloatingIPCommand(show.ShowOne):
|
||||
parsed_args.ttl)
|
||||
|
||||
_format_floatingip(fip)
|
||||
return zip(*sorted(six.iteritems(fip)))
|
||||
return six.moves.zip(*sorted(six.iteritems(fip)))
|
||||
|
||||
|
||||
class UnsetFloatingIPCommand(command.Command):
|
||||
|
@ -59,7 +59,7 @@ class ShowTLDCommand(show.ShowOne):
|
||||
client = self.app.client_manager.dns
|
||||
data = client.tlds.get(parsed_args.id)
|
||||
_format_tld(data)
|
||||
return zip(*sorted(six.iteritems(data)))
|
||||
return six.moves.zip(*sorted(six.iteritems(data)))
|
||||
|
||||
|
||||
class CreateTLDCommand(show.ShowOne):
|
||||
@ -77,7 +77,7 @@ class CreateTLDCommand(show.ShowOne):
|
||||
client = self.app.client_manager.dns
|
||||
data = client.tlds.create(parsed_args.name, parsed_args.description)
|
||||
_format_tld(data)
|
||||
return zip(*sorted(six.iteritems(data)))
|
||||
return six.moves.zip(*sorted(six.iteritems(data)))
|
||||
|
||||
|
||||
class SetTLDCommand(show.ShowOne):
|
||||
@ -109,7 +109,7 @@ class SetTLDCommand(show.ShowOne):
|
||||
|
||||
data = client.tlds.update(parsed_args.id, data)
|
||||
_format_tld(data)
|
||||
return zip(*sorted(six.iteritems(data)))
|
||||
return six.moves.zip(*sorted(six.iteritems(data)))
|
||||
|
||||
|
||||
class DeleteTLDCommand(command.Command):
|
||||
|
@ -95,7 +95,7 @@ class ShowZoneCommand(show.ShowOne):
|
||||
data = client.zones.get(parsed_args.id)
|
||||
|
||||
_format_zone(data)
|
||||
return zip(*sorted(six.iteritems(data)))
|
||||
return six.moves.zip(*sorted(six.iteritems(data)))
|
||||
|
||||
|
||||
class CreateZoneCommand(show.ShowOne):
|
||||
@ -143,7 +143,7 @@ class CreateZoneCommand(show.ShowOne):
|
||||
parsed_args.name, parsed_args.type, **payload)
|
||||
|
||||
_format_zone(data)
|
||||
return zip(*sorted(six.iteritems(data)))
|
||||
return six.moves.zip(*sorted(six.iteritems(data)))
|
||||
|
||||
|
||||
class SetZoneCommand(show.ShowOne):
|
||||
@ -185,7 +185,7 @@ class SetZoneCommand(show.ShowOne):
|
||||
|
||||
updated = client.zones.update(parsed_args.id, data)
|
||||
_format_zone(updated)
|
||||
return zip(*sorted(six.iteritems(updated)))
|
||||
return six.moves.zip(*sorted(six.iteritems(updated)))
|
||||
|
||||
|
||||
class DeleteZoneCommand(command.Command):
|
||||
@ -293,7 +293,7 @@ class CreateTransferRequestCommand(show.ShowOne):
|
||||
data = client.zone_transfers.create_request(
|
||||
parsed_args.zone_id, parsed_args.target_project_id,
|
||||
parsed_args.description)
|
||||
return zip(*sorted(six.iteritems(data)))
|
||||
return six.moves.zip(*sorted(six.iteritems(data)))
|
||||
|
||||
|
||||
class ListTransferRequestsCommand(lister.Lister):
|
||||
@ -332,7 +332,7 @@ class ShowTransferRequestCommand(show.ShowOne):
|
||||
|
||||
data = client.zone_transfers.get_request(parsed_args.id)
|
||||
|
||||
return zip(*sorted(six.iteritems(data)))
|
||||
return six.moves.zip(*sorted(six.iteritems(data)))
|
||||
|
||||
|
||||
class SetTransferRequestCommand(command.Command):
|
||||
@ -359,7 +359,7 @@ class SetTransferRequestCommand(command.Command):
|
||||
data['description'] = parsed_args.description
|
||||
|
||||
updated = client.zone_transfers.update_request(parsed_args.id, data)
|
||||
return zip(*sorted(six.iteritems(updated)))
|
||||
return six.moves.zip(*sorted(six.iteritems(updated)))
|
||||
|
||||
|
||||
class DeleteTransferRequestCommand(command.Command):
|
||||
@ -398,7 +398,7 @@ class AcceptTransferRequestCommand(command.Command):
|
||||
|
||||
data = client.zone_transfers.accept_request(
|
||||
parsed_args.transfer_id, parsed_args.key)
|
||||
return zip(*sorted(six.iteritems(data)))
|
||||
return six.moves.zip(*sorted(six.iteritems(data)))
|
||||
|
||||
|
||||
class ShowTransferAcceptCommand(show.ShowOne):
|
||||
@ -416,4 +416,4 @@ class ShowTransferAcceptCommand(show.ShowOne):
|
||||
|
||||
data = client.zone_transfers.get_accept(parsed_args.id)
|
||||
|
||||
return zip(*sorted(six.iteritems(data)))
|
||||
return six.moves.zip(*sorted(six.iteritems(data)))
|
||||
|
Loading…
x
Reference in New Issue
Block a user