Browse Source

Remove api_paste_ini resource

... because it is useless since ceilometer-api was removed.

Change-Id: Ida2a8a9bb2b23105db83b6553bfa8b5c783ffc58
changes/43/743643/2
Takashi Kajinami 1 year ago
parent
commit
390cfd1f33
  1. 32
      lib/puppet/provider/ceilometer_api_paste_ini/ini_setting.rb
  2. 52
      lib/puppet/type/ceilometer_api_paste_ini.rb
  3. 11
      manifests/config.pp
  4. 7
      releasenotes/notes/remove-api_paste_ini-242926984182c5c3.yaml
  5. 28
      spec/unit/provider/ceilometer_api_paste_ini/ini_setting_spec.rb
  6. 24
      spec/unit/type/ceilometer_api_paste_ini_spec.rb

32
lib/puppet/provider/ceilometer_api_paste_ini/ini_setting.rb

@ -1,32 +0,0 @@
Puppet::Type.type(:ceilometer_api_paste_ini).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
) do
def create
super
warning('ceilometer_api_paste_ini is deprecated, and will be removed in a future release')
end
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def self.file_path
'/etc/ceilometer/api_paste.ini'
end
# added for backwards compatibility with older versions of inifile
def file_path
self.class.file_path
end
end

52
lib/puppet/type/ceilometer_api_paste_ini.rb

@ -1,52 +0,0 @@
Puppet::Type.newtype(:ceilometer_api_paste_ini) do
ensurable
newparam(:name, :namevar => true) do
desc 'Section/setting name to manage from /etc/ceilometer/api_paste.ini'
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
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
['ceilometer::install::end']
end
end

11
manifests/config.pp

@ -19,18 +19,11 @@
# DEFAULT/bar:
# value: barValue
#
# DEPRECATED PARAMETERS
#
# [*ceilometer_api_paste_ini*]
# (optional) Allow configuration of /etc/ceilometer/api_paste.ini options.
#
# NOTE: The configuration MUST NOT be already handled by this module
# or Puppet catalog compilation will fail with duplicate resources.
#
class ceilometer::config (
$ceilometer_config = {},
# DEPRECATED PARAMETERS
$ceilometer_api_paste_ini = undef,
) {
include ceilometer::deps
@ -39,8 +32,4 @@ class ceilometer::config (
create_resources('ceilometer_config', $ceilometer_config)
if $ceilometer_api_paste_ini != undef {
warning('ceilometer_api_paste_ini is deprecated and has no effect.')
}
}

7
releasenotes/notes/remove-api_paste_ini-242926984182c5c3.yaml

@ -0,0 +1,7 @@
---
upgrade:
- |
The ``ceilometer_api_paste_ini`` resource has been removed.
- |
The ``ceilometer::config::api_paste_ini_config`` parameter has been removed.

28
spec/unit/provider/ceilometer_api_paste_ini/ini_setting_spec.rb

@ -1,28 +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')
)
require 'spec_helper'
provider_class = Puppet::Type.type(:ceilometer_api_paste_ini).provider(:ini_setting)
describe provider_class do
it 'should allow setting to be set explicitly' do
resource = Puppet::Type::Ceilometer_api_paste_ini.new(
{:name => 'dude/foo', :value => 'bar'}
)
provider = provider_class.new(resource)
expect(provider.section).to eq('dude')
expect(provider.setting).to eq('foo')
end
end

24
spec/unit/type/ceilometer_api_paste_ini_spec.rb

@ -1,24 +0,0 @@
require 'puppet'
require 'puppet/type/ceilometer_api_paste_ini'
describe 'Puppet::Type.type(:ceilometer_api_paste_ini)' do
before :each do
@ceilometer_api_paste_ini = Puppet::Type.type(:ceilometer_api_paste_ini).new(:name => 'DEFAULT/foo', :value => 'bar')
end
it 'should accept a valid value' do
@ceilometer_api_paste_ini[:value] = 'bar'
expect(@ceilometer_api_paste_ini[:value]).to eq('bar')
end
it 'should autorequire the package that install the file' do
catalog = Puppet::Resource::Catalog.new
anchor = Puppet::Type.type(:anchor).new(:name => 'ceilometer::install::end')
catalog.add_resource anchor, @ceilometer_api_paste_ini
dependency = @ceilometer_api_paste_ini.autorequire
expect(dependency.size).to eq(1)
expect(dependency[0].target).to eq(@ceilometer_api_paste_ini)
expect(dependency[0].source).to eq(anchor)
end
end
Loading…
Cancel
Save