mirror of
https://github.com/puppetlabs/vmpooler.git
synced 2026-01-26 01:58:41 -05:00
Ensure all configured providers are loaded
Prior to this, providers that should have been loaded per the provider_class key of the providers hash were not actually loaded.
This commit is contained in:
parent
7872bfe8fc
commit
45378d46b9
2 changed files with 93 additions and 2 deletions
|
|
@ -619,8 +619,21 @@ module Vmpooler
|
|||
# @return [Array] - a list of used providers from the config file, defaults to the default providers
|
||||
# ie. ["dummy"]
|
||||
def used_providers
|
||||
pools = config[:pools] || []
|
||||
@used_providers ||= (pools.map { |pool| pool[:provider] || pool['provider'] }.compact + default_providers).uniq
|
||||
# create an array of provider classes based on the config
|
||||
if config[:providers]
|
||||
config_provider_names = config[:providers].keys
|
||||
config_providers = config_provider_names.map do |config_provider_name|
|
||||
if config[:providers][config_provider_name] && config[:providers][config_provider_name]['provider_class']
|
||||
config[:providers][config_provider_name]['provider_class'].to_s
|
||||
else
|
||||
config_provider_name.to_s
|
||||
end
|
||||
end.compact.uniq
|
||||
else
|
||||
config_providers = []
|
||||
end
|
||||
# return the unique array of providers from the config and VMPooler defaults
|
||||
@used_providers ||= (config_providers + default_providers).uniq
|
||||
end
|
||||
|
||||
# @return [Array] - returns a list of providers that should always be loaded
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue