Ejemplo n.º 1
0
    def __init__(self, vhost, host, port, username, password):
        """
        @type vhost: C{str}
        @param vhost: amqp vhost

        @type host: C{str}
        @param host: amqp host

        @type port: C{int}
        @param port: amqp port

        @type username: C{str}
        @param username: amqp username

        @type password: C{str}
        @param password: amqp password
        """
        self.log = get_logger_adapter(__name__)
        self._vhost = vhost
        self._host = host
        self._port = port
        self._username = username
        self._password = password
        self.channel = None
        self.connect()
Ejemplo n.º 2
0
    def __init__(self, vhost, host, port, username, password):
        """
        @type vhost: C{str}
        @param vhost: amqp vhost

        @type host: C{str}
        @param host: amqp host

        @type port: C{int}
        @param port: amqp port

        @type username: C{str}
        @param username: amqp username

        @type password: C{str}
        @param password: amqp password
        """
        self.log = get_logger_adapter(__name__)
        self._vhost = vhost
        self._host = host
        self._port = port
        self._username = username
        self._password = password
        self.channel = None
        self.connect()
Ejemplo n.º 3
0
 def __init__(self, command, soft_timeout=0, hard_timeout=0, wrapper=""):
     """
     Command is the execution command as a string.
     soft_timeout is timeout after which normal kill signal is sent.
     hard_timeout is timeout after kill -9 is sent.
     wrapper is a string with %s where the command will go
     """
     self.log = get_logger_adapter(__name__)
     self.command = command
     if wrapper:
         self.command = wrapper % command
     self.soft_timeout = float(soft_timeout)
     self.hard_timeout = float(hard_timeout)
     self.return_value = None
     self.stdout = ""
     self.stderr = ""
     self.execution_time = - 1
     self.pid = - 1
     self.soft_timeout_occured = False
     self.hard_timeout_occured = False
     self.process = None
     self.start_time = None
     self.expected_returnvalue = 0
     self.soft_timer = None
     self.hard_timer = None
Ejemplo n.º 4
0
 def __init__(self, command, soft_timeout=0, hard_timeout=0, wrapper=""):
     """
     Command is the execution command as a string.
     soft_timeout is timeout after which normal kill signal is sent.
     hard_timeout is timeout after kill -9 is sent.
     wrapper is a string with %s where the command will go
     """
     self.log = get_logger_adapter(__name__)
     self.command = command
     if wrapper:
         self.command = wrapper % command
     self.soft_timeout = float(soft_timeout)
     self.hard_timeout = float(hard_timeout)
     self.return_value = None
     self.stdout = ""
     self.stderr = ""
     self.execution_time = -1
     self.pid = -1
     self.soft_timeout_occured = False
     self.hard_timeout_occured = False
     self.process = None
     self.start_time = None
     self.expected_returnvalue = 0
     self.soft_timer = None
     self.hard_timer = None
Ejemplo n.º 5
0
    def __init__(self, server_host, testrun_id, response_queue=None):
        self.log = get_logger_adapter(__name__)
        self.host = server_host
        self.testrun_id = testrun_id
        self.conn = None
        self.channel = None

        if response_queue:
            self.response_queue = response_queue
        else:
            self.response_queue = testrun_queue_name(testrun_id)
Ejemplo n.º 6
0
    def __init__(self, server_host, testrun_id, response_queue=None):
        self.log = get_logger_adapter(__name__)
        self.host = server_host
        self.testrun_id = testrun_id
        self.conn = None
        self.channel = None

        if response_queue:
            self.response_queue = response_queue
        else:
            self.response_queue = testrun_queue_name(testrun_id)
Ejemplo n.º 7
0
 def __init__(self, vhost,
                    host,
                    port,
                    username,
                    password,
                    properties,
                    device_n=0):
     """
     Initialise the class, read config, set up logging
     """
     self._vhost = vhost
     self._host = host
     self._port = port
     self._username = username
     self._password = password
     self._properties = properties
     self._timeout = None
     self._device_n = device_n
     self.log = get_logger_adapter(__name__)
Ejemplo n.º 8
0
 def __init__(self,
              vhost,
              host,
              port,
              username,
              password,
              properties,
              device_n=0):
     """
     Initialise the class, read config, set up logging
     """
     self._vhost = vhost
     self._host = host
     self._port = port
     self._username = username
     self._password = password
     self._properties = properties
     self._timeout = None
     self._device_n = device_n
     self.log = get_logger_adapter(__name__)
Ejemplo n.º 9
0
    def __init__(self, connection, device_properties):
        """
        device_properties have magic keys that
        are dependent on the rules set out 
        in ots.common.routing.routing 

        @type connection : L{ots.worker.connection.Connection} 
        @param connection : The connection 

        @type device_properties : C{dict}
        @param device_properties : The device_properties
        """
        self._log = get_logger_adapter(__name__)
        self._connection = connection
        self._queues = get_queues(device_properties)
        self._keep_looping = True
        self._consumer_tags = dict()

        self._task_state = cycle(TASK_CONDITION_RESPONSES)
        self._amqp_log_handler = None
        self._xml_file = None
Ejemplo n.º 10
0
    def __init__(self, connection, device_properties):
        """
        device_properties have magic keys that
        are dependent on the rules set out 
        in ots.common.routing.routing 

        @type connection : L{ots.worker.connection.Connection} 
        @param connection : The connection 

        @type device_properties : C{dict}
        @param device_properties : The device_properties
        """
        self._log = get_logger_adapter(__name__)
        self._connection = connection
        self._queues = get_queues(device_properties)
        self._keep_looping = True
        self._consumer_tags = dict()

        self._task_state = cycle(TASK_CONDITION_RESPONSES)
        self._amqp_log_handler = None
        self._xml_file = None
