1+ #!/usr/bin/env python3
12"""
23Script for testing mongodb in containers.
34
4041
4142def _run_process (params , cwd = None ):
4243 LOGGER .info ("RUNNING COMMAND: %s" , params )
43- ret = subprocess .run (params , cwd = cwd , check = False )
44+ ret = subprocess .run (params , cwd = cwd )
4445 return ret .returncode
4546
4647def _userandhostandport (endpoint ):
@@ -136,7 +137,7 @@ def remote_ps_container(cluster):
136137 assert private_ip_address
137138
138139 eni = ec2_client .describe_network_interfaces (NetworkInterfaceIds = enis )
139- public_ip = next ( iter ( n ["Association" ]["PublicIp" ] for n in eni ["NetworkInterfaces" ]))
140+ public_ip = [ n ["Association" ]["PublicIp" ] for n in eni ["NetworkInterfaces" ]][ 0 ]
140141
141142 for container in task ['containers' ]:
142143 taskArn = container ['taskArn' ]
@@ -145,7 +146,7 @@ def remote_ps_container(cluster):
145146 task_id = task_id + "/" + name
146147 lastStatus = container ['lastStatus' ]
147148
148- print (f" { task_id :<43} { lastStatus :<9} { public_ip :<25} { private_ip_address :<25} { taskDefinition_short :<16} " )
149+ print ("{ :<43}{:<9}{:<25}{:<25}{:<16}". format ( task_id , lastStatus , public_ip , private_ip_address , taskDefinition_short ) )
149150
150151def _remote_create_container_args (args ):
151152 remote_create_container (args .cluster , args .task_definition , args .service , args .subnets , args .security_group )
@@ -246,7 +247,7 @@ def remote_get_public_endpoint_str(cluster, service_name):
246247 assert enis
247248
248249 eni = ec2_client .describe_network_interfaces (NetworkInterfaceIds = enis )
249- public_ip = next ( iter ( n ["Association" ]["PublicIp" ] for n in eni ["NetworkInterfaces" ]))
250+ public_ip = [ n ["Association" ]["PublicIp" ] for n in eni ["NetworkInterfaces" ]][ 0 ]
250251 break
251252
252253 return f"root@{ public_ip } :22"
0 commit comments