diff --git a/lib/vmpooler.rb b/lib/vmpooler.rb index af51436..8b86fdb 100644 --- a/lib/vmpooler.rb +++ b/lib/vmpooler.rb @@ -81,16 +81,13 @@ module Vmpooler parsed_config[:config]['retry_factor'] = string_to_int(ENV['RETRY_FACTOR']) if ENV['RETRY_FACTOR'] parsed_config[:config]['create_folders'] = true?(ENV['CREATE_FOLDERS']) if ENV['CREATE_FOLDERS'] parsed_config[:config]['experimental_features'] = ENV['EXPERIMENTAL_FEATURES'] if ENV['EXPERIMENTAL_FEATURES'] - parsed_config[:config]['purge_unconfigured_resources'] = ENV['PURGE_UNCONFIGURED_RESOURCES'] if ENV['PURGE_UNCONFIGURED_RESOURCES'] - # ENV PURGE_UNCONFIGURED_FOLDERS deprecated, will be removed in version 3 - if ENV['PURGE_UNCONFIGURED_FOLDERS'] - puts '[!] [deprecation] rename ENV var \'PURGE_UNCONFIGURED_FOLDERS\' to \'PURGE_UNCONFIGURED_RESOURCES\'' - # backwards compatibility - parsed_config[:config]['purge_unconfigured_resources'] = ENV['PURGE_UNCONFIGURED_FOLDERS'] - end parsed_config[:config]['usage_stats'] = ENV['USAGE_STATS'] if ENV['USAGE_STATS'] parsed_config[:config]['request_logger'] = ENV['REQUEST_LOGGER'] if ENV['REQUEST_LOGGER'] parsed_config[:config]['create_template_delta_disks'] = ENV['CREATE_TEMPLATE_DELTA_DISKS'] if ENV['CREATE_TEMPLATE_DELTA_DISKS'] + parsed_config[:config]['purge_unconfigured_resources'] = ENV['PURGE_UNCONFIGURED_RESOURCES'] if ENV['PURGE_UNCONFIGURED_RESOURCES'] + parsed_config[:config]['purge_unconfigured_resources'] = ENV['PURGE_UNCONFIGURED_FOLDERS'] if ENV['PURGE_UNCONFIGURED_FOLDERS'] + # ENV PURGE_UNCONFIGURED_FOLDERS deprecated, will be removed in version 3 + puts '[!] [deprecation] rename ENV var \'PURGE_UNCONFIGURED_FOLDERS\' to \'PURGE_UNCONFIGURED_RESOURCES\'' if ENV['PURGE_UNCONFIGURED_FOLDERS'] set_linked_clone(parsed_config) parsed_config[:redis] = parsed_config[:redis] || {} diff --git a/lib/vmpooler/providers/base.rb b/lib/vmpooler/providers/base.rb index 1468cf8..e8f093d 100644 --- a/lib/vmpooler/providers/base.rb +++ b/lib/vmpooler/providers/base.rb @@ -243,9 +243,9 @@ module Vmpooler # DEPRECATED if a provider does not implement the new method, it will hit this base class method # and return a deprecation message - def purge_unconfigured_folders(_deprecated, _deprecated2, whitelist) + def purge_unconfigured_folders(_deprecated, _deprecated2, allowlist) logger.log('s', '[!] purge_unconfigured_folders was renamed to purge_unconfigured_resources, please update your provider implementation') - purge_unconfigured_resources(whitelist) + purge_unconfigured_resources(allowlist) end end end diff --git a/spec/unit/pool_manager_spec.rb b/spec/unit/pool_manager_spec.rb index 5727d7d..7f00eb7 100644 --- a/spec/unit/pool_manager_spec.rb +++ b/spec/unit/pool_manager_spec.rb @@ -1144,14 +1144,14 @@ EOT it 'should run purge_unconfigured_resources' do expect(provider).to receive(:purge_unconfigured_resources).with(allowlist) - expect(provider).to receive(:provider_config).and_return({}) + expect(provider).to receive(:provider_config).and_return({}).twice subject.purge_vms_and_resources(provider_name) end it 'should raise any errors' do expect(provider).to receive(:purge_unconfigured_resources).with(allowlist).and_raise('mockerror') - expect(provider).to receive(:provider_config).and_return({}) + expect(provider).to receive(:provider_config).and_return({}).twice expect{ subject.purge_vms_and_resources(provider_name) }.to raise_error(RuntimeError, 'mockerror') end