Beispiel #1
0
from fabric.context_managers import settings, hide
from tcutils.fabutils import remote_cmd

try:
    # Running from the source repo "test".
    from tcutils.pkgs.Traffic.traffic.core.profile import *
    from tcutils.pkgs.Traffic.traffic.utils.logger import LOGGER, get_logger
    from tcutils.pkgs.Traffic.traffic.utils.globalvars import LOG_LEVEL
except ImportError:
    # Distributed and installed as package
    from traffic.core.profile import *
    from traffic.utils.logger import LOGGER, get_logger
    from traffic.utils.globalvars import LOG_LEVEL

LOGGER = "%s.core.helper" % LOGGER
LOG = get_logger(name=LOGGER, level=LOG_LEVEL)


class SSHError(Exception):
    pass


class Host(object):
    """Stores the credentials of a host.
    """
    def __init__(self, ip, user="******", password="******", key=None):
        self.ip = ip
        self.user = user
        self.password = password
        self.key = key
Beispiel #2
0
"""
import os
import sys
import time
import atexit
from signal import SIGTERM

try:
    # Running from the source repo "test".
    from tcutils.pkgs.Traffic.traffic.utils.logger import LOGGER, get_logger
except ImportError:
    # Distributed and installed as package
    from traffic.utils.logger import LOGGER, get_logger

LOGGER = "%s.core.listener" % LOGGER
log = get_logger(name=LOGGER)


class Daemon(object):
    """
    A generic daemon class.
    
    Usage: subclass the Daemon class and override the run() method
    """
    def __init__(self,
                 pidfile,
                 stdin='/dev/null',
                 stdout='/dev/null',
                 stderr='/dev/null'):
        self.stdin = stdin
        self.stdout = stdout
Beispiel #3
0
from tcutils.util import run_fab_cmd_on_node

try:
    # Running from the source repo "test".
    from tcutils.pkgs.Traffic.traffic.core.profile import *
    from tcutils.pkgs.Traffic.traffic.utils.logger import LOGGER, get_logger
    from tcutils.pkgs.Traffic.traffic.utils.globalvars import LOG_LEVEL
except ImportError:
    # Distributed and installed as package
    from traffic.core.profile import *
    from traffic.utils.logger import LOGGER, get_logger
    from traffic.utils.globalvars import LOG_LEVEL


LOGGER = "%s.core.helper" % LOGGER
LOG = get_logger(name=LOGGER, level=LOG_LEVEL)


class SSHError(Exception):
    pass


class Host(object):

    """Stores the credentials of a host.
    """

    def __init__(self, ip, user="******", password="******", key=None):
        self.ip = ip
        self.user = user
        self.password = password
Beispiel #4
0
"""
import os
import sys
import time
import atexit
from signal import SIGTERM

try:
    # Running from the source repo "test".
    from tcutils.pkgs.Traffic.traffic.utils.logger import LOGGER, get_logger
except ImportError:
    # Distributed and installed as package
    from traffic.utils.logger import LOGGER, get_logger

LOGGER = "%s.core.listener" % LOGGER
log = get_logger(name=LOGGER)


class Daemon(object):

    """
    A generic daemon class.
    
    Usage: subclass the Daemon class and override the run() method
    """

    def __init__(self, pidfile, stdin='/dev/null', stdout='/dev/null', stderr='/dev/null'):
        self.stdin = stdin
        self.stdout = stdout
        self.stderr = stderr
        self.pidfile = pidfile