Don't set availability_zone for 2.32 version of api

Closes-Bug: #2065769
Change-Id: Id0c7dc63e6dca5d32cf1cf8983588d44601b4338
This commit is contained in:
morozovalekseywot 2024-05-15 19:50:33 +03:00
parent 56ba694486
commit ae363bdf08
3 changed files with 18 additions and 9 deletions

@ -308,13 +308,16 @@ class CreateShareNetwork(command.ShowOne):
elif parsed_args.availability_zone: elif parsed_args.availability_zone:
availability_zone = parsed_args.availability_zone availability_zone = parsed_args.availability_zone
share_network = share_client.share_networks.create( kwargs = {
name=parsed_args.name, "name": parsed_args.name,
description=parsed_args.description, "description": parsed_args.description,
neutron_net_id=parsed_args.neutron_net_id, "neutron_net_id": parsed_args.neutron_net_id,
neutron_subnet_id=parsed_args.neutron_subnet_id, "neutron_subnet_id": parsed_args.neutron_subnet_id,
availability_zone=availability_zone, }
) if availability_zone:
kwargs['availability_zone'] = availability_zone
share_network = share_client.share_networks.create(**kwargs)
share_network_data = share_network._info share_network_data = share_network._info
share_network_data.pop('links', None) share_network_data.pop('links', None)
if parsed_args.formatter == 'table': if parsed_args.formatter == 'table':

@ -79,8 +79,7 @@ class TestShareNetworkCreate(TestShareNetwork):
name=None, name=None,
description=None, description=None,
neutron_net_id=None, neutron_net_id=None,
neutron_subnet_id=None, neutron_subnet_id=None)
availability_zone=None)
self.assertCountEqual(self.columns, columns) self.assertCountEqual(self.columns, columns)
self.assertCountEqual(expected_data.values(), data) self.assertCountEqual(expected_data.values(), data)

@ -0,0 +1,7 @@
---
fixes:
- |
Share network create command failed with 2.32 version of api, due to set
availability zone argument for old version of create function, which doesn't have
this argument. The bug was fixed by adding a check that the user set the
availability zone in query.