From 77a90b9e01bdb6611b690093b955fc29118488dd Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Sat, 2 Dec 2017 16:40:55 +0000 Subject: [PATCH] pmbootstrap: Check if work folder exists before doing anything (#966) Fixes #949. --- pmb/__init__.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pmb/__init__.py b/pmb/__init__.py index 8deed1dd..ab06488a 100644 --- a/pmb/__init__.py +++ b/pmb/__init__.py @@ -44,9 +44,11 @@ def main(): if args.action == "init": return config_init.frontend(args) elif not os.path.exists(args.config): - logging.critical("Please specify a config file, or run" - " 'pmbootstrap init' to generate one.") - return 1 + raise RuntimeError("Please specify a config file, or run" + " 'pmbootstrap init' to generate one.") + elif not os.path.exists(args.work): + raise RuntimeError("Work path not found, please run 'pmbootstrap" + " init' to create it.") # Migrate work folder if necessary if args.action not in ["shutdown", "zap", "log"]: