[aws] Convert containerPort to int before comparing to avoid jinja2 string-int issues (#39215) (#47195)

This commit is contained in:
David González 2018-10-17 18:29:23 +02:00 committed by Ryan Brown
parent fce9673ac1
commit b923bf708d

View file

@ -516,7 +516,12 @@ def main():
role = module.params['role'] role = module.params['role']
clientToken = module.params['client_token'] clientToken = module.params['client_token']
loadBalancers = module.params['load_balancers']
loadBalancers = []
for loadBalancer in module.params['load_balancers']:
if 'containerPort' in loadBalancer:
loadBalancer['containerPort'] = int(loadBalancer['containerPort'])
loadBalancers.append(loadBalancer)
if update: if update:
if (existing['loadBalancers'] or []) != loadBalancers: if (existing['loadBalancers'] or []) != loadBalancers:
@ -529,10 +534,6 @@ def main():
deploymentConfiguration, deploymentConfiguration,
network_configuration) network_configuration)
else: else:
for loadBalancer in loadBalancers:
if 'containerPort' in loadBalancer:
loadBalancer['containerPort'] = int(loadBalancer['containerPort'])
# doesn't exist. create it.
try: try:
response = service_mgr.create_service(module.params['name'], response = service_mgr.create_service(module.params['name'],
module.params['cluster'], module.params['cluster'],