ceilometer is a combination of Puppet manifests and Ruby code to deliver configuration and
extra functionality through types and providers.
+### Types
+
+#### ceilometer_config
+
+The `ceilometer_config` provider is a children of the ini_setting provider. It allows one to write an entry in the `/etc/ceilometer/ceilometer.conf` file.
+
+```puppet
+ceilometer_config { 'DEFAULT/verbose' :
+ value => true,
+}
+```
+
+This will write `verbose=true` in the `[DEFAULT]` section.
+
+##### name
+
+Section/setting name to manage from `ceilometer.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
-----------
Puppet::Type.type(:ceilometer_config).provide(
:ini_setting,
- :parent => Puppet::Type.type(:ini_setting).provider(:ruby)
+ :parent => Puppet::Type.type(:openstack_config).provider(:ini_setting)
) do
- 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/ceilometer.conf'
end
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
'ceilometer-common'
end
'inifile',
'lib')
)
+$LOAD_PATH.push(
+ File.join(
+ File.dirname(__FILE__),
+ '..',
+ '..',
+ '..',
+ 'fixtures',
+ 'modules',
+ 'openstacklib',
+ 'lib')
+)
require 'spec_helper'
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::Ceilometer_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::Ceilometer_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