Remove resource types for per-daemon config files

Since yoga relase, this module no longer uses separate config files for
individual daemons but use the single trove.conf [1].

This change removes the remaining resource types for the separate
.conf files, which should have been removed by the cleanup patch[2].

[1] f1c11c68d5
[2] 4d87fa2c69

Change-Id: I66c1ccedc2ef1a73b5ee3f053b843e97be0d59b4
This commit is contained in:
Takashi Kajinami 2022-07-09 22:49:04 +09:00
parent f2896b839f
commit 4d59d16be5
11 changed files with 7 additions and 410 deletions

View File

@ -76,34 +76,6 @@ Whether to hide the value from Puppet logs. Defaults to `false`.
If value is equal to ensure_absent_val then the resource will behave as if `ensure => absent` was specified. Defaults to `<SERVICE DEFAULT>`
#### trove_conductor_config
The `trove_conductor_config` provider is a children of the ini_setting provider. It allows one to write an entry in the `/etc/trove/trove-conductor.conf` file.
```puppet
trove_conductor_config { 'DEFAULT/auth_url' :
value => http://localhost:5000/v3,
}
```
This will write `auth_url=http://localhost:5000/v3` in the `[DEFAULT]` section.
##### name
Section/setting name to manage from `trove.conf`
##### value
The value of the setting to be defined.
##### secret
Whether to hide the value from Puppet logs. Defaults to `false`.
##### ensure_absent_val
If value is equal to ensure_absent_val then the resource will behave as if `ensure => absent` was specified. Defaults to `<SERVICE DEFAULT>`
#### trove_guestagent_config
The `trove_guestagent_config` provider is a children of the ini_setting provider. It allows one to write an entry in the `/etc/trove/trove-guestagent.conf` file.
@ -132,34 +104,6 @@ Whether to hide the value from Puppet logs. Defaults to `false`.
If value is equal to ensure_absent_val then the resource will behave as if `ensure => absent` was specified. Defaults to `<SERVICE DEFAULT>`
#### trove_taskmanager_config
The `trove_taskmanager_config` provider is a children of the ini_setting provider. It allows one to write an entry in the `/etc/trove/trove-taskmanager.conf` file.
```puppet
trove_taskmanager_config { 'DEFAULT/network_driver' :
value => trove.network.neutron.NeutronDriver,
}
```
This will write `network_driver=trove.network.neutron.NeutronDriver` in the `[DEFAULT]` section.
##### name
Section/setting name to manage from `trove.conf`
##### value
The value of the setting to be defined.
##### secret
Whether to hide the value from Puppet logs. Defaults to `false`.
##### ensure_absent_val
If value is equal to ensure_absent_val then the resource will behave as if `ensure => absent` was specified. Defaults to `<SERVICE DEFAULT>`
Limitations
-----------

View File

@ -1,10 +0,0 @@
Puppet::Type.type(:trove_conductor_config).provide(
:openstackconfig,
:parent => Puppet::Type.type(:openstack_config).provider(:ruby)
) do
def self.file_path
'/etc/trove/trove-conductor.conf'
end
end

View File

@ -1,10 +0,0 @@
Puppet::Type.type(:trove_taskmanager_config).provide(
:openstackconfig,
:parent => Puppet::Type.type(:openstack_config).provider(:ruby)
) do
def self.file_path
'/etc/trove/trove-taskmanager.conf'
end
end

View File

@ -1,60 +0,0 @@
Puppet::Type.newtype(:trove_conductor_config) do
ensurable
newparam(:name, :namevar => true) do
desc 'Section/setting name to manage from /etc/trove/trove-conductor.conf (DEPRECATED)'
newvalues(/\S+\/\S+/)
end
newproperty(:value, :array_matching => :all) do
desc 'The value of the setting to be defined.'
def insync?(is)
return true if @should.empty?
return false unless is.is_a? Array
return false unless is.length == @should.length
return (
is & @should == is or
is & @should.map(&:to_s) == is
)
end
munge do |value|
value = value.to_s.strip
value.capitalize! if value =~ /^(true|false)$/i
value
end
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(:anchor) do
['trove::install::end']
end
end

View File

@ -1,60 +0,0 @@
Puppet::Type.newtype(:trove_taskmanager_config) do
ensurable
newparam(:name, :namevar => true) do
desc 'Section/setting name to manage from /etc/trove/trove-taskmanager.conf (DEPRECATED)'
newvalues(/\S+\/\S+/)
end
newproperty(:value, :array_matching => :all) do
desc 'The value of the setting to be defined.'
def insync?(is)
return true if @should.empty?
return false unless is.is_a? Array
return false unless is.length == @should.length
return (
is & @should == is or
is & @should.map(&:to_s) == is
)
end
munge do |value|
value = value.to_s.strip
value.capitalize! if value =~ /^(true|false)$/i
value
end
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(:anchor) do
['trove::install::end']
end
end

View File

