parser.add_argument('--keyname') parser.add_argument('--env') parser.add_argument('--ports') parser.add_argument('--memory') parser.add_argument('--cpu') parser.add_argument('--volumes') parser.add_argument('--logdriver') parser.add_argument('--loggroup') my_args = parser.parse_args() print(my_args) ecs_client = aws_clients.getecsclient(my_args.accesskey, my_args.secret, my_args.region) ec2_client = aws_clients.getec2client(my_args.accesskey, my_args.secret, my_args.region) c = ContainerDefinition(my_args.imagename, my_args.imageid) c.add_memory(int(my_args.memory)) c.add_cpu(int(my_args.cpu)) c.portMappings = utils.parse_port_mappings(my_args.ports) c.environment = utils.parse_env_variables(my_args.env) c.add_log_configuration(my_args.logdriver, my_args.region, my_args.loggroup) c.add_docker_label() vols = {} vols = utils.parse_mountings(my_args.volumes, my_args.taskname) c.mountPoints = vols.get("mounts") volumes = [] for vol in vols.get("volumes"): volumes.append(json.loads(vol.to_json()))
import aws_clients import ecs_utils import argparse parser = argparse.ArgumentParser() parser.add_argument('--accesskey') parser.add_argument('--secret') parser.add_argument('--region') parser.add_argument('--cluster') parser.add_argument('--taskname') parser.add_argument('--servicename') my_args = parser.parse_args() access_key = my_args.accesskey secret_key = my_args.secret region = my_args.region ecs_client = aws_clients.getecsclient(access_key, secret_key, region) ec2_client = aws_clients.getec2client(access_key, secret_key, region) ecs_utils.update_ecs_service(ecs_client, my_args.cluster, my_args.servicename, my_args.taskname, 0) ecs_utils.delete_ecs_service(ecs_client, my_args.cluster, my_args.servicename) ecs_utils.delete_ecs_task_definition(ecs_client, my_args.taskname)