Beispiel #1
0
    def write_genapi_base_tpl(self, python_interpreter, genapi_start, logging_level, riak_host, riak_port, app_port,
                              genapi_api_id, genapi_version, genapi_env, genapi_entity_list, genapi_api_key,
                              genapi_home_directory, genapi_user, genapi_log_file, config_file_name):
        """
            Write a configuration file for a given API that will be readable by supervisord.
        """
        template = self.load_template(self.BASE_TEMPLATE)
        tpl = template.render(
            genapi_api_id=genapi_api_id,
            python_interpreter=python_interpreter,
            genapi_start=genapi_start,
            logging_level=logging_level,
            riak_host=riak_host,
            riak_port=riak_port,
            app_port=app_port,
            genapi_version=genapi_version,
            genapi_env=genapi_env,
            genapi_entity_list=self.entity_list_as_csv(genapi_entity_list),
            genapi_api_key=genapi_api_key,
            genapi_home_directory=genapi_home_directory,
            genapi_user=genapi_user,
            genapi_log_file=genapi_log_file
        )

        logging.debug("Writing template: {}".format(tpl))
        filesystem_service.write_file(filename=config_file_name, content=tpl)
        logging.info('Supervisor configuration file written for API with id: {}'.format(genapi_api_id))
Beispiel #2
0
    def write_genapi_frontends_tpl(self, config_file_name, api_id):
        """
            Write the haproxy backends part for an already deployed API in order to
            create the routing (part 1) on the loadbalancer.
        """
        template = self.load_template(self.FRONTENDS_TEMPLATE)
        tpl = template.render(api_id=api_id)
        logging.debug("Writing template: {}".format(tpl))
        filesystem_service.write_file(filename=config_file_name, content=tpl)

        logging.info('Loadbalancer (haproxy) FRONTENDS configuration written for API with id: {}'.format(api_id))