From 653643b448f10bec6d6c6d899831318f6bdbcf82 Mon Sep 17 00:00:00 2001 From: Graham Hayes Date: Mon, 12 Feb 2018 13:41:10 +0000 Subject: [PATCH] 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 --- designateclient/v2/cli/recordsets.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/designateclient/v2/cli/recordsets.py b/designateclient/v2/cli/recordsets.py index 898da198..e4ea9aaa 100644 --- a/designateclient/v2/cli/recordsets.py +++ b/designateclient/v2/cli/recordsets.py @@ -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)