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>
This commit is contained in:
parent
8f9c503ecc
commit
b68b70a097
|
@ -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='+')
|
||||
|
|
Loading…
Reference in New Issue