예제 #1
0
 def make_client(self, log):
     if self.args.conf:
         path = self.args.conf
     path = tools.find_conf()
     if path is None:
         raise ProjectNotFoundError(
             'unable to locate dataplicity.conf for project')
     client = Client(path, log=log)
     return client
예제 #2
0
    def __init__(self, conf_path=None, foreground=False, debug=False):
        self.conf_path = conf_path
        self.foreground = foreground
        self.debug = debug

        self.log = logging.getLogger('dataplicity')

        client = self.client = Client(conf_path,
                                      check_firmware=not foreground,
                                      log=self.log)
        conf = client.conf

        self.poll_rate_seconds = conf.get_float("daemon", "poll", 60.0)
        self.last_check_time = None
        self.pid_path = abspath(
            conf.get('daemon', 'pidfile', '/var/run/dataplicity.pid'))
        self.pipe_path = abspath(
            conf.get('daemon', 'pipe', '/tmp/dataplicitypipe'))

        self.server_closing_event = Event()

        # Command to execute with the daemon exits
        self.exit_command = None
        self.exit_event = Event()