diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 46bb005..0c526fb 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,7 +11,7 @@ repos: - repo: https://github.com/psf/black-pre-commit-mirror - rev: 24.1.1 + rev: 24.2.0 hooks: - id: black language_version: python3.11 diff --git a/docker-compose.bibigrid.yml b/docker-compose.bibigrid.yml index 8d80d17..5b815bf 100644 --- a/docker-compose.bibigrid.yml +++ b/docker-compose.bibigrid.yml @@ -41,7 +41,7 @@ services: # filebeat simplevm_filebeat: - image: docker.elastic.co/beats/filebeat:8.12.0 + image: docker.elastic.co/beats/filebeat:8.12.1 env_file: - .env volumes: diff --git a/docker-compose.host.yml b/docker-compose.host.yml index 00ab252..f9ccc23 100644 --- a/docker-compose.host.yml +++ b/docker-compose.host.yml @@ -25,7 +25,7 @@ services: simplevm_client_filebeat: container_name: simplevm_client_filebeat - image: docker.elastic.co/beats/filebeat:8.12.0 + image: docker.elastic.co/beats/filebeat:8.12.1 env_file: - .env volumes: diff --git a/docker-compose.yml b/docker-compose.yml index 557cabe..7524328 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -27,7 +27,7 @@ services: # filebeat simplevm_client_filebeat: container_name: simplevm_client_filebeat - image: docker.elastic.co/beats/filebeat:8.12.0 + image: docker.elastic.co/beats/filebeat:8.12.1 env_file: - .env volumes: diff --git a/requirements.txt b/requirements.txt index 8f51938..02eb649 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,18 +1,18 @@ -setuptools==69.0.3 +setuptools==69.1.0 thrift==0.16.0 python-keystoneclient==5.3.0 openstacksdk==2.1.0 deprecated==1.2.14 Click==8.1.7 -ansible==9.1.0 +ansible==9.2.0 flake8==7.0.0 paramiko==3.4.0 -ruamel.yaml==0.18.5 +ruamel.yaml==0.18.6 pyvim==3.0.3 redis==5.0.1 requests==2.31.0 pyyaml==6.0.1 -pre-commit==3.6.0 +pre-commit==3.6.1 types-PyYAML==6.0.12.12 sympy==1.12 types-redis==4.6.0.20240106 diff --git a/simple_vm_client/openstack_connector/openstack_connector.py b/simple_vm_client/openstack_connector/openstack_connector.py index 1157ad7..4622069 100644 --- a/simple_vm_client/openstack_connector/openstack_connector.py +++ b/simple_vm_client/openstack_connector/openstack_connector.py @@ -459,17 +459,23 @@ def netcat(self, host: str, port: int) -> bool: logger.info(f"Checking SSH Connection {host}:{port} Result = {r}") return r == 0 - def get_flavor(self, name_or_id: str) -> Flavor: + def get_flavor(self, name_or_id: str, ignore_error: bool = False) -> Flavor: logger.info(f"Get flavor {name_or_id}") flavor: Flavor = self.openstack_connection.get_flavor( name_or_id=name_or_id, get_extra=True ) + if flavor is None: - logger.exception(f"Flavor {name_or_id} not found!") - raise FlavorNotFoundException( - message=f"Flavor {name_or_id} not found!", name_or_id=name_or_id - ) + logger.error(f"Flavor {name_or_id} not found!") + + if not ignore_error: + raise FlavorNotFoundException( + message=f"Flavor {name_or_id} not found!", name_or_id=name_or_id + ) + else: + return Flavor() + return flavor def get_flavors(self) -> list[Flavor]: @@ -1014,7 +1020,9 @@ def get_server(self, openstack_id: str) -> Server: ignore_not_found=True, ) - server.flavor = self.get_flavor(name_or_id=server.flavor["id"]) + server.flavor = self.get_flavor( + name_or_id=server.flavor["id"], ignore_error=True + ) return server except OpenStackCloudException as e: