Esempio n. 1
0
    def __init__(self):
        Class.__init__(self, None)

        self.log_dir = "%(HOME)s/logs" % os.environ
        self.log_thread = LogThread(directory=self.log_dir, prefix="forwarder", note="Forwarder", name="LogThread")
        self.log_thread.start()

        self.log_queue = self.log_thread.queue
        self.log = self._log # log method

        self.delay = 60 # seconds
        self.host = "10.0.0.222"
        self.port = 22  
        self.username = "******"
        self.password = "******"

        self.forwards = [
            {   "reverse" : False,
                "proxy"   : ("10.0.0.222", 22),
                "bind"    : ("127.0.0.1", 2222),
                "target"  : ("127.0.0.1", 22),
            },
            {   "reverse" : True,
                "proxy"   : ("10.0.0.222", 22),
                "bind"    : ("127.0.0.1", 2222),
                "target"  : ("127.0.0.1", 22),
            },
        ]
Esempio n. 2
0
 def __init__(self):
     Class.__init__(self)
     self.context = {}
     self.context['log'] = LogThread(prefix='update_', note='UPDATE', pid=True)
     self.context['log'].start()
     self.log_queue = self.context['log'].queue
     self.metadata_path = ''
     self.archive_path = ''
    def __init__(self):
        Class.__init__(self)
        signal.signal(signal.SIGTERM, self.halt_now)

        self.running = False
        self.threads = {}
        self.thread_order = []

        self.add_thread('log', LogThread(prefix='processes_', note='PROCESSES', pid=True))
        self.t('log').start()
        self.log_queue = self.t('log').queue

        self.already_running = False
    def __init__(self, master, bind_port, bind_ip, log_queue=None):
        asyncore.dispatcher.__init__(self)
        Class.__init__(self, log_queue=log_queue)
        self.create_socket(socket.AF_INET, socket.SOCK_DGRAM)
        try:
            self.bind((bind_ip, bind_port))
        except:
            raise Exception("Failed to bind to control port %d" % bind_port)
        i,p = self.getsockname()
        self._log("%s bound to %s:%d" % (self.__class__.__name__,i,p))
        self._master = master
        self._regex_status = re.compile('^\[(.*)\]<(.*)>$')

        self._request_queue = Queue.Queue()
        self._reply_queue = Queue.Queue()
        self._awaiting_reply = {}
    def __init__(self):
        Class.__init__(self)

        self._handle = None