@ -28,12 +28,6 @@ class trove::deps {
# Don't put them above because there's no chain between each individual part
# of the config.
Anchor['trove::config::begin']
-> Trove_taskmanager_config<||>
~> Anchor['trove::config::end']
Anchor['trove::config::begin']
-> Trove_conductor_config<||>
~> Anchor['trove::config::end']
Anchor['trove::config::begin']
-> Trove_guestagent_config<||>
~> Anchor['trove::config::end']

View File

@ -0,0 +1,7 @@
---
upgrade:
- |
The following resource types have been removed.
- ``trove_conductor_config``
- ``trove_taskmanager_config``

View File

@ -1,41 +0,0 @@
require 'spec_helper'
provider_class = Puppet::Type.type(:trove_conductor_config).provider(:openstackconfig)
describe provider_class do
it 'should default to the default setting when no other one is specified' do
resource = Puppet::Type::Trove_conductor_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::Trove_conductor_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::Trove_conductor_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::Trove_conductor_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,41 +0,0 @@
require 'spec_helper'
provider_class = Puppet::Type.type(:trove_taskmanager_config).provider(:openstackconfig)
describe provider_class do
it 'should default to the default setting when no other one is specified' do
resource = Puppet::Type::Trove_taskmanager_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::Trove_taskmanager_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::Trove_taskmanager_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::Trove_taskmanager_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,63 +0,0 @@
require 'puppet'
require 'puppet/type/trove_conductor_config'
describe 'Puppet::Type.type(:trove_conductor_config)' do
before :each do
@trove_conductor_config = Puppet::Type.type(:trove_conductor_config).new(:name => 'DEFAULT/foo', :value => 'bar')
end
it 'should require a name' do
expect {
Puppet::Type.type(:trove_conductor_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(:trove_conductor_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(:trove_conductor_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(:trove_conductor_config).new(:name => 'DEFAULT/foo', :ensure => :absent)
end
it 'should accept a valid value' do
@trove_conductor_config[:value] = 'bar'
expect(@trove_conductor_config[:value]).to eq(['bar'])
end
it 'should accept a value with whitespace' do
@trove_conductor_config[:value] = 'b ar'
expect(@trove_conductor_config[:value]).to eq(['b ar'])
end
it 'should accept valid ensure values' do
@trove_conductor_config[:ensure] = :present
expect(@trove_conductor_config[:ensure]).to eq(:present)
@trove_conductor_config[:ensure] = :absent
expect(@trove_conductor_config[:ensure]).to eq(:absent)
end
it 'should not accept invalid ensure values' do
expect {
@trove_conductor_config[:ensure] = :latest
}.to raise_error(Puppet::Error, /Invalid value/)
end
it 'should autorequire the package that installs the file' do
catalog = Puppet::Resource::Catalog.new
anchor = Puppet::Type.type(:anchor).new(:name => 'trove::install::end')
catalog.add_resource anchor, @trove_conductor_config
dependency = @trove_conductor_config.autorequire
expect(dependency.size).to eq(1)
expect(dependency[0].target).to eq(@trove_conductor_config)
expect(dependency[0].source).to eq(anchor)
end
end

View File

@ -1,63 +0,0 @@
require 'puppet'
require 'puppet/type/trove_taskmanager_config'
describe 'Puppet::Type.type(:trove_taskmanager_config)' do
before :each do
@trove_taskmanager_config = Puppet::Type.type(:trove_taskmanager_config).new(:name => 'DEFAULT/foo', :value => 'bar')
end
it 'should require a name' do
expect {
Puppet::Type.type(:trove_taskmanager_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(:trove_taskmanager_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(:trove_taskmanager_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(:trove_taskmanager_config).new(:name => 'DEFAULT/foo', :ensure => :absent)
end
it 'should accept a valid value' do
@trove_taskmanager_config[:value] = 'bar'
expect(@trove_taskmanager_config[:value]).to eq(['bar'])
end
it 'should accept a value with whitespace' do
@trove_taskmanager_config[:value] = 'b ar'
expect(@trove_taskmanager_config[:value]).to eq(['b ar'])
end
it 'should accept valid ensure values' do
@trove_taskmanager_config[:ensure] = :present
expect(@trove_taskmanager_config[:ensure]).to eq(:present)
@trove_taskmanager_config[:ensure] = :absent
expect(@trove_taskmanager_config[:ensure]).to eq(:absent)
end
it 'should not accept invalid ensure values' do
expect {
@trove_taskmanager_config[:ensure] = :latest
}.to raise_error(Puppet::Error, /Invalid value/)
end
it 'should autorequire the package that installs the file' do
catalog = Puppet::Resource::Catalog.new
anchor = Puppet::Type.type(:anchor).new(:name => 'trove::install::end')
catalog.add_resource anchor, @trove_taskmanager_config
dependency = @trove_taskmanager_config.autorequire
expect(dependency.size).to eq(1)
expect(dependency[0].target).to eq(@trove_taskmanager_config)
expect(dependency[0].source).to eq(anchor)
end
end