From 7e2021bbe06f640f724f49de58a7e0f27445a02b Mon Sep 17 00:00:00 2001 From: "Zhang Rong(Jon)" Date: Tue, 31 Oct 2023 11:36:06 +0800 Subject: [PATCH] System peer CLI options change to choice Change "dcmanager system-peer add --heartbeat-failure-policy --administrative-state" to choice; Change "dcmanager system-peer update --administrative-state" and "dcmanager system-peer update --heartbeat-failure-policy" to choice. Test Plan: 1. PASS - Run 'dcmanager system-peer add --heartbeat-failure-policy --administrative-state' with correct choice and verify that the command work as expected; 2. PASS - Run 'dcmanager system-peer update --administrative-state' 'dcmanager system-peer update --heartbeat-failure-policy' with correct choice and verify that the command work as expected; 3. PASS - Run 'dcmanager system-peer add --heartbeat-failure-policy --administrative-state' with wrong choice and verify that the error message prompted; 4. PASS - Run 'dcmanager system-peer update --administrative-state' 'dcmanager system-peer update --heartbeat-failure-policy' with wrong choice and verify that the error message prompted; 5. PASS - Verify 'dcmanager help system-peer add' and 'dcmanager help system-peer update' output the correct messages. Story: 2010852 Task: 48487 Change-Id: I626fc0ccd156224e643940d208848ba832ccf25d Signed-off-by: Zhang Rong(Jon) --- .../commands/v1/system_peer_manager.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/distributedcloud-client/dcmanagerclient/commands/v1/system_peer_manager.py b/distributedcloud-client/dcmanagerclient/commands/v1/system_peer_manager.py index 7905f7e..e21643e 100644 --- a/distributedcloud-client/dcmanagerclient/commands/v1/system_peer_manager.py +++ b/distributedcloud-client/dcmanagerclient/commands/v1/system_peer_manager.py @@ -127,9 +127,9 @@ class AddSystemPeer(base.DCManagerShowOne): parser.add_argument( '--administrative-state', required=False, + choices=['enabled', 'disabled'], default='enabled', - help='Administrative control of peer state (enabled | disabled) \ - (default enabled).' + help='Administrative control of peer state (default enabled).' ) parser.add_argument( @@ -151,9 +151,9 @@ class AddSystemPeer(base.DCManagerShowOne): parser.add_argument( '--heartbeat-failure-policy', required=False, + choices=['alarm', 'rehome', 'delegate'], default='alarm', - help='Action to take with failure detection \ - (alarm | rehome | delegate) (default alarm).' + help='Action to take with failure detection (default alarm).' ) parser.add_argument( @@ -334,8 +334,8 @@ class UpdateSystemPeer(base.DCManagerShowOne): parser.add_argument( '--administrative-state', required=False, - help='Administrative control of peer state (enabled | disabled) \ - (default enabled).' + choices=['enabled', 'disabled'], + help='Administrative control of peer state (default enabled).' ) parser.add_argument( @@ -355,8 +355,8 @@ class UpdateSystemPeer(base.DCManagerShowOne): parser.add_argument( '--heartbeat-failure-policy', required=False, - help='Action to take with failure detection \ - (alarm | rehome | delegate) (default alarm).' + choices=['alarm', 'rehome', 'delegate'], + help='Action to take with failure detection (default alarm).' ) parser.add_argument(