in dusty/commands/run.py [0:0]
def execute(self, args):
""" Run the command """
log.debug("Starting")
if args.call_from_legacy:
log.warning("Called from legacy entry point")
# Init context
context = RunContext(args)
config = ConfigModel(context)
if args.list_suites or not args.suite:
suites = config.list_suites(args.config_seed, args.config_variable, args.config_file)
if not args.suite:
log.error("Suite is not defined. Use --help to get help")
log.info("Available suites: %s", ", ".join(suites))
return
# Make instances
scanning = ScanningPerformer(context)
processing = ProcessingPerformer(context)
reporting = ReportingPerformer(context)
# Add to context
context.performers["scanning"] = scanning
context.performers["processing"] = processing
context.performers["reporting"] = reporting
# Init config
config.load(args.config_seed, args.config_variable, args.config_file, args.suite)
scanning.validate_config(context.config)
processing.validate_config(context.config)
reporting.validate_config(context.config)
# Add meta to context
self._fill_context_meta(context)
# Load state
context.state.load()
# Prepare reporters first
reporting.prepare()
# Run actions
actions.run(context)
# Prepare scanning and processing
scanning.prepare()
processing.prepare()
# Perform
scanning.perform()
processing.perform()
reporting.perform()
# Done
context.state.save()
reporting.flush()
log.debug("Done")
# Show quality gate statistics if any
for line in context.get_meta("quality_gate_stats", list()):
log.info(line)
# Fail quality gate if needed
if context.get_meta("fail_quality_gate", False):
os._exit(1) # pylint: disable=W0212