Esempio n. 1
0
File: start.py Progetto: znavy/zato
 def run_check_config(self):
     cc = CheckConfig(self.args)
     cc.show_output = False
     cc.execute(
         Bunch(path='.',
               ensure_no_pidfile=True,
               check_server_port_available=True))
Esempio n. 2
0
    def _on_server(self, show_output=True, *ignored):

        server_conf = ConfigObj(os.path.join(self.config_dir, 'repo', 'server.conf'))
        port = server_conf['main']['gunicorn_bind'].split(':')[1]
        server_prefix = '{0}'.format(port).zfill(5)

        socket_name = 'server-{0}.sock'.format(server_prefix)
        socket_name = os.path.join(self.config_dir, 'zdaemon', socket_name)

        # If we have a socket of that name then we already have a running
        # server, in which case we refrain from starting new processes now.
        if os.path.exists(socket_name):
            msg = 'Server at {0} is already running'.format(self.component_dir)
            self.logger.info(msg)
            return self.SYS_ERROR.COMPONENT_ALREADY_RUNNING

        cc = CheckConfig(self.args)
        cc.show_output = False
        cc.execute(Bunch(path='.'))

        zdaemon_conf_name = 'zdaemon-{0}.conf'.format(port)
        socket_prefix = 'server-{0}'.format(port)
        program = '{} -m zato.server.main {}'.format(get_executable(), self.component_dir)
        logfile_path_prefix = 'zdaemon-{}'.format(port)

        self._zdaemon_start(zdaemon_conf_name_contents, zdaemon_conf_name, socket_prefix,
                            logfile_path_prefix, program)

        if self.show_output:
            if self.verbose:
                self.logger.debug('Zato server at {0} has been started'.format(self.component_dir))
            else:
                self.logger.info('OK')
Esempio n. 3
0
 def run_check_config(self):
     cc = CheckConfig(self.args)
     cc.show_output = False
     cc.execute(Bunch({
         'path': '.',
         'ensure_no_pidfile': True,
         'check_server_port_available': True,
         'stdin_data': self.stdin_data,
         'secret_key': self.args.secret_key,
     }))
Esempio n. 4
0
 def run_check_config(self):
     cc = CheckConfig(self.args)
     cc.show_output = False
     cc.execute(Bunch(path='.', ensure_no_pidfile=True, check_server_port_available=True))
Esempio n. 5
0
 def run_check_config(self):
     cc = CheckConfig(self.args)
     cc.show_output = False
     cc.execute(Bunch(path='.'))