summaryrefslogtreecommitdiff
path: root/designateclient
diff options
context:
space:
mode:
authorNicolas Bock <nicolas.bock@canonical.com>2020-09-25 08:49:13 -0600
committerNicolas Bock <nicolas.bock@canonical.com>2020-10-13 06:33:49 -0600
commitb68b70a097fd9b968407f253c8eaf91c76ff0fd1 (patch)
treee03bc669bcaf0d64bb98702b0a33c6a85b999049 /designateclient
parent8f9c503ecc7f4fc8bd6cb2108256ba3e63bb3b73 (diff)
downloadpython-designateclient-b68b70a097fd9b968407f253c8eaf91c76ff0fd1.tar.gz
Add choices to `--type` command line argument
We only allow `PRIMARY` and `SECONDARY` zones. Instead of testing for either one of those two choices later in the code, we can offload this test to the parser. Change-Id: I8244e13303646e6686e4233e1edbd2bbc788e054 Signed-off-by: Nicolas Bock <nicolas.bock@canonical.com>
Diffstat (limited to 'designateclient')
-rw-r--r--designateclient/v2/cli/zones.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/designateclient/v2/cli/zones.py b/designateclient/v2/cli/zones.py
index d54154b..f740504 100644
--- a/designateclient/v2/cli/zones.py
+++ b/designateclient/v2/cli/zones.py
@@ -55,7 +55,10 @@ class ListZonesCommand(command.Lister):
parser.add_argument('--name', help="Zone Name", required=False)
parser.add_argument('--email', help="Zone Email", required=False)
- parser.add_argument('--type', help="Zone Type", required=False)
+ parser.add_argument('--type', help="Zone Type",
+ choices=["PRIMARY", "SECONDARY"],
+ default="PRIMARY",
+ required=False)
parser.add_argument('--ttl', help="Time To Live (Seconds)",
required=False)
parser.add_argument('--description', help="Description",
@@ -129,7 +132,9 @@ class CreateZoneCommand(command.ShowOne):
parser.add_argument('name', help="Zone Name")
parser.add_argument('--email', help="Zone Email")
- parser.add_argument('--type', help="Zone Type", default='PRIMARY')
+ parser.add_argument('--type', help="Zone Type",
+ choices=["PRIMARY", "SECONDARY"],
+ default='PRIMARY')
parser.add_argument('--ttl', type=int, help="Time To Live (Seconds)")
parser.add_argument('--description', help="Description")
parser.add_argument('--masters', help="Zone Masters", nargs='+')