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:
parent
85e99cc444
commit
a4048bfdf0
|
@ -90,6 +90,13 @@ def get_args():
|
||||||
'The environment file will still be populated as if these '
|
'The environment file will still be populated as if these '
|
||||||
'operations were performed.'
|
'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:])
|
args = parser.parse_args(sys.argv[1:])
|
||||||
return args
|
return args
|
||||||
|
|
||||||
|
@ -104,7 +111,11 @@ if __name__ == '__main__':
|
||||||
log = logging.getLogger()
|
log = logging.getLogger()
|
||||||
if args.log_file:
|
if args.log_file:
|
||||||
log.addHandler(logging.FileHandler(filename=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:
|
if args.cleanup not in image_uploader.CLEANUP:
|
||||||
raise RuntimeError('--cleanup must be one of: %s' %
|
raise RuntimeError('--cleanup must be one of: %s' %
|
||||||
|
|
Loading…
Reference in New Issue