Remove keystone_puppet_config resource type

This is no longer used since we replaced the configuration file by
clouds.yaml. The resource was already deprecated by [1] in the past
cycle so can be removed.

[1] c140a44aeb

Change-Id: I631c0a14cc0ee5b56e7864980da9a651d6bf7d9b
This commit is contained in:
Takashi Kajinami 2022-11-25 12:04:30 +09:00
parent b99810d6f9
commit aa394b1775
6 changed files with 4 additions and 133 deletions

View File

@ -1,8 +0,0 @@
Puppet::Type.type(:keystone_puppet_config).provide(
:ini_setting,
:parent => Puppet::Type.type(:openstack_config).provider(:ini_setting)
) do
def self.file_path
'/etc/keystone/puppet.conf'
end
end

View File

@ -1,14 +0,0 @@
Puppet::Type.newtype(:keystone_puppet_config) do
require File.expand_path(File.join(
File.dirname(__FILE__), '..', '..',
'puppet_x', 'keystone_config', 'ini_setting'))
extend PuppetX::KeystoneConfig::IniSetting
desc 'Type for /etc/keystone/puppet.conf (DEPRECATED!!)'
create_parameters
autorequire(:file) do
['/etc/keystone/puppet.conf']
end
end

View File

@ -24,12 +24,6 @@ class keystone::deps {
~> Service<| tag == 'keystone-service' |>
~> anchor { 'keystone::service::end': }
# credential file for keystone api access should be generated during
# configuration phase
Anchor['keystone::config::begin']
-> Keystone_puppet_config<||>
~> Anchor['keystone::config::end']
# On any uwsgi config change, we must restart Keystone.
Anchor['keystone::config::begin']
-> Keystone_uwsgi_config<||>

View File

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

View File

@ -1,41 +0,0 @@
require 'spec_helper'
provider_class = Puppet::Type.type(:keystone_puppet_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::Keystone_puppet_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::Keystone_puppet_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::Keystone_puppet_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::Keystone_puppet_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 'spec_helper'
require 'puppet'
require 'puppet/type/keystone_puppet_config'
describe 'Puppet::Type.type(:keystone_puppet_config)' do
before :each do
@keystone_puppet_config = Puppet::Type.type(:keystone_puppet_config).new(:name => 'DEFAULT/foo', :value => 'bar')
end
it 'should require a name' do
expect {
Puppet::Type.type(:keystone_puppet_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(:keystone_puppet_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(:keystone_puppet_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(:keystone_puppet_config).new(:name => 'DEFAULT/foo', :ensure => :absent)
end
it 'should accept a valid value' do
@keystone_puppet_config[:value] = 'bar'
expect(@keystone_puppet_config[:value]).to eq('bar')
end
it 'should accept a value with whitespace' do
@keystone_puppet_config[:value] = 'b ar'
expect(@keystone_puppet_config[:value]).to eq('b ar')
end
it 'should accept valid ensure values' do
@keystone_puppet_config[:ensure] = :present
expect(@keystone_puppet_config[:ensure]).to eq(:present)
@keystone_puppet_config[:ensure] = :absent
expect(@keystone_puppet_config[:ensure]).to eq(:absent)
end
it 'should not accept invalid ensure values' do
expect {
@keystone_puppet_config[:ensure] = :latest
}.to raise_error(Puppet::Error, /Invalid value/)
end
it 'should autorequire the config file' do
catalog = Puppet::Resource::Catalog.new
config_file = Puppet::Type.type(:file).new(:name => '/etc/keystone/puppet.conf')
catalog.add_resource config_file, @keystone_puppet_config
dependency = @keystone_puppet_config.autorequire
expect(dependency.size).to eq(1)
expect(dependency[0].target).to eq(@keystone_puppet_config)
expect(dependency[0].source).to eq(config_file)
end
end