From c58f0277a74a0f94638689de7db297f48243048e Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Fri, 19 Mar 2021 18:36:44 +0000 Subject: [PATCH] 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 --- openstackclient/network/v2/network_qos_rule.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/openstackclient/network/v2/network_qos_rule.py b/openstackclient/network/v2/network_qos_rule.py index 28c5600aa6..2e4b385d2e 100644 --- a/openstackclient/network/v2/network_qos_rule.py +++ b/openstackclient/network/v2/network_qos_rule.py @@ -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='', + required=True, choices=[RULE_TYPE_MINIMUM_BANDWIDTH, RULE_TYPE_DSCP_MARKING, RULE_TYPE_BANDWIDTH_LIMIT],