From 056a1db5782709855b02bb47769a06457b03bae4 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Tue, 2 Nov 2021 13:14:28 +0900 Subject: [PATCH] Remove deprecated oslo_config ... because it was deprecated a while ago[1], and has not been used actually. [1] 6cd2bc408d55c7bdaf43013e1a2c0a1c4fd1fa9e Change-Id: Ida5525f6d66145cbadc7ab5407b559b12b101a76 --- .../provider/oslo_config/ini_setting.rb | 15 ---- lib/puppet/type/oslo_config.rb | 53 --------------- metadata.json | 4 -- .../remove-oslo_config-ee4c8b63e4226a46.yaml | 4 ++ .../provider/oslo_config/ini_setting_spec.rb | 68 ------------------- spec/unit/type/oslo_config_spec.rb | 64 ----------------- 6 files changed, 4 insertions(+), 204 deletions(-) delete mode 100644 lib/puppet/provider/oslo_config/ini_setting.rb delete mode 100644 lib/puppet/type/oslo_config.rb create mode 100644 releasenotes/notes/remove-oslo_config-ee4c8b63e4226a46.yaml delete mode 100644 spec/unit/provider/oslo_config/ini_setting_spec.rb delete mode 100644 spec/unit/type/oslo_config_spec.rb diff --git a/lib/puppet/provider/oslo_config/ini_setting.rb b/lib/puppet/provider/oslo_config/ini_setting.rb deleted file mode 100644 index 9661eea..0000000 --- a/lib/puppet/provider/oslo_config/ini_setting.rb +++ /dev/null @@ -1,15 +0,0 @@ -Puppet::Type.type(:oslo_config).provide( - :ini_setting, - :parent => Puppet::Type.type(:openstack_config).provider(:ini_setting) -) do - - def create - super - warning('oslo_config is deprecated, and will be removed in a future release') - end - - def self.file_path - '/etc/oslo/oslo.conf' - end - -end diff --git a/lib/puppet/type/oslo_config.rb b/lib/puppet/type/oslo_config.rb deleted file mode 100644 index 0fd9196..0000000 --- a/lib/puppet/type/oslo_config.rb +++ /dev/null @@ -1,53 +0,0 @@ -Puppet::Type.newtype(:oslo_config) do - - ensurable - - newparam(:name, :namevar => true) do - desc 'Section/setting name to manage from oslo.conf' - newvalues(/\S+\/\S+/) - end - - newproperty(:value) do - desc 'The value of the setting to be defined.' - munge do |value| - value = value.to_s.strip - value.capitalize! if value =~ /^(true|false)$/i - value - end - newvalues(/^[\S ]*$/) - - def is_to_s( currentvalue ) - if resource.secret? - return '[old secret redacted]' - else - return currentvalue - end - end - - def should_to_s( newvalue ) - if resource.secret? - return '[new secret redacted]' - else - return newvalue - end - end - end - - newparam(:secret, :boolean => true) do - desc 'Whether to hide the value from Puppet logs. Defaults to `false`.' - - newvalues(:true, :false) - - defaultto false - end - - newparam(:ensure_absent_val) do - desc 'A value that is specified as the value property will behave as if ensure => absent was specified' - defaultto('') - end - - autorequire(:package) do - 'oslo' - end - -end diff --git a/metadata.json b/metadata.json index bebcb0e..99389be 100644 --- a/metadata.json +++ b/metadata.json @@ -1,10 +1,6 @@ { "author": "OpenStack Contributors", "dependencies": [ - { - "name": "puppetlabs/inifile", - "version_requirement": ">=2.0.0 <3.0.0" - }, { "name": "puppetlabs/stdlib", "version_requirement": ">=5.0.0 <9.0.0" diff --git a/releasenotes/notes/remove-oslo_config-ee4c8b63e4226a46.yaml b/releasenotes/notes/remove-oslo_config-ee4c8b63e4226a46.yaml new file mode 100644 index 0000000..2f4ed99 --- /dev/null +++ b/releasenotes/notes/remove-oslo_config-ee4c8b63e4226a46.yaml @@ -0,0 +1,4 @@ +--- +upgrade: + - | + The ``oslo_config`` resource has been removed. diff --git a/spec/unit/provider/oslo_config/ini_setting_spec.rb b/spec/unit/provider/oslo_config/ini_setting_spec.rb deleted file mode 100644 index 6278391..0000000 --- a/spec/unit/provider/oslo_config/ini_setting_spec.rb +++ /dev/null @@ -1,68 +0,0 @@ -# -# these tests are a little concerning b/c they are hacking around the -# modulepath, so these tests will not catch issues that may eventually arise -# related to loading these plugins. -# I could not, for the life of me, figure out how to programatcally set the modulepath -$LOAD_PATH.push( - File.join( - File.dirname(__FILE__), - '..', - '..', - '..', - 'fixtures', - 'modules', - 'inifile', - 'lib') -) -$LOAD_PATH.push( - File.join( - File.dirname(__FILE__), - '..', - '..', - '..', - 'fixtures', - 'modules', - 'openstacklib', - 'lib') -) -require 'spec_helper' -provider_class = Puppet::Type.type(:oslo_config).provider(:ini_setting) -describe provider_class do - - it 'should default to the default setting when no other one is specified' do - resource = Puppet::Type::Oslo_config.new( - {:name => 'DEFAULT/foo', :value => 'bar'} - ) - provider = provider_class.new(resource) - expect(provider.section).to eq('DEFAULT') - expect(provider.setting).to eq('foo') - end - - it 'should allow setting to be set explicitly' do - resource = Puppet::Type::Oslo_config.new( - {:name => 'dude/foo', :value => 'bar'} - ) - provider = provider_class.new(resource) - expect(provider.section).to eq('dude') - expect(provider.setting).to eq('foo') - end - - it 'should ensure absent when is specified as a value' do - resource = Puppet::Type::Oslo_config.new( - {:name => 'dude/foo', :value => ''} - ) - provider = provider_class.new(resource) - provider.exists? - expect(resource[:ensure]).to eq :absent - end - - it 'should ensure absent when value matches ensure_absent_val' do - resource = Puppet::Type::Oslo_config.new( - {:name => 'dude/foo', :value => 'foo', :ensure_absent_val => 'foo' } - ) - provider = provider_class.new(resource) - provider.exists? - expect(resource[:ensure]).to eq :absent - end - -end diff --git a/spec/unit/type/oslo_config_spec.rb b/spec/unit/type/oslo_config_spec.rb deleted file mode 100644 index 79461c5..0000000 --- a/spec/unit/type/oslo_config_spec.rb +++ /dev/null @@ -1,64 +0,0 @@ -require 'puppet' -require 'puppet/type/oslo_config' -describe 'Puppet::Type.type(:oslo_config)' do - before :each do - @oslo_config = Puppet::Type.type(:oslo_config).new(:name => 'DEFAULT/foo', :value => 'bar') - end - - it 'should require a name' do - expect { - Puppet::Type.type(:oslo_config).new({}) - }.to raise_error(Puppet::Error, 'Title or name must be provided') - end - - it 'should not expect a name with whitespace' do - expect { - Puppet::Type.type(:oslo_config).new(:name => 'f oo') - }.to raise_error(Puppet::Error, /Parameter name failed/) - end - - it 'should fail when there is no section' do - expect { - Puppet::Type.type(:oslo_config).new(:name => 'foo') - }.to raise_error(Puppet::Error, /Parameter name failed/) - end - - it 'should not require a value when ensure is absent' do - Puppet::Type.type(:oslo_config).new(:name => 'DEFAULT/foo', :ensure => :absent) - end - - it 'should accept a valid value' do - @oslo_config[:value] = 'bar' - expect(@oslo_config[:value]).to eq('bar') - end - - it 'should not accept a value with whitespace' do - @oslo_config[:value] = 'b ar' - expect(@oslo_config[:value]).to eq('b ar') - end - - it 'should accept valid ensure values' do - @oslo_config[:ensure] = :present - expect(@oslo_config[:ensure]).to eq(:present) - @oslo_config[:ensure] = :absent - expect(@oslo_config[:ensure]).to eq(:absent) - end - - it 'should not accept invalid ensure values' do - expect { - @oslo_config[:ensure] = :latest - }.to raise_error(Puppet::Error, /Invalid value/) - end - - it 'should autorequire the package that install the file' do - catalog = Puppet::Resource::Catalog.new - package = Puppet::Type.type(:package).new(:name => 'oslo') - catalog.add_resource package, @oslo_config - dependency = @oslo_config.autorequire - expect(dependency.size).to eq(1) - expect(dependency[0].target).to eq(@oslo_config) - expect(dependency[0].source).to eq(package) - end - - -end