Esempio n. 1
0
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)
Esempio n. 2
0
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)
Esempio n. 3
0
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)
Esempio n. 4
0
#
# This software is licensed to you under the GNU General Public License,
# version 3 (GPLv3). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv3
# along with this software; if not, see
# https://www.gnu.org/licenses/gpl-3.0.txt.
#
"""
WSGI config for quipucords project.

It exposes the WSGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
"""

import os
from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'quipucords.settings')

# pylint: disable=invalid-name
application = get_wsgi_application()

from scanner.manager import SCAN_MANAGER  # noqa: E402 pylint: disable=C0413
from . import environment  # noqa: E402 pylint: disable=C0413

environment.startup()
SCAN_MANAGER.start()