Add debug to container image prepare

Add the ability to specify --debug to tripleo-container-image-prepare to
help with debugging.

Change-Id: Ifd9293716a8fbf9b26a634789ed704dca436d450
This commit is contained in:
Alex Schultz 2018-09-24 13:21:10 -06:00
parent 85e99cc444
commit a4048bfdf0
1 changed files with 12 additions and 1 deletions

View File

@ -90,6 +90,13 @@ def get_args():
'The environment file will still be populated as if these '
'operations were performed.'
)
parser.add_argument(
"--debug",
dest="debug",
action='store_true',
help="Enable debug logging. By default logging is set to INFO."
)
args = parser.parse_args(sys.argv[1:])
return args
@ -104,7 +111,11 @@ if __name__ == '__main__':
log = logging.getLogger()
if args.log_file:
log.addHandler(logging.FileHandler(filename=args.log_file))
log.setLevel(logging.INFO)
if args.debug:
log_level = logging.DEBUG
else:
log_level = logging.INFO
log.setLevel(log_level)
if args.cleanup not in image_uploader.CLEANUP:
raise RuntimeError('--cleanup must be one of: %s' %