From 2988be05578f1c3862addd738f75ef163b388752 Mon Sep 17 00:00:00 2001 From: c-bordon Date: Tue, 16 Apr 2024 16:30:40 -0300 Subject: [PATCH] Fixed deploy for macOS in AWS --- .../modules/allocation/aws/provider.py | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/deployability/modules/allocation/aws/provider.py b/deployability/modules/allocation/aws/provider.py index 287a4c17fd..50d49bcc59 100644 --- a/deployability/modules/allocation/aws/provider.py +++ b/deployability/modules/allocation/aws/provider.py @@ -297,19 +297,23 @@ def _generate_dedicated_host(config: AWSConfig, arch: str) -> str: client = boto3.client('ec2') dedicated_host_name = str(config.name) + '-Host-' + arch logger.info(f"Creating dedicated host: {dedicated_host_name}") - host = client.allocate_hosts(InstanceType=config.type, - AutoPlacement='on', - AvailabilityZone=config.zone, - Quantity=1, - TagSpecifications=[{ - 'ResourceType': 'dedicated-host', - 'Tags': [ - {'Key': 'Name', 'Value': dedicated_host_name}, - {'Key': 'termination_date', 'Value': config.termination_date}, - {'Key': 'issue', 'Value': config.issue}, - {'Key': 'team', 'Value': config.team} - ] - }]) + params = { + 'InstanceType': config.type, + 'AutoPlacement': 'on', + 'AvailabilityZone': config.zone, + 'Quantity': 1, + 'TagSpecifications': [{ + 'ResourceType': 'dedicated-host', + 'Tags': [ + {'Key': 'Name', 'Value': config.name}, + {'Key': 'termination_date', 'Value': config.termination_date}, + {'Key': 'team', 'Value': config.team} + ] + }] + } + if config.issue: + params['TagSpecifications'][0]['Tags'].append({'Key': 'issue', 'Value': config.issue}) + host = client.allocate_hosts(**params) logger.info(f"Dedicated host created: {host['HostIds'][0]}") return host['HostIds'][0] @@ -330,7 +334,7 @@ def _release_dedicated_host(host_identifier: str) -> str: if host['Unsuccessful']: unsuccessful_messages = [item['Error']['Message'] for item in host['Unsuccessful']] for message in unsuccessful_messages: - logger.info(f"{message}") + logger.warning(f"{message}") else: logger.info(f"Dedicated host released: {host_identifier}")