From 2fe9422e04dd971894d869d85f4ac340fd27c1f0 Mon Sep 17 00:00:00 2001 From: Jiao Pengju Date: Fri, 9 Nov 2018 12:38:52 +0800 Subject: [PATCH] Limit the operation type for scheduledoperation Now karbor only support two types of scheduledoperation, but the client do not show and limit the values. So the end users can type any string to execute the command of 'scheduledoperation create', but the server returns error , this will make users confused, and they still not know the right value. This patch will limit the operation type in 'protect' and 'retention_protect'. Change-Id: Ic1110124472ac455f988bb25254feeb4417caf1a --- karborclient/v1/shell.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/karborclient/v1/shell.py b/karborclient/v1/shell.py index f5ad330..4395f69 100644 --- a/karborclient/v1/shell.py +++ b/karborclient/v1/shell.py @@ -1106,7 +1106,9 @@ def do_scheduledoperation_list(cs, args): help='Trigger name.') @utils.arg('operation_type', metavar='', - help='Operation Type of scheduled operation.') + choices=['protect', 'retention_protect'], + help='Operation Type of scheduled operation. Valid values are ' + '"protect" or "retention_protect."') @utils.arg('trigger_id', metavar='', help='Trigger id of scheduled operation.')