From 39423a98c51e3ed430218881ce1e9c669880bcb9 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Wed, 27 Dec 2023 02:13:51 +0900 Subject: [PATCH] Use --record instead of deprecated --records The --records argument was deprecated during queens cycle[1], and the new --record argument should be used. [1] 66e4955408eacb4859cfef01a31d013e34c28ffb Related-Bug: #1736161 Change-Id: Ia4d84e6167d1192fee351d663af3e9f4cda1ea3f --- designateclient/functionaltests/client.py | 14 ++++++++++---- .../functionaltests/v2/test_recordsets.py | 6 +++--- doc/source/user/shell-v2.rst | 8 ++++---- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/designateclient/functionaltests/client.py b/designateclient/functionaltests/client.py index dd0a309c..a233d1ca 100644 --- a/designateclient/functionaltests/client.py +++ b/designateclient/functionaltests/client.py @@ -211,10 +211,13 @@ class RecordsetCommands: cmd = f'recordset list {zone_id}' return self.parsed_cmd(cmd, ListModel, *args, **kwargs) - def recordset_create(self, zone_id, name, records=None, type=None, + def recordset_create(self, zone_id, name, record=None, type=None, description=None, ttl=None, *args, **kwargs): options_str = build_option_string({ - '--records': records, + # NOTE(tkajinam): --record argument should be repeated when + # multiple records are used. This code needs update when multiple + # records are used in functional tests. + '--record': record, '--type': type, '--description': description, '--ttl': ttl, @@ -222,11 +225,14 @@ class RecordsetCommands: cmd = f'recordset create {zone_id} {name} {options_str}' return self.parsed_cmd(cmd, FieldValueModel, *args, **kwargs) - def recordset_set(self, zone_id, id, records=None, type=None, + def recordset_set(self, zone_id, id, record=None, type=None, description=None, ttl=None, no_description=False, no_ttl=False, *args, **kwargs): options_str = build_option_string({ - '--records': records, + # NOTE(tkajinam): --record argument should be repeated when + # multiple records are used. This code needs update when multiple + # records are used in functional tests. + '--record': record, '--type': type, '--description': description, '--ttl': ttl, diff --git a/designateclient/functionaltests/v2/test_recordsets.py b/designateclient/functionaltests/v2/test_recordsets.py index 69f4161e..ef615634 100644 --- a/designateclient/functionaltests/v2/test_recordsets.py +++ b/designateclient/functionaltests/v2/test_recordsets.py @@ -36,7 +36,7 @@ class TestRecordset(BaseDesignateTest): self.recordset = self.useFixture(RecordsetFixture( zone_id=self.zone.id, name=name, - records='1.2.3.4', + record='1.2.3.4', description='An a recordset', type='A', ttl=1234, @@ -77,7 +77,7 @@ class TestRecordset(BaseDesignateTest): rset = self.clients.recordset_set( self.zone.id, self.recordset.id, - records='2.3.4.5', + record='2.3.4.5', ttl=2345, description='Updated description', ) @@ -102,7 +102,7 @@ class TestRecordsetNegative(BaseDesignateTest): def test_invalid_option_on_recordset_create(self): cmd = ('recordset create de47d30b-41c5-4e38-b2c5-e0b908e19ec7 ' - 'aaa.desig.com. --type A --records 1.2.3.4 ' + 'aaa.desig.com. --type A --record 1.2.3.4 ' '--invalid "not valid"') self.assertRaises(CommandFailed, self.clients.openstack, cmd) diff --git a/doc/source/user/shell-v2.rst b/doc/source/user/shell-v2.rst index a15abc82..0316f6b1 100644 --- a/doc/source/user/shell-v2.rst +++ b/doc/source/user/shell-v2.rst @@ -76,7 +76,7 @@ the DNS standard, and we didn't set a TTL. .. code-block:: shell-session - $ openstack recordset create --type A --records 192.0.2.20 example.com. www + $ openstack recordset create --type A --record 192.0.2.20 example.com. www +-------------+--------------------------------------+ | Field | Value | +-------------+--------------------------------------+ @@ -221,7 +221,7 @@ Using the zone above, create a recordset with the following command: .. code-block:: shell-session - $ openstack recordset create example.com. --type A www --records 192.0.2.20 + $ openstack recordset create example.com. --type A www --record 192.0.2.20 +-------------+--------------------------------------+ | Field | Value | +-------------+--------------------------------------+ @@ -243,7 +243,7 @@ Multiple records can be provided for a specific recordset type: .. code-block:: shell-session - $ openstack recordset create example.com. --type A www --records 192.0.2.20 192.0.2.21 + $ openstack recordset create example.com. --type A www --record 192.0.2.20 --record 192.0.2.21 See the new recordset in the list of recordsets with the following command: @@ -261,7 +261,7 @@ Update a specific recordset: .. code-block:: shell-session - $ openstack recordset set example.com. www.example.com. --ttl 10000 --records 192.0.2.20 192.0.2.21 + $ openstack recordset set example.com. www.example.com. --ttl 10000 --record 192.0.2.20 --record 192.0.2.21 Delete a recordset: