def read_config(prog, argv): logging.register_options(cfg.CONF) config_files = find_config('%s.conf' % prog) cfg.CONF(argv[1:], project='designate', prog=prog, default_config_files=config_files) register_plugin_opts() # Avoid circular dependency imports from designate import pool_manager pool_manager.register_dynamic_pool_options()
def export_from_config(self, file): self._startup() # Avoid circular dependency imports from designate import pool_manager pool_manager.register_dynamic_pool_options() try: pools = self.central_api.find_pools(self.context) except messaging.exceptions.MessagingTimeout: LOG.critical("No response received from designate-central. " "Check it is running, and retry") sys.exit(1) r_pools = objects.PoolList() for pool in pools: r_pool = objects.Pool.from_config(CONF, pool.id) r_pool.id = pool.id r_pool.ns_records = pool.ns_records r_pool.attributes = pool.attributes r_pools.append(r_pool) with open(file, 'w') as stream: yaml.dump(DesignateAdapter.render('YAML', r_pools), stream, default_flow_style=False)