(POOLER-157) Add extra_config option to vmpooler

This commit adds the extra_config option to vmpooler to allow specifying additional configuration files to load from. Without this change vmpooler does not offer a mechanism to provide additional configuration files for the application.
This commit is contained in:
kirby@puppetlabs.com 2020-03-04 16:35:52 -08:00
parent dfa2f8620a
commit 8bb89b604d
5 changed files with 27 additions and 5 deletions

View file

@ -27,6 +27,14 @@ module Vmpooler
# Take the name of the config file either from an ENV variable or from the filepath argument
config_file = ENV['VMPOOLER_CONFIG_FILE'] || filepath
parsed_config = YAML.load_file(config_file) if File.exist? config_file
parsed_config[:config]['extra_config'] = ENV['EXTRA_CONFIG'] if ENV['EXTRA_CONFIG']
if parsed_config[:config]['extra_config']
extra_configs = parsed_config[:config]['extra_config'].split(',')
extra_configs.each do |config|
extra_config = YAML.load_file(config)
parsed_config.merge!(extra_config)
end
end
end
parsed_config ||= { config: {} }