Skip to content
Snippets Groups Projects

remove system exits from datafetcher tests

Merged Janet Goldstein requested to merge WS-179-4-remove-sys-exits into main
All threads resolved!
Files
9
@@ -48,7 +48,11 @@ class DataFetcher:
raise MissingSettingsException()
self.args = args
self.settings = df_capo_settings
self.verbose = self.args.verbose
try:
self.verbose = self.args.verbose
except Exception:
# we don't care; --verbose will be dropped later in WS-179
pass
# required arguments
self.profile = args.profile
@@ -62,7 +66,14 @@ class DataFetcher:
raise MissingSettingsException(
f"output location {self.output_dir} inaccessible or not found"
)
self._LOG = FlexLogger(self.__class__.__name__, self.output_dir, self.verbose)
try:
self._LOG = FlexLogger(self.__class__.__name__, self.output_dir, self.verbose)
except AttributeError as a_err:
# verbose is going away, so let's not require it
if "no attribute 'verbose'" in str(a_err):
self._LOG = FlexLogger(self.__class__.__name__, self.output_dir)
if args.location_file is not None:
if args.product_locator is not None:
raise MissingSettingsException(
@@ -79,7 +90,12 @@ class DataFetcher:
# optional arguments
self.is_dry = args.dry_run
self.force = args.force
self.verbose = args.verbose or False
try:
self.verbose = args.verbose or False
except AttributeError as a_err:
# verbose is going away soon
self.verbose = False
self.locations_report = self._get_locations()
self.servers_report = self.locations_report.servers_report
@@ -100,7 +116,7 @@ class DataFetcher:
"""
fetcher = ParallelFetcher(self.args, self.settings, self._LOG, self.servers_report)
return fetcher.run()
fetcher.run()
def _get_locations(self):
capo_settings = get_capo_settings(self.profile)
@@ -112,11 +128,7 @@ def main():
from the command line.
"""
try:
args = get_arg_parser().parse_args()
except (SystemExit, Exception) as exc:
# most likely a parameter was omitted
raise MissingSettingsException from exc
args = get_arg_parser().parse_args()
settings = get_capo_settings(args.profile)
DataFetcher(args, settings).run()
Loading