Skip to content

Commit cb068d8

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Fix i18n support for help and error msg in network"
2 parents 948c76b + 40f51c3 commit cb068d8

7 files changed

Lines changed: 14 additions & 14 deletions

File tree

openstackclient/network/v2/address_scope.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def take_action(self, parsed_args):
185185
if parsed_args.no_share:
186186
attrs['shared'] = False
187187
if attrs == {}:
188-
msg = "Nothing specified to be set."
188+
msg = _("Nothing specified to be set.")
189189
raise exceptions.CommandError(msg)
190190
client.update_address_scope(obj, **attrs)
191191

openstackclient/network/v2/network.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def update_parser_network(self, parser):
219219
default_router_grp.add_argument(
220220
'--no-default',
221221
action='store_true',
222-
help=_("Do not use the network as the default external network. "
222+
help=_("Do not use the network as the default external network "
223223
"(default)")
224224
)
225225
_add_additional_network_options(parser)
@@ -256,7 +256,7 @@ def update_parser_common(self, parser):
256256
'network',
257257
metavar="<network>",
258258
nargs="+",
259-
help=("Network(s) to delete (name or ID)")
259+
help=_("Network(s) to delete (name or ID)")
260260
)
261261
return parser
262262

@@ -282,13 +282,13 @@ def update_parser_common(self, parser):
282282
'--external',
283283
action='store_true',
284284
default=False,
285-
help='List external networks',
285+
help=_("List external networks")
286286
)
287287
parser.add_argument(
288288
'--long',
289289
action='store_true',
290290
default=False,
291-
help='List additional fields in output',
291+
help=_("List additional fields in output")
292292
)
293293
return parser
294294

@@ -435,7 +435,7 @@ def take_action(self, parsed_args):
435435

436436
attrs = _get_attrs(self.app.client_manager, parsed_args)
437437
if attrs == {}:
438-
msg = "Nothing specified to be set"
438+
msg = _("Nothing specified to be set")
439439
raise exceptions.CommandError(msg)
440440

441441
client.update_network(obj, **attrs)

openstackclient/network/v2/port.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ def take_action(self, parsed_args):
414414
attrs['fixed_ips'] = []
415415

416416
if attrs == {}:
417-
msg = "Nothing specified to be set"
417+
msg = _("Nothing specified to be set")
418418
raise exceptions.CommandError(msg)
419419
client.update_port(obj, **attrs)
420420

openstackclient/network/v2/router.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ def take_action(self, parsed_args):
427427
attrs['routes'] = obj.routes + parsed_args.routes
428428

429429
if attrs == {}:
430-
msg = "Nothing specified to be set"
430+
msg = _("Nothing specified to be set")
431431
raise exceptions.CommandError(msg)
432432

433433
client.update_router(obj, **attrs)

openstackclient/network/v2/security_group_rule.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,8 +519,8 @@ def take_action_compute(self, client, parsed_args):
519519
break
520520

521521
if obj is None:
522-
msg = "Could not find security group rule " \
523-
"with ID %s" % parsed_args.rule
522+
msg = _("Could not find security group rule with ID ") + \
523+
parsed_args.rule
524524
raise exceptions.CommandError(msg)
525525

526526
# NOTE(rtheis): Format security group rule

openstackclient/network/v2/subnet.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,9 @@ def _get_attrs(client_manager, parsed_args, is_create=True):
141141
gateway = parsed_args.gateway.lower()
142142

143143
if not is_create and gateway == 'auto':
144-
raise exceptions.CommandError("Auto option is not available"
145-
" for Subnet Set. Valid options are"
146-
" <ip-address> or none")
144+
msg = _("Auto option is not available for Subnet Set. "
145+
"Valid options are <ip-address> or none")
146+
raise exceptions.CommandError(msg)
147147
elif gateway != 'auto':
148148
if gateway == 'none':
149149
attrs['gateway_ip'] = None

openstackclient/network/v2/subnet_pool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ def take_action(self, parsed_args):
287287

288288
attrs = _get_attrs(self.app.client_manager, parsed_args)
289289
if attrs == {}:
290-
msg = "Nothing specified to be set"
290+
msg = _("Nothing specified to be set")
291291
raise exceptions.CommandError(msg)
292292

293293
# Existing prefixes must be a subset of the new prefixes.

0 commit comments

Comments
 (0)