diff options
| author | Thomas Goirand <zigo@debian.org> | 2023-03-02 11:39:17 +0100 |
|---|---|---|
| committer | git-ubuntu importer <ubuntu-devel-discuss@lists.ubuntu.com> | 2023-03-02 16:35:26 +0000 |
| commit | 045454b774461c60e61f80750147e3ccba25936f (patch) | |
| tree | 2f4369569400e4f9ac83137383ad396a9016bf79 | |
| parent | 0f01a3228074e6db1ebec4c618c0d74963b95b0c (diff) | |
6.0.0-4 (patches unapplied)import/6.0.0-4debian/bookworm
Imported using git-ubuntu import.
Notes
Notes:
* Add Fix_parameter_handling_in_server_add_fixed_ip_cmd.patch.
| -rw-r--r-- | debian/changelog | 6 | ||||
| -rw-r--r-- | debian/patches/Fix_parameter_handling_in_server_add_fixed_ip_cmd.patch | 187 | ||||
| -rw-r--r-- | debian/patches/series | 1 |
3 files changed, 194 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog index 0295b93..e50909a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +python-openstackclient (6.0.0-4) unstable; urgency=medium + + * Add Fix_parameter_handling_in_server_add_fixed_ip_cmd.patch. + + -- Thomas Goirand <zigo@debian.org> Thu, 02 Mar 2023 11:39:17 +0100 + python-openstackclient (6.0.0-3) unstable; urgency=medium * Remove python3-congressclient build-depends. diff --git a/debian/patches/Fix_parameter_handling_in_server_add_fixed_ip_cmd.patch b/debian/patches/Fix_parameter_handling_in_server_add_fixed_ip_cmd.patch new file mode 100644 index 0000000..2f4e1ee --- /dev/null +++ b/debian/patches/Fix_parameter_handling_in_server_add_fixed_ip_cmd.patch @@ -0,0 +1,187 @@ +From f23322c5ef59704462330e882dc97694c1d9a7c1 Mon Sep 17 00:00:00 2001 +From: Dr. Jens Harbott <harbott@osism.tech> +Date: Tue, 06 Dec 2022 23:44:46 +0100 +Subject: [PATCH] Fix parameter handling in server add fixed ip cmd + +The fixed_ip_address parameter needs to be passed in a hash with key +"ip_address" in order to be processed by the server, the previous arg +was simply being ignored. + +Added a functional test for better coverage. + +Closes-Bug: 1998927 + +Change-Id: I6956d2642d8e80fc10c3739f0a571aa7ba276b1a +--- + +Index: python-openstackclient/openstackclient/compute/v2/server.py +=================================================================== +--- python-openstackclient.orig/openstackclient/compute/v2/server.py ++++ python-openstackclient/openstackclient/compute/v2/server.py +@@ -268,9 +268,11 @@ class AddFixedIP(command.ShowOne): + return ((), ()) + + kwargs = { +- 'net_id': net_id, +- 'fixed_ip': parsed_args.fixed_ip_address, ++ 'net_id': net_id + } ++ if parsed_args.fixed_ip_address: ++ kwargs['fixed_ips'] = [ ++ {"ip_address": parsed_args.fixed_ip_address}] + if parsed_args.tag: + kwargs['tag'] = parsed_args.tag + +@@ -429,8 +431,7 @@ class AddPort(command.Command): + port_id = parsed_args.port + + kwargs = { +- 'port_id': port_id, +- 'fixed_ip': None, ++ 'port_id': port_id + } + + if parsed_args.tag: +@@ -484,8 +485,7 @@ class AddNetwork(command.Command): + net_id = parsed_args.network + + kwargs = { +- 'net_id': net_id, +- 'fixed_ip': None, ++ 'net_id': net_id + } + + if parsed_args.tag: +Index: python-openstackclient/openstackclient/tests/functional/compute/v2/test_server.py +=================================================================== +--- python-openstackclient.orig/openstackclient/tests/functional/compute/v2/test_server.py ++++ python-openstackclient/openstackclient/tests/functional/compute/v2/test_server.py +@@ -1192,6 +1192,62 @@ class ServerTests(common.ComputeTestCase + addresses = cmd_output['addresses']['private'] + self.assertNotIn(ip_address, addresses) + ++ def test_server_add_fixed_ip(self): ++ name = uuid.uuid4().hex ++ cmd_output = self.openstack( ++ 'server create ' + ++ '--network private ' + ++ '--flavor ' + self.flavor_name + ' ' + ++ '--image ' + self.image_name + ' ' + ++ '--wait ' + ++ name, ++ parse_output=True, ++ ) ++ ++ self.assertIsNotNone(cmd_output['id']) ++ self.assertEqual(name, cmd_output['name']) ++ self.addCleanup(self.openstack, 'server delete --wait ' + name) ++ ++ # create port, record its ip address to use in later call, ++ # then delete - this is to figure out what should be a free ip ++ # in the subnet ++ port_name = uuid.uuid4().hex ++ ++ cmd_output = self.openstack( ++ 'port list', ++ parse_output=True, ++ ) ++ self.assertNotIn(port_name, cmd_output) ++ ++ cmd_output = self.openstack( ++ 'port create ' + ++ '--network private ' + port_name, ++ parse_output=True, ++ ) ++ self.assertIsNotNone(cmd_output['id']) ++ ip_address = cmd_output['fixed_ips'][0]['ip_address'] ++ self.openstack('port delete ' + port_name) ++ ++ # add fixed ip to server, assert the ip address appears ++ self.openstack('server add fixed ip --fixed-ip-address ' + ip_address + ++ ' ' + name + ' private') ++ ++ wait_time = 0 ++ while wait_time < 60: ++ cmd_output = self.openstack( ++ 'server show ' + name, ++ parse_output=True, ++ ) ++ if ip_address not in cmd_output['addresses']['private']: ++ # Hang out for a bit and try again ++ print('retrying add fixed ip check') ++ wait_time += 10 ++ time.sleep(10) ++ else: ++ break ++ addresses = cmd_output['addresses']['private'] ++ self.assertIn(ip_address, addresses) ++ + def test_server_add_remove_volume(self): + volume_wait_for = volume_common.BaseVolumeTests.wait_for_status + +Index: python-openstackclient/openstackclient/tests/unit/compute/v2/test_server.py +=================================================================== +--- python-openstackclient.orig/openstackclient/tests/unit/compute/v2/test_server.py ++++ python-openstackclient/openstackclient/tests/unit/compute/v2/test_server.py +@@ -400,8 +400,7 @@ class TestServerAddFixedIP(TestServer): + self.assertEqual(expected_data, tuple(data)) + self.sdk_client.create_server_interface.assert_called_once_with( + servers[0].id, +- net_id=network['id'], +- fixed_ip=None ++ net_id=network['id'] + ) + + @mock.patch.object(sdk_utils, 'supports_microversion') +@@ -456,7 +455,7 @@ class TestServerAddFixedIP(TestServer): + self.sdk_client.create_server_interface.assert_called_once_with( + servers[0].id, + net_id=network['id'], +- fixed_ip='5.6.7.8' ++ fixed_ips=[{'ip_address': '5.6.7.8'}] + ) + + @mock.patch.object(sdk_utils, 'supports_microversion') +@@ -513,7 +512,7 @@ class TestServerAddFixedIP(TestServer): + self.sdk_client.create_server_interface.assert_called_once_with( + servers[0].id, + net_id=network['id'], +- fixed_ip='5.6.7.8', ++ fixed_ips=[{'ip_address': '5.6.7.8'}], + tag='tag1', + ) + +@@ -824,7 +823,7 @@ class TestServerAddPort(TestServer): + result = self.cmd.take_action(parsed_args) + + self.sdk_client.create_server_interface.assert_called_once_with( +- servers[0], port_id=port_id, fixed_ip=None) ++ servers[0], port_id=port_id) + self.assertIsNone(result) + + def test_server_add_port(self): +@@ -862,7 +861,6 @@ class TestServerAddPort(TestServer): + self.sdk_client.create_server_interface.assert_called_once_with( + servers[0], + port_id='fake-port', +- fixed_ip=None, + tag='tag1') + + @mock.patch.object(sdk_utils, 'supports_microversion', return_value=False) +@@ -1265,7 +1263,7 @@ class TestServerAddNetwork(TestServer): + result = self.cmd.take_action(parsed_args) + + self.sdk_client.create_server_interface.assert_called_once_with( +- servers[0], net_id=net_id, fixed_ip=None) ++ servers[0], net_id=net_id) + self.assertIsNone(result) + + def test_server_add_network(self): +@@ -1304,7 +1302,6 @@ class TestServerAddNetwork(TestServer): + self.sdk_client.create_server_interface.assert_called_once_with( + servers[0], + net_id='fake-network', +- fixed_ip=None, + tag='tag1' + ) + diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..fb76b71 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1 @@ +Fix_parameter_handling_in_server_add_fixed_ip_cmd.patch |
