network: Make 'network qos rule create --type' option required

When we create a network qos rule we need specify the type so that we
can call the corresponding API. It's not possible to use the command
without the type so mark it as required. This was already being done
but inline.

Change-Id: I559f884bac198d2c69e800620aef66b200473418
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
This commit is contained in:
Stephen Finucane
2021-03-19 18:36:44 +00:00
parent 86bca18b74
commit c58f0277a7

View File

@@ -84,9 +84,6 @@ def _get_attrs(network_client, parsed_args, is_create=False):
{'rule_id': parsed_args.id})
raise exceptions.CommandError(msg)
else:
if not parsed_args.type:
msg = _('"Create" rule command requires argument "type"')
raise exceptions.CommandError(msg)
rule_type = parsed_args.type
if parsed_args.max_kbps is not None:
attrs['max_kbps'] = parsed_args.max_kbps
@@ -188,6 +185,7 @@ class CreateNetworkQosRule(command.ShowOne):
parser.add_argument(
'--type',
metavar='<type>',
required=True,
choices=[RULE_TYPE_MINIMUM_BANDWIDTH,
RULE_TYPE_DSCP_MARKING,
RULE_TYPE_BANDWIDTH_LIMIT],