mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
parent
0e124c57c6
commit
6b1586748f
1 changed files with 18 additions and 2 deletions
|
@ -48,7 +48,7 @@ options:
|
|||
type: int
|
||||
containers:
|
||||
description:
|
||||
- A list of containers definitions
|
||||
- A list of containers definitions
|
||||
required: False
|
||||
type: list of dicts with container definitions
|
||||
volumes:
|
||||
|
@ -138,8 +138,24 @@ class EcsTaskManager:
|
|||
return None
|
||||
|
||||
def register_task(self, family, container_definitions, volumes):
|
||||
validated_containers = []
|
||||
|
||||
# Ensures the number parameters are int as required by boto
|
||||
for container in container_definitions:
|
||||
for param in ('memory', 'cpu', 'memoryReservation'):
|
||||
if param in container:
|
||||
container[param] = int(container[param])
|
||||
|
||||
if 'portMappings' in container:
|
||||
for port_mapping in container['portMappings']:
|
||||
for port in ('hostPort', 'containerPort'):
|
||||
if port in port_mapping:
|
||||
port_mapping[port] = int(port_mapping[port])
|
||||
|
||||
validated_containers.append(container)
|
||||
|
||||
response = self.ecs.register_task_definition(family=family,
|
||||
containerDefinitions=container_definitions, volumes=volumes)
|
||||
containerDefinitions=validated_containers, volumes=volumes)
|
||||
return response['taskDefinition']
|
||||
|
||||
def describe_task_definitions(self, family):
|
||||
|
|
Loading…
Reference in a new issue