diff --git a/atdb/main.py b/atdb/main.py index cf3734acab0b2786f04e27198b18065e1fae9316..7c3b9049b2e9fca42b02d8887213522f2ff248d9 100644 --- a/atdb/main.py +++ b/atdb/main.py @@ -23,10 +23,12 @@ def read_conf_file(args: Namespace, additional_location=None): """ parser = ConfigParser() if additional_location is not None: - parser.read(additional_location) + read_files = parser.read(additional_location) else: - parser.read(DEFAULT_PATH) + read_files = parser.read(DEFAULT_PATH) + if not read_files and (args.atdb_site is None or args.token is None): + raise SystemError('Missing configuration file') global_config = parser["ATDB"] if "url" in global_config: args.atdb_site = parser["ATDB"]["url"] @@ -35,7 +37,7 @@ def read_conf_file(args: Namespace, additional_location=None): return args -def parse_args() -> Namespace: +def parse_args() -> (Namespace, ArgumentParser): """ Parse command line arguments """ diff --git a/atdb/prune.py b/atdb/prune.py index cb9b5946cc9f41778068252320ba2fd0f5142281..f8e235f926f3afcc40994f4d6917836b05d98bc7 100644 --- a/atdb/prune.py +++ b/atdb/prune.py @@ -88,4 +88,7 @@ def prune(args): ) remove_surl_locations(surls_to_remove, dry_run=args.dry_run) - logger.info("Successfully removed %s files", len(surls_to_remove)) + if args.dry_run: + logger.info("[dry-run] Successfully removed %s files", len(surls_to_remove)) + else: + logger.info("Successfully removed %s files", len(surls_to_remove)) \ No newline at end of file