createhdds: exit 2 if images missing, 1 if outdated

This will help us fine-tune the behaviour of the ansible plays.
This commit is contained in:
Adam Williamson 2016-10-17 11:26:18 -07:00
parent 8c0493ac35
commit 359da3d896

View File

@ -524,8 +524,8 @@ def cli_check(args, hdds):
"""Function for the CLI 'check' subcommand. Basically just calls """Function for the CLI 'check' subcommand. Basically just calls
check() and prints the results. Does renames before checking if check() and prints the results. Does renames before checking if
args.rename was set, and wipes 'unknown' images after checking if args.rename was set, and wipes 'unknown' images after checking if
args.clean was set. Exits with status 1 if any missing and/or args.clean was set. Exits with status 2 if any images are missing,
outdated files are found (handy for scripting/automation). 1 if all images are present but one or more is outdated.
""" """
if args.rename: if args.rename:
do_renames(hdds) do_renames(hdds)
@ -540,8 +540,10 @@ def cli_check(args, hdds):
if args.clean: if args.clean:
clean(unknown) clean(unknown)
if missing or outdated: if missing:
sys.exit("Missing and/or outdated images found!") sys.exit(2)
elif outdated:
sys.exit(1)
else: else:
sys.exit() sys.exit()