Skip to content

Commit 948034e

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "router: Use plural form for storage of --fixed_ip argument"
2 parents 5f4236d + 58ad3ce commit 948034e

2 files changed

Lines changed: 11 additions & 9 deletions

File tree

openstackclient/network/v2/router.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ def _get_external_gateway_attrs(client_manager, parsed_args):
9999
gateway_info['enable_snat'] = False
100100
if parsed_args.enable_snat:
101101
gateway_info['enable_snat'] = True
102-
if parsed_args.fixed_ip:
102+
if parsed_args.fixed_ips:
103103
ips = []
104-
for ip_spec in parsed_args.fixed_ip:
104+
for ip_spec in parsed_args.fixed_ips:
105105
if ip_spec.get('subnet', False):
106106
subnet_name_id = ip_spec.pop('subnet')
107107
if subnet_name_id:
@@ -379,6 +379,7 @@ def get_parser(self, prog_name):
379379
metavar='subnet=<subnet>,ip-address=<ip-address>',
380380
action=parseractions.MultiKeyValueAction,
381381
optional_keys=['subnet', 'ip-address'],
382+
dest='fixed_ips',
382383
help=_(
383384
"Desired IP and/or subnet (name or ID) "
384385
"on external gateway: "
@@ -449,7 +450,7 @@ def take_action(self, parsed_args):
449450
if (
450451
parsed_args.disable_snat
451452
or parsed_args.enable_snat
452-
or parsed_args.fixed_ip
453+
or parsed_args.fixed_ips
453454
) and not parsed_args.external_gateway:
454455
msg = _(
455456
"You must specify '--external-gateway' in order "
@@ -797,6 +798,7 @@ def get_parser(self, prog_name):
797798
metavar='subnet=<subnet>,ip-address=<ip-address>',
798799
action=parseractions.MultiKeyValueAction,
799800
optional_keys=['subnet', 'ip-address'],
801+
dest='fixed_ips',
800802
help=_(
801803
"Desired IP and/or subnet (name or ID) "
802804
"on external gateway: "
@@ -870,7 +872,7 @@ def take_action(self, parsed_args):
870872
if (
871873
parsed_args.disable_snat
872874
or parsed_args.enable_snat
873-
or parsed_args.fixed_ip
875+
or parsed_args.fixed_ips
874876
) and not parsed_args.external_gateway:
875877
msg = _(
876878
"You must specify '--external-gateway' in order "

openstackclient/tests/unit/network/v2/test_router.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def test_create_with_gateway(self):
230230
('ha', False),
231231
('external_gateway', _network.name),
232232
('enable_snat', True),
233-
('fixed_ip', [{'ip-address': '2001:db8::1'}]),
233+
('fixed_ips', [{'ip-address': '2001:db8::1'}]),
234234
]
235235
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
236236

@@ -1297,7 +1297,7 @@ def test_wrong_gateway_params(self):
12971297
self._router.id,
12981298
]
12991299
verifylist = [
1300-
('fixed_ip', [{'subnet': "'abc'"}]),
1300+
('fixed_ips', [{'subnet': "'abc'"}]),
13011301
('router', self._router.id),
13021302
]
13031303
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@@ -1336,7 +1336,7 @@ def test_set_gateway_options_subnet_only(self):
13361336
verifylist = [
13371337
('router', self._router.id),
13381338
('external_gateway', self._network.id),
1339-
('fixed_ip', [{'subnet': "'abc'"}]),
1339+
('fixed_ips', [{'subnet': "'abc'"}]),
13401340
('enable_snat', True),
13411341
]
13421342
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@@ -1370,7 +1370,7 @@ def test_set_gateway_option_ipaddress_only(self):
13701370
verifylist = [
13711371
('router', self._router.id),
13721372
('external_gateway', self._network.id),
1373-
('fixed_ip', [{'ip-address': "10.0.1.1"}]),
1373+
('fixed_ips', [{'ip-address': "10.0.1.1"}]),
13741374
('enable_snat', True),
13751375
]
13761376
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@@ -1404,7 +1404,7 @@ def test_set_gateway_options_subnet_ipaddress(self):
14041404
verifylist = [
14051405
('router', self._router.id),
14061406
('external_gateway', self._network.id),
1407-
('fixed_ip', [{'subnet': "'abc'", 'ip-address': "10.0.1.1"}]),
1407+
('fixed_ips', [{'subnet': "'abc'", 'ip-address': "10.0.1.1"}]),
14081408
('enable_snat', True),
14091409
]
14101410
parsed_args = self.check_parser(self.cmd, arglist, verifylist)

0 commit comments

Comments
 (0)