Пример #1
0
def main():
    config_files = utils.find_config('designate.conf')
    checker = Checks()
    return upgradecheck.main(
        conf=designate.conf.CONF,
        project='designate',
        upgrade_command=checker,
        default_config_files=config_files,
    )
Пример #2
0
def main():
    config_files = utils.find_config('designate.conf')
    checker = Checks()
    return upgradecheck.main(
        conf=cfg.CONF,
        project='designate',
        upgrade_command=checker,
        default_config_files=config_files,
    )
Пример #3
0
    def test_find_config(self, mock_abspath, mock_path_exists):
        CONF.set_override('pybasedir', '/tmp/workspace/designate')

        mock_path_exists.side_effect = [True, False, False, False, False]
        mock_abspath.return_value = '/tmp/designate/designate.conf'

        config_files = utils.find_config('designate.conf')

        self.assertEqual(['/tmp/designate/designate.conf'], config_files)
        mock_abspath.assert_called_once()
Пример #4
0
    def _wsgi_application(self):
        api_paste_config = cfg.CONF['service:api'].api_paste_config
        config_paths = utils.find_config(api_paste_config)

        if len(config_paths) == 0:
            msg = 'Unable to determine appropriate api-paste-config file'
            raise exceptions.ConfigurationError(msg)

        LOG.info('Using api-paste-config found at: %s', config_paths[0])

        return deploy.loadapp("config:%s" % config_paths[0], name='osapi_dns')
Пример #5
0
    def _wsgi_application(self):
        api_paste_config = cfg.CONF['service:api'].api_paste_config
        config_paths = utils.find_config(api_paste_config)

        if len(config_paths) == 0:
            msg = 'Unable to determine appropriate api-paste-config file'
            raise exceptions.ConfigurationError(msg)

        LOG.info(_LI('Using api-paste-config found at: %s') % config_paths[0])

        return deploy.loadapp("config:%s" % config_paths[0], name='osapi_dns')
Пример #6
0
 def start_service(self, svc_name, *args, **kw):
     """
     override here so we can make sure central is set up correctly
     for live ipa testing
     """
     if svc_name == "central":
         self.config(backend_driver="ipa", group="service:central")
         # options in the test_config file can override the
         # defaults set elsewhere
         test_config = utils.find_config(self.test_config_file_name)
         self.CONF([], project="designate", default_config_files=test_config)
     return super(CentralServiceTestIPA, self).start_service(svc_name, *args, **kw)
Пример #7
0
 def start_service(self, svc_name, *args, **kw):
     """
     override here so we can make sure central is set up correctly
     for live ipa testing
     """
     if svc_name == 'central':
         self.config(backend_driver='ipa', group='service:central')
         # options in the test_config file can override the
         # defaults set elsewhere
         test_config = utils.find_config(self.test_config_file_name)
         self.CONF([], project='designate',
                   default_config_files=test_config)
     return super(CentralServiceTestIPA, self).start_service(svc_name,
                                                             *args, **kw)
Пример #8
0
def init_policy():
    LOG.info('Initializing Policy')

    policy_files = utils.find_config(cfg.CONF.policy_file)

    if len(policy_files) == 0:
        msg = 'Unable to determine appropriate policy json file'
        raise exceptions.ConfigurationError(msg)

    LOG.info('Using policy_file found at: %s' % policy_files[0])

    with open(policy_files[0]) as fh:
        policy_json = fh.read()

    rules = policy.Rules.load_json(policy_json, cfg.CONF.policy_default_rule)

    policy.set_rules(rules)
Пример #9
0
def init_policy():
    LOG.info("Initializing Policy")

    policy_files = utils.find_config(cfg.CONF.policy_file)

    if len(policy_files) == 0:
        msg = "Unable to determine appropriate policy json file"
        raise exceptions.ConfigurationError(msg)

    LOG.info("Using policy_file found at: %s" % policy_files[0])

    with open(policy_files[0]) as fh:
        policy_json = fh.read()

    rules = policy.Rules.load_json(policy_json, cfg.CONF.policy_default_rule)

    policy.set_rules(rules)
Пример #10
0
def find_server_sections():
    """
    Find the server specific backend section names.

    A server specific backend section name is:

    [backend:<backend_driver>:<server_id>]
    """
    config_files = utils.find_config('designate.conf')

    all_sections = []
    for filename in config_files:
        sections = SectionNameParser.find_sections(
            filename, SECTION_PATTERN, SECTION_LABELS)
        all_sections.extend(sections)

    return all_sections
Пример #11
0
def init(default_rule=None):
    policy_files = utils.find_config(CONF['oslo_policy'].policy_file)

    if len(policy_files) == 0:
        msg = 'Unable to determine appropriate policy json file'
        raise exceptions.ConfigurationError(msg)

    LOG.info(_LI('Using policy_file found at: %s'), policy_files[0])

    with open(policy_files[0]) as fh:
        policy_string = fh.read()
    rules = policy.Rules.load_json(policy_string, default_rule=default_rule)

    global _ENFORCER
    if not _ENFORCER:
        LOG.debug("Enforcer is not present, recreating.")
        _ENFORCER = policy.Enforcer(CONF)

    _ENFORCER.set_rules(rules)
Пример #12
0
    def __init__(self, backlog=128, threads=1000):

        api_paste_config = cfg.CONF['service:api'].api_paste_config
        config_paths = utils.find_config(api_paste_config)

        if len(config_paths) == 0:
            msg = 'Unable to determine appropriate api-paste-config file'
            raise exceptions.ConfigurationError(msg)

        LOG.info(_LI('Using api-paste-config found at: %s') % config_paths[0])

        application = deploy.loadapp("config:%s" % config_paths[0],
                                     name='osapi_dns')

        super(Service, self).__init__(application=application,
                                      host=cfg.CONF['service:api'].api_host,
                                      port=cfg.CONF['service:api'].api_port,
                                      backlog=backlog,
                                      threads=threads)
Пример #13
0
    def __init__(self, backlog=128, threads=1000):

        api_paste_config = cfg.CONF['service:api'].api_paste_config
        config_paths = utils.find_config(api_paste_config)

        if len(config_paths) == 0:
            msg = 'Unable to determine appropriate api-paste-config file'
            raise exceptions.ConfigurationError(msg)

        LOG.info(_LI('Using api-paste-config found at: %s') % config_paths[0])

        policy.init()

        application = deploy.loadapp("config:%s" % config_paths[0],
                                     name='osapi_dns')

        super(Service, self).__init__(application=application,
                                      host=cfg.CONF['service:api'].api_host,
                                      port=cfg.CONF['service:api'].api_port,
                                      backlog=backlog,
                                      threads=threads)
Пример #14
0
def load_config(filename):
    config_files = find_config('%s.conf' % 'designate')
    cfg.CONF(args=[],
             project='designate',
             prog=PROG,
             default_config_files=config_files)
Пример #15
0
def load_config(filename):
    config_files = find_config('%s.conf' % 'designate')
    cfg.CONF(args=[], project='designate', prog=PROG,
             default_config_files=config_files)