Ejemplo n.º 11
0
from ots.worker.conductor.helpers import parse_list, \
                                         parse_config

from ots.worker.conductor.conductor_config import DEBUG_LOG_FILE
from ots.worker.conductor.conductor_config import HTTP_LOGGER_PATH
from ots.worker.conductor.executor import TestRunData
from ots.worker.conductor.executor import Executor
from ots.worker.conductor.conductorerror import ConductorError
from ots.worker.api import ResponseClient
from ots.common.helpers import get_logger_adapter
from ots.common.framework.flasher_plugin_base import FlashFailed

DEFAULT_CONFIG = "/etc/ots/conductor.conf"
OPT_CONF_SUFFIX = ".conf"
LOG = get_logger_adapter("conductor")


class ExecutorSignalHandler(object):
    """Signal handler to catch signals from testrunner-lite"""

    def __init__(self, executor):
        """
        Initialization

        @type command: C{obj}
        @param command: Executor
        """
        self._executor = executor

    def reboot_device(self, sig_num, frame):
Ejemplo n.º 12
0
from ots.worker.conductor.helpers import parse_list, \
                                         parse_config

from ots.worker.conductor.conductor_config import DEBUG_LOG_FILE
from ots.worker.conductor.conductor_config import HTTP_LOGGER_PATH
from ots.worker.conductor.executor import TestRunData
from ots.worker.conductor.executor import Executor
from ots.worker.conductor.conductorerror import ConductorError
from ots.worker.api import ResponseClient
from ots.common.helpers import get_logger_adapter
from ots.common.framework.flasher_plugin_base import FlashFailed

DEFAULT_CONFIG = "/etc/ots/conductor.conf"
OPT_CONF_SUFFIX = ".conf"
LOG = get_logger_adapter("conductor")


class ExecutorSignalHandler(object):
    """Signal handler to catch signals from testrunner-lite"""
    def __init__(self, executor):
        """
        Initialization

        @type command: C{obj}
        @param command: Executor
        """
        self._executor = executor

    def reboot_device(self, sig_num, frame):
        """
Ejemplo n.º 13
0
from ots.common.framework.api import ConductorPluginBase
from ots.common.command import Command
from ots.common.command import SoftTimeoutException
from ots.common.command import HardTimeoutException
from ots.common.command import CommandFailed
from ots.worker.conductor.conductor_config import HW_COMMAND
from ots.common.helpers import get_logger_adapter

DEFAULT_CONFIG_FILE = "/etc/ots/plugins/conductor_richcore.conf"
RICH_CORE_FILE_SUFFIX = ".rcore.lzo"
COPY_RICHCORE_TO_PROCESSING_QUEUE = "ssh %s@%s mkdir %s; scp %s %s@%s:%s"
COPY_LOCAL_FILE_TO_REMOTE = "scp %s %s@%s:%s"
DEBUG_PACKAGE_LIST_FILE_NAME = "%s_debug_package_list"
GET_BUILD_ID_COMMAND = "grep \"BUILD\" /etc/meego-release | cut -d\  -f 2"
LOG = get_logger_adapter(__name__)


class RichCorePlugin(ConductorPluginBase):
    """
    OTS conductor plugin for rich-core processing.
    """

    def __init__(self, options):

        self.process_rich_core_dumps = options.save_rich_core_dumps
        self.result_dir = ""
        self.target = None
        self.target_username = options.target_username
        self.target_ip_address = options.target_ip_address
        self.host_ip_address = options.host_ip_address
Ejemplo n.º 14
0
from ots.common.framework.api import ConductorPluginBase
from ots.common.command import Command
from ots.common.command import SoftTimeoutException
from ots.common.command import HardTimeoutException
from ots.common.command import CommandFailed
from ots.worker.conductor.conductor_config import HW_COMMAND
from ots.common.helpers import get_logger_adapter

DEFAULT_CONFIG_FILE = "/etc/ots/plugins/conductor_richcore.conf"
RICH_CORE_FILE_SUFFIX = ".rcore.lzo"
COPY_RICHCORE_TO_PROCESSING_QUEUE = "ssh %s@%s mkdir %s; scp %s %s@%s:%s"
COPY_LOCAL_FILE_TO_REMOTE = "scp %s %s@%s:%s"
DEBUG_PACKAGE_LIST_FILE_NAME = "%s_debug_package_list"
GET_BUILD_ID_COMMAND = "grep \"BUILD\" /etc/meego-release | cut -d\  -f 2"
LOG = get_logger_adapter(__name__)


class RichCorePlugin(ConductorPluginBase):
    """
    OTS conductor plugin for rich-core processing.
    """
    def __init__(self, options):

        self.process_rich_core_dumps = options.save_rich_core_dumps
        self.result_dir = ""
        self.target = None
        self.target_username = options.target_username
        self.target_ip_address = options.target_ip_address
        self.host_ip_address = options.host_ip_address
        self.config = self.config_file()
Ejemplo n.º 15
0
 def __init__(self, testrun):
     self.log = get_logger_adapter("conductor")
     self.testrun = testrun
     self.config = testrun.config
Ejemplo n.º 16
0
 def __init__(self, testrun):
     self.log = get_logger_adapter("conductor")
     self.testrun = testrun
     self.config = testrun.config