From a623a141354164c1f08a3419a232b33c0673bed0 Mon Sep 17 00:00:00 2001 From: Tim Brown Date: Mon, 20 Jan 2025 11:05:50 +0000 Subject: [PATCH] fix extend warning and ignore type errors from existing code --- runner_manager/backend/aws.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/runner_manager/backend/aws.py b/runner_manager/backend/aws.py index 2a53aa0d..f452a6e6 100644 --- a/runner_manager/backend/aws.py +++ b/runner_manager/backend/aws.py @@ -74,9 +74,11 @@ def _create_from_subnet_config( ) concrete_instance_config = deepcopy(self.instance_config) concrete_instance_config.subnet_id = subnet_config["subnet_id"] - concrete_instance_config.security_group_ids.extend( - subnet_config.get("security_group_ids", []) - ) + subnet_security_groups = subnet_config.get("security_group_ids", []) + if subnet_security_groups: + security_groups = list(concrete_instance_config.security_group_ids) + security_groups += subnet_security_groups + concrete_instance_config.security_group_ids = security_groups instance_resource: AwsInstance = ( concrete_instance_config.configure_instance(runner) ) @@ -90,8 +92,8 @@ def _create_from_subnet_config( return runner def _create(self, runner: Runner, instance_resource: AwsInstance) -> Runner: - instance = self.client.run_instances(**instance_resource) - runner.instance_id = instance["Instances"][0]["InstanceId"] + instance = self.client.run_instances(**instance_resource) # type: ignore + runner.instance_id = instance["Instances"][0]["InstanceId"] # type: ignore return runner def delete(self, runner: Runner):