Beispiel #1
0
 def __init__(self, stop, **kwargs):
     Thread.__init__(self, **kwargs)
     # Get config
     self.config = PullClientConfig.instance()
     # Results state cache
     self.state_path = os.path.join(self.config.Service.path,
                                    self.config.Service.state_file)
     # Instantiate DLP client
     mod_name, class_name = self.config.Dlp.client.rsplit('.', 1)
     module = importlib.import_module(mod_name)
     self.dlp_client = getattr(module, class_name)()
     # stop event for stopping the DLP poller
     self.stop = stop
     self.stop_workers = Event()
     self.start_polling = Event()
     # queues for workers
     # self.parallel_queue: wol, upload, delete steps
     # self.simple_queue: execution, inventory step
     # self.result_queue: all steps results
     self.parallel_queue = Queue()
     self.simple_queue = Queue()
     self.result_queue = Queue()
     self.retry_queue = Queue()
     for n in range(0, self.config.Poller.result_workers):
         self.workers.append(ResultWorker(self.stop_workers, self.start_polling,
                                          self.result_queue, self.retry_queue,
                                          self.dlp_client))
     # only one worker for the execution/inventory step
     self.workers.append(StepWorker(self.stop_workers, self.simple_queue, self.result_queue))
     for n in range(0, self.config.Poller.parallel_workers):
         self.workers.append(StepWorker(self.stop_workers, self.parallel_queue, self.result_queue))
     logger.info("Starting workers")
     for worker in self.workers:
         worker.start()
Beispiel #2
0
    def __init__(self, stop, **kwargs):
        Thread.__init__(self, **kwargs)
        # Get config
        self.config = PullClientConfig.instance()
        # Results state cache
        self.state_path = os.path.join(self.config.Service.path,
                                       self.config.Service.state_file)
        # Instantiate DLP client
        mod_name, class_name = self.config.Dlp.client.rsplit('.', 1)
        module = importlib.import_module(mod_name)
        self.dlp_client = getattr(module, class_name)()
        # stop event for stopping the DLP poller
        self.stop = stop
        self.stop_workers = Event()
        self.start_polling = Event()
        # queues for workers
        # self.parallel_queue: wol, upload, delete steps
        # self.simple_queue: execution, inventory step
        # self.result_queue: all steps results
        self.parallel_queue = Queue()
        self.simple_queue = Queue()
        self.result_queue = Queue()
        self.retry_queue = Queue()
        self.watchdog_queue = Queue()

        if self.config.Triggers.post_deploy_active:
            queues = QueuesContainer()
            queues.add(self.parallel_queue)
            queues.add(self.simple_queue)
            queues.add(self.result_queue)
            queues.add(self.retry_queue)
            self.workers.append(
                WatchdogWorker(
                    stop,
                    self.watchdog_queue,
                    queues,
                    self.config.Triggers.post_deploy_script,
                    self.config.Triggers.folder,
                ))

        for n in range(0, self.config.Poller.result_workers):
            self.workers.append(
                ResultWorker(self.stop_workers, self.start_polling,
                             self.result_queue, self.retry_queue,
                             self.dlp_client))
        # only one worker for the execution/inventory step
        self.workers.append(
            StepWorker(self.stop_workers, self.simple_queue, self.result_queue,
                       self.watchdog_queue))
        for n in range(0, self.config.Poller.parallel_workers):
            self.workers.append(
                StepWorker(self.stop_workers, self.parallel_queue,
                           self.result_queue, self.watchdog_queue))
        logger.info("Starting workers")
        for worker in self.workers:
            worker.start()
Beispiel #3
0
 def __init__(self):
     self.config = PullClientConfig.instance()
     HTTPClient.__init__(self, self.config.Dlp.base_url, self.config.Service.name)
     if self.config.Dlp.hostname:
         self.hostname = self.config.Dlp.hostname
     else:
         self.hostname = get_hostname()
     if self.config.Dlp.mac_list:
         self.mac_list = self.config.Dlp.mac_list
     else:
         self.mac_list = get_mac_addresses()
Beispiel #4
0
 def __init__(self):
     self.config = PullClientConfig.instance()
     HTTPClient.__init__(self, self.config.Dlp.base_url,
                         self.config.Service.name)
     if self.config.Dlp.hostname:
         self.hostname = self.config.Dlp.hostname
     else:
         self.hostname = get_hostname()
     if self.config.Dlp.mac_list:
         self.mac_list = self.config.Dlp.mac_list
     else:
         self.mac_list = get_mac_addresses()
Beispiel #5
0
 def __init__(self):
     self.stopEvent = cx_Threads.Event()
     self.pollerStop = threading.Event()
     self.config = PullClientConfig.instance()
     logging.config.fileConfig(self.config.config_file)