Remove global domain usage from pool manager

This commit is contained in:
Jake Spain 2023-02-16 07:47:42 -05:00
parent 268ff9f981
commit aeabb7e134
No known key found for this signature in database
GPG key ID: BC1C4DA0A085E113
2 changed files with 25 additions and 9 deletions

View file

@ -30,6 +30,26 @@ module Vmpooler
plugin_class
end
# Returns the domain for the specified pool
#
# @param config [String] - the full config structure
# @param pool_name [String] - the name of the pool
# @return [String] - domain name for pool, which is set via reference to the dns_configs block
def self.get_domain_for_pool(config, pool_name)
pool = config[:pools].find { |p| p['name'] == pool_name }
pool_dns_config = pool['dns_plugin']
dns_configs = config[:dns_configs].keys
pool_domain = ''
dns_configs.map do |dns_config_name|
if dns_config_name.to_s == pool_dns_config
pool_domain = config[:dns_configs][dns_config_name]['domain']
end
end
pool_domain
end
# Returns the plugin domain for the specified dns config by name
#
# @param config [Object] The entire VMPooler config object