Add FileNotFoundError if file containing pre number not found
This commit is contained in:
parent
8ceb5ef133
commit
0dc86a06ac
1 changed files with 8 additions and 4 deletions
|
|
@ -108,8 +108,12 @@ def main(snap_pac_ini, snapper_conf_file, args):
|
||||||
if config.getboolean(c, "snapshot"):
|
if config.getboolean(c, "snapshot"):
|
||||||
prefile = f"/tmp/snap-pac-pre_{c}"
|
prefile = f"/tmp/snap-pac-pre_{c}"
|
||||||
logging.debug(f"{prefile = }")
|
logging.debug(f"{prefile = }")
|
||||||
|
try:
|
||||||
snapper_cmd = create_snapper_cmd(args.preorpost, config, c, prefile)
|
snapper_cmd = create_snapper_cmd(args.preorpost, config, c, prefile)
|
||||||
logging.debug(f"{snapper_cmd = }")
|
logging.debug(f"{snapper_cmd = }")
|
||||||
|
except FileNotFoundError:
|
||||||
|
logging.error(f"File containing pre snapshot number not found.")
|
||||||
|
else:
|
||||||
num = do_snapshot(args.preorpost, snapper_cmd, prefile)
|
num = do_snapshot(args.preorpost, snapper_cmd, prefile)
|
||||||
logging.info(f"==> {c}: {num}")
|
logging.info(f"==> {c}: {num}")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue