Improve the RecordSet Update UI

This adds the logic introduced in
I8fefd9d0f104170d50c5d5dc3cbcc53facda9baf to the "recordset set"
command as well.

This helps with the consistancy, and fixes some of the same issues
in the set command.

Change-Id: Ib943ed0eea436ad1a7ad0c3717f0fb6bd6b5b3f0
This commit is contained in:
Graham Hayes
2018-02-12 13:41:10 +00:00
parent 1a3632cf57
commit 653643b448

View File

@@ -193,7 +193,15 @@ class SetRecordSetCommand(command.ShowOne):
parser.add_argument('zone_id', help="Zone ID")
parser.add_argument('id', help="RecordSet ID")
parser.add_argument('--records', help="Records", nargs='+')
req_group = parser.add_mutually_exclusive_group()
req_group.add_argument(
'--records',
help=argparse.SUPPRESS,
nargs='+')
req_group.add_argument(
'--record',
help="RecordSet Record, repeat if necessary",
action='append')
description_group = parser.add_mutually_exclusive_group()
description_group.add_argument('--description', help="Description")
@@ -220,8 +228,13 @@ class SetRecordSetCommand(command.ShowOne):
elif parsed_args.ttl:
data['ttl'] = parsed_args.ttl
all_records = parsed_args.record or parsed_args.records
if parsed_args.records:
data['records'] = parsed_args.records
self.log.warning(
"Option --records is deprecated, use --record instead.")
if all_records:
data['records'] = all_records
client = self.app.client_manager.dns
common.set_all_common_headers(client, parsed_args)