def handle_scan(sender, instance, **kwargs): """Handle incoming scan. :param sender: Class that was saved :param instance: ScanJob that was triggered :param kwargs: Other args :returns: None """ scanner = ScanJobRunner(instance) if not SCAN_MANAGER.is_alive(): SCAN_MANAGER.start() # Don't add the scan as it will be picked up # by the manager startup, looking for pending/running scans. else: SCAN_MANAGER.put(scanner)
def scan_restart(sender, instance, fact_endpoint, **kwargs): """Restart a scan. :param sender: Class that was saved :param instance: ScanJob that was saved :param kwargs: Other args :returns: None """ scanner = ScanJobRunner(instance, fact_endpoint) if not SCAN_MANAGER.is_alive(): SCAN_MANAGER.start() # Don't add the scan as it will be picked up # by the manager startup, looking for pending/running scans. else: SCAN_MANAGER.put(scanner)
def scan_restart(sender, instance, **kwargs): """Restart a scan. :param sender: Class that was saved :param instance: ScanJob that was saved :param kwargs: Other args :returns: None """ instance.log_message(_(messages.SIGNAL_STATE_CHANGE) % ('RESTART')) scanner = ScanJobRunner(instance) if not SCAN_MANAGER.is_alive(): SCAN_MANAGER.start() # Don't add the scan as it will be picked up # by the manager startup, looking for pending/running scans. else: SCAN_MANAGER.put(scanner)