Fixes #4538 passing int params as required by boto (#18999)

This commit is contained in:
Kash 2016-12-09 19:39:02 +00:00 committed by Ryan Brown
parent 0e124c57c6
commit 6b1586748f

View file

@ -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):