示例#1
0
#
# Copyright (c) 2013-2016 Quarkslab.
# This file is part of IRMA project.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License in the top-level directory
# of this distribution and at:
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# No part of the project, including this file, may be copied,
# modified, propagated, or distributed except according to the
# terms contained in the LICENSE file.

import sys
import logging
from bottle import Bottle
from frontend.api.v1.base import application as app_v1
from frontend.api.v1_1.base import application as app_v1_1
from config.parser import debug_enabled, setup_debug_logger

application = Bottle()
application.mount('/v1', app_v1)
application.mount('/v1.1', app_v1_1)

if debug_enabled():
    setup_debug_logger(logging.getLogger(__name__))
示例#2
0
 def test_debug_enable_default(self):
     res = module.debug_enabled()
     self.assertFalse(res)
示例#3
0
#
# Copyright (c) 2013-2016 Quarkslab.
# This file is part of IRMA project.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License in the top-level directory
# of this distribution and at:
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# No part of the project, including this file, may be copied,
# modified, propagated, or distributed except according to the
# terms contained in the LICENSE file.

import sys
import logging
from bottle import Bottle
from frontend.api.v1.base import application as app_v1
from frontend.api.v1_1.base import application as app_v1_1
from config.parser import debug_enabled, setup_debug_logger


application = Bottle()
application.mount('/v1', app_v1)
application.mount('/v1.1', app_v1_1)


if debug_enabled():
    setup_debug_logger(logging.getLogger(__name__))
示例#4
0
 def test_debug_enable(self, m_config):
     m_config.log.debug = "debug_param"
     res = module.debug_enabled()
     self.assertEquals(res, "debug_param")
示例#5
0
from irma.common.base.utils import IrmaTaskReturn, IrmaScanRequest

RETRY_MAX_DELAY = 30

# Get celery's logger
log = get_task_logger(__name__)

scan_app = celery.Celery('scan_tasks')
config.conf_brain_celery(scan_app)
config.configure_syslog(scan_app)

interprocess_lock_path = config.get_lock_path()

# IRMA specific debug messages are enables through
# config file Section: log / Key: debug
if config.debug_enabled():
    def after_setup_logger_handler(sender=None, logger=None, loglevel=None,
                                   logfile=None, format=None,
                                   colorize=None, **kwds):
        config.setup_debug_logger(logging.getLogger(__name__))
        log.debug("debug is enabled")
    celery.signals.after_setup_logger.connect(after_setup_logger_handler)
    celery.signals.after_setup_task_logger.connect(after_setup_logger_handler)

delay = 1
while True:
    try:
        # Refresh all probes before starting
        with session_transaction() as session:
            probe_ctrl.refresh_probelist(session)
        break
示例#6
0
文件: tasks.py 项目: vaginessa/irma
from lib.irma.common.exceptions import IrmaTaskError

from probe.controllers.braintasks import register_probe
import probe.controllers.ftpctrl as ftp_ctrl

RETRY_MAX_DELAY = 30

##############################################################################
# celery application configuration
##############################################################################

log = get_task_logger(__name__)

# IRMA specific debug messages are enables through
# config file Section: log / Key: debug
if config.debug_enabled():
    def after_setup_logger_handler(sender=None, logger=None, loglevel=None,
                                   logfile=None, format=None,
                                   colorize=None, **kwds):
        config.setup_debug_logger(logging.getLogger(__name__))
        log.debug("debug is enabled")
    celery.signals.after_setup_logger.connect(after_setup_logger_handler)
    celery.signals.after_setup_task_logger.connect(after_setup_logger_handler)


# disable insecure serializer (disabled by default from 3.x.x)
if (kombu.VERSION.major) < 3:
    kombu.disable_insecure_serializers()

# declare a new Local Probe application
probe_app = Celery("probe.tasks")
示例#7
0
 def test_debug_enable_default(self):
     res = module.debug_enabled()
     self.assertFalse(res)
示例#8
0
 def test_debug_enable(self, m_config):
     m_config.log.debug = "debug_param"
     res = module.debug_enabled()
     self.assertEquals(res, "debug_param")