Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def docker_download(args):
"""Gets an output file out of the container.
"""
target = Path(args.target[0])
files = args.file
unpacked_info = read_dict(target)
if 'current_image' not in unpacked_info:
logger.critical("Image doesn't exist yet, have you run setup/build?")
sys.exit(1)
image = unpacked_info['current_image']
logger.debug("Downloading from image %s", image.decode('ascii'))
ContainerDownloader(target, files, image,
all_=args.all, docker_cmd=args.docker_cmd.split())
def docker_upload(args):
"""Replaces an input file in the container.
"""
target = Path(args.target[0])
files = args.file
unpacked_info = read_dict(target)
input_files = unpacked_info.setdefault('input_files', {})
try:
ContainerUploader(target, input_files, files, unpacked_info,
docker_cmd=args.docker_cmd.split())
finally:
write_dict(target, unpacked_info)