Beispiel #1
0
    def on_before_host_up(self, message):
        self._logger.debug('Handling on_before_host_up message')
        self.api.init_service()
        log = bus.init_op.logger
        self._init_script.stop()

        log.info('Copy default html error pages')
        self._copy_error_pages()

        log.info('Setup proxying')
        self._logger.debug('Updating main config')
        v2_mode = bool(self._proxies) or self._get_nginx_v2_mode_flag()
        self.api._update_main_config(remove_server_section=v2_mode,
                                     reload_service=False)

        if v2_mode:
            self._logger.debug('Recreating proxying with proxies:\n%s' %
                               self._proxies)
            self.api.recreate_proxying(self._proxies)
        else:
            # default behaviour
            roles_for_proxy = []
            if __nginx__['upstream_app_role']:
                roles_for_proxy = [__nginx__['upstream_app_role']]
            else:
                roles_for_proxy = get_all_app_roles()
            self.api.make_default_proxy(roles_for_proxy)

        bus.fire('service_configured',
                 service_name=SERVICE_NAME,
                 preset=self.initial_preset)
Beispiel #2
0
    def on_before_host_up(self, message):
        self._logger.debug('Handling on_before_host_up message')
        log = bus.init_op.logger
        self._init_script.stop()

        log.info('Copy default html error pages')
        self._copy_error_pages()

        log.info('Setup proxying')
        self._logger.debug('Updating main config')
        v2_mode = bool(self._proxies) or self._get_nginx_v2_mode_flag()
        self.api._update_main_config(remove_server_section=v2_mode,
                                 reload_service=False)

        if v2_mode:
            self._logger.debug('Recreating proxying with proxies:\n%s' % self._proxies)
            self.api.recreate_proxying(self._proxies)
        else:
            # default behaviour
            roles_for_proxy = []
            if __nginx__['upstream_app_role']:
                roles_for_proxy = [__nginx__['upstream_app_role']]
            else:
                roles_for_proxy = get_all_app_roles()
            self.api.make_default_proxy(roles_for_proxy)

        bus.fire('service_configured',
                 service_name=SERVICE_NAME,
                 preset=self.initial_preset)
Beispiel #3
0
    def on_VhostReconfigure(self, message):
        if not self._get_nginx_v2_mode_flag():
            self._logger.debug('updating certificates')
            cert, key, cacert = self._queryenv.get_https_certificate()
            update_ssl_certificate('', cert, key, cacert)

            self._logger.debug('before vhost reconf backend table is %s' % self.api.backend_table)
            roles_for_proxy = []
            if __nginx__['upstream_app_role']:
                roles_for_proxy = [__nginx__['upstream_app_role']]
            else:
                roles_for_proxy = get_all_app_roles()
            self.api.make_default_proxy(roles_for_proxy)
            self._logger.debug('after vhost reconf backend table is %s' % self.api.backend_table)