Remove deprecated oslo_config

... because it was deprecated a while ago[1], and has not been used
actually.

[1] 6cd2bc408d

Change-Id: Ida5525f6d66145cbadc7ab5407b559b12b101a76
This commit is contained in:
Takashi Kajinami 2021-11-02 13:14:28 +09:00
parent 88a7885e0c
commit 056a1db578
6 changed files with 4 additions and 204 deletions

View File

@ -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

View File

@ -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('<SERVICE DEFAULT>')
end
autorequire(:package) do
'oslo'
end
end

View File

@ -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"

View File

@ -0,0 +1,4 @@
---
upgrade:
- |
The ``oslo_config`` resource has been removed.

View File

@ -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 <SERVICE DEFAULT> is specified as a value' do
resource = Puppet::Type::Oslo_config.new(
{:name => 'dude/foo', :value => '<SERVICE DEFAULT>'}
)
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

View File

@ -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