From 59ea9b9a0ba49877c296b0b68b9f698b393bfa0a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 19 Mar 2024 07:52:05 +0000 Subject: [PATCH 1/6] feat(Dependencies): Update dependency openstacksdk to v3 | datasource | package | from | to | | ---------- | ------------ | ----- | ----- | | pypi | openstacksdk | 2.1.0 | 3.0.0 | --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index f02527e..a7c85e0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ setuptools==69.2.0 thrift==0.16.0 python-keystoneclient==5.4.0 -openstacksdk==2.1.0 +openstacksdk==3.0.0 deprecated==1.2.14 Click==8.1.7 ansible==9.3.0 From 3af2eb44f21ead0b5eb365539be81b05f842d6ee Mon Sep 17 00:00:00 2001 From: dweinholz Date: Thu, 21 Mar 2024 14:47:31 +0100 Subject: [PATCH 2/6] fixed tests --- .../forc_connector/playbook/playbook.py | 1 - .../openstack_connector.py | 4 +++ simple_vm_client/test_openstack_connector.py | 33 +++++++------------ 3 files changed, 16 insertions(+), 22 deletions(-) diff --git a/simple_vm_client/forc_connector/playbook/playbook.py b/simple_vm_client/forc_connector/playbook/playbook.py index 1e4c5c6..cf7b4d6 100644 --- a/simple_vm_client/forc_connector/playbook/playbook.py +++ b/simple_vm_client/forc_connector/playbook/playbook.py @@ -299,7 +299,6 @@ def add_always_tasks_only(self, playbook_name: str) -> None: ) def run_it(self) -> None: - logger.info("RUN ITTT") command_string = f"/usr/local/bin/ansible-playbook -v -i {self.inventory.name} {self.directory.name}/{self.playbook_exec_name}" command_string = shlex.split(command_string) # type: ignore logger.info(f"Run Playbook for {self.playbook_exec_name} - [{command_string}]") diff --git a/simple_vm_client/openstack_connector/openstack_connector.py b/simple_vm_client/openstack_connector/openstack_connector.py index db8e90a..7f7b07d 100644 --- a/simple_vm_client/openstack_connector/openstack_connector.py +++ b/simple_vm_client/openstack_connector/openstack_connector.py @@ -1426,6 +1426,10 @@ def add_udp_security_group(self, server_id): if self._is_security_group_already_added_to_server( server=server, security_group_name=sec_name ): + logger.info( + f"UDP Security group with name {sec_name} already added to server." + ) + return self.openstack_connection.compute.add_security_group_to_server( diff --git a/simple_vm_client/test_openstack_connector.py b/simple_vm_client/test_openstack_connector.py index aaaa594..69a5ea2 100644 --- a/simple_vm_client/test_openstack_connector.py +++ b/simple_vm_client/test_openstack_connector.py @@ -1098,7 +1098,12 @@ def test_create_add_keys_script(self, mock_logger_info): result_script = self.openstack_connector.create_add_keys_script(keys) # Assertions - expected_script_content = '#!/bin/bash\ndeclare -a keys_to_add=("key1" "key2" "key3" )\necho "Found keys: ${#keys_to_add[*]}"\nfor ix in ${!keys_to_add[*]}\ndo\n printf "\\n%s" "${keys_to_add[$ix]}" >> /home/ubuntu/.ssh/authorized_keys\n\ndone\n' + expected_script_content = ( + '#!/bin/bash\ndeclare -a keys_to_add=("key1" "key2" "key3" )' + '\necho "Found keys: ${#keys_to_add[*]}"\nfor ix in ${!keys_to_add[*]}' + '\ndo\n printf "\\n%s" "${keys_to_add[$ix]}" >> /home/ubuntu/.ssh/authorized_keys' + "\n\ndone\n" + ) expected_script_content = encodeutils.safe_encode( expected_script_content.encode("utf-8") ) @@ -2166,21 +2171,6 @@ def test_reboot_server_success(self, mock_get_server): server_mock, "SOFT" ) - @patch.object(OpenStackConnector, "get_server") - @patch("simple_vm_client.openstack_connector.openstack_connector.logger.exception") - def test_reboot_server_conflict_exception( - self, mock_logger_exception, mock_get_server - ): - self.openstack_connector.openstack_connection.compute.reboot_server.side_effect = ConflictException( - "Unit Test" - ) - # Act - with self.assertRaises(OpenStackConflictException): - self.openstack_connector.reboot_server("some_openstack_id", "SOFT") - mock_logger_exception.assert_called_once_with( - "Reboot Server some_openstack_id failed!" - ) - @patch.object(OpenStackConnector, "get_server") def test_reboot_soft_server(self, mock_get_server): # Arrange @@ -2271,7 +2261,9 @@ def test_get_server( ignore_not_active=True, ignore_not_found=True, ) - mock_get_flavor.assert_called_once_with(name_or_id=flavor_mock.id) + mock_get_flavor.assert_called_once_with( + name_or_id=flavor_mock.id, ignore_error=True + ) mock_netcat.return_value = False # Assuming SSH connection is successful # Act result_server = self.openstack_connector.get_server(openstack_id) @@ -2335,7 +2327,7 @@ def test_reboot_server_conflict_exception( with self.assertRaises(OpenStackConflictException): self.openstack_connector.reboot_server("some_openstack_id", "SOFT") mock_logger_exception.assert_called_once_with( - f"Reboot Server some_openstack_id failed!" + "Reboot Server some_openstack_id failed!" ) def test_exist_server_true(self): @@ -2514,7 +2506,6 @@ def test_is_security_group_in_use_ports(self): def test_is_security_group_in_use_load_balancers(self): # Mock the network.load_balancers method to simulate load balancers associated with the security group - load_balancers = [{"id": "lb_id", "name": "lb_name"}] self.openstack_connector.openstack_connection.compute.servers.return_value = [] self.openstack_connector.openstack_connection.network.ports.return_value = [] @@ -2668,7 +2659,7 @@ def test_open_port_range_for_vm_in_project_conflict_exception( range_start=1000, range_stop=1000, openstack_id="test" ) mock_logger_exception.assert_called_once_with( - f"Could not create security group rule for instance test" + "Could not create security group rule for instance test" ) @patch.object(OpenStackConnector, "get_or_create_project_security_group") @@ -2707,7 +2698,7 @@ def test_open_port_range_for_vm_in_project( ) # Call the method - result = self.openstack_connector.open_port_range_for_vm_in_project( + self.openstack_connector.open_port_range_for_vm_in_project( range_start=1000, range_stop=2000, openstack_id=fake_server.id, From 519a7a7265310cdc04eaff00a2cf84beb1133177 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 22 Mar 2024 09:57:45 +0000 Subject: [PATCH 3/6] feat(Dependencies): Update redis Docker tag to v7.2.4 | datasource | package | from | to | | ---------- | ------- | ----- | ----- | | docker | redis | 7.2.3 | 7.2.4 | --- docker-compose.dev.giessen.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.dev.giessen.yml b/docker-compose.dev.giessen.yml index e54e770..1cdb3e7 100644 --- a/docker-compose.dev.giessen.yml +++ b/docker-compose.dev.giessen.yml @@ -18,7 +18,7 @@ services: simplevm_client_giessen_redis: container_name: simplevm_client_giessen_redis - image: redis:7.2.3 + image: redis:7.2.4 expose: - "6379" networks: From 4e0b1edb7150d3fd669ce24830ab9d1ba5e215da Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 23 Mar 2024 00:06:18 +0000 Subject: [PATCH 4/6] feat(Dependencies): Update dependency thrift to v0.20.0 | datasource | package | from | to | | ---------- | ------- | ------ | ------ | | pypi | thrift | 0.16.0 | 0.20.0 | --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index f02527e..7722adf 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ setuptools==69.2.0 -thrift==0.16.0 +thrift==0.20.0 python-keystoneclient==5.4.0 openstacksdk==2.1.0 deprecated==1.2.14 From 8cf2c3c635f6721a969fe708bf27654fe2530e29 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 24 Mar 2024 19:08:10 +0000 Subject: [PATCH 5/6] feat(Dependencies): Update dependency pre-commit to v3.7.0 | datasource | package | from | to | | ---------- | ---------- | ----- | ----- | | pypi | pre-commit | 3.6.2 | 3.7.0 | --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index f02527e..2dd3864 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,7 +12,7 @@ pyvim==3.0.3 redis==5.0.3 requests==2.31.0 pyyaml==6.0.1 -pre-commit==3.6.2 +pre-commit==3.7.0 types-PyYAML==6.0.12.20240311 sympy==1.12 types-redis==4.6.0.20240311 From f04776ccde803fb0c506f8fdafcf52399284089d Mon Sep 17 00:00:00 2001 From: dweinholz Date: Mon, 25 Mar 2024 07:57:25 +0100 Subject: [PATCH 6/6] updated thrift --- Dockerfile | 4 ++-- simple_vm_client/VirtualMachineService.py | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 85eb54e..282d13d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ -FROM python:3.11.4-buster - +FROM python:3.12.0 +RUN echo "deb https://deb.debian.org/debian/ stable main" > /etc/apt/sources.list RUN apt-get update -y \ && apt-get install -y build-essential \ && apt-get clean \ diff --git a/simple_vm_client/VirtualMachineService.py b/simple_vm_client/VirtualMachineService.py index ce49799..c6c7af2 100644 --- a/simple_vm_client/VirtualMachineService.py +++ b/simple_vm_client/VirtualMachineService.py @@ -90,7 +90,6 @@ def add_research_environment_security_group(self, server_id, security_group_name def add_metadata_to_server(self, openstack_id, metadata): """ Add metadata to a server. - Returns: List of flavor instances. Parameters: - openstack_id @@ -978,7 +977,6 @@ def recv_add_research_environment_security_group(self): def add_metadata_to_server(self, openstack_id, metadata): """ Add metadata to a server. - Returns: List of flavor instances. Parameters: - openstack_id