Skip to content
Snippets Groups Projects
Commit b40946fe authored by Mattia Mancini's avatar Mattia Mancini
Browse files

Fix user friendliness

parent 3cefa993
Branches
No related tags found
1 merge request!10Implement pruning mechanism for the utils script
Pipeline #39313 passed with warnings
...@@ -23,10 +23,12 @@ def read_conf_file(args: Namespace, additional_location=None): ...@@ -23,10 +23,12 @@ def read_conf_file(args: Namespace, additional_location=None):
""" """
parser = ConfigParser() parser = ConfigParser()
if additional_location is not None: if additional_location is not None:
parser.read(additional_location) read_files = parser.read(additional_location)
else: 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"] global_config = parser["ATDB"]
if "url" in global_config: if "url" in global_config:
args.atdb_site = parser["ATDB"]["url"] args.atdb_site = parser["ATDB"]["url"]
...@@ -35,7 +37,7 @@ def read_conf_file(args: Namespace, additional_location=None): ...@@ -35,7 +37,7 @@ def read_conf_file(args: Namespace, additional_location=None):
return args return args
def parse_args() -> Namespace: def parse_args() -> (Namespace, ArgumentParser):
""" """
Parse command line arguments Parse command line arguments
""" """
......
...@@ -88,4 +88,7 @@ def prune(args): ...@@ -88,4 +88,7 @@ def prune(args):
) )
remove_surl_locations(surls_to_remove, dry_run=args.dry_run) remove_surl_locations(surls_to_remove, dry_run=args.dry_run)
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)) logger.info("Successfully removed %s files", len(surls_to_remove))
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment