Reflect provider change in puppet-openstacklib
With the creation of the new openstack_config provider, some processing that was done in swift_config has been centralized in openstack_config. Impacted methods are : * section * setting * separator Also, this commit adds the fact that, when passing a specific string (ensure_absent_val) the provider will behave as if ensure => absent was specified. '<SERVICE DEFAULT>' is the default value for ensure_absent_val. The use case is the following : swift_config { 'DEFAULT/foo' : value => 'bar' } # will work as usual swift_config { 'DEFAULT/foo' : value => '<SERVICE DEFAULT>' } # will mean absent That means that all the current : if $myvar { swift_config { 'DEFAULT/foo' : value => $myvar } } else { swift_config { 'DEFAULT/foo' : ensure => absent } } can be removed in favor of : swift_config { 'DEFAULT/foo' : value => $myvar } If for any reason '<SERVICE DEFAULT>' turns out to be a valid value for a specific parameter. One could by pass that doing the following : swift_config { 'DEFAULT/foo' : value => '<SERVICE DEFAULT>', ensure_absent_val => 'foo' } Change-Id: I9281d2cae81f9799327f7f6e04498d6bc723f233 Depends-On: I0eeebde3aac2662cc7e69bfad7f8d2481463a218
This commit is contained in:
parent
c91b4c0941
commit
e6e8c9d836
55
README.md
55
README.md
@ -229,6 +229,61 @@ Implementation
|
||||
|
||||
swift is a combination of Puppet manifest and ruby code to delivery configuration and extra functionality through types and providers.
|
||||
|
||||
### Types
|
||||
|
||||
#### swift_config
|
||||
|
||||
The `swift_config` provider is a children of the ini_setting provider. It allows one to write an entry in the `/etc/swift/swift.conf` file.
|
||||
|
||||
```puppet
|
||||
swift_config { 'DEFAULT/verbose' :
|
||||
value => true,
|
||||
}
|
||||
```
|
||||
|
||||
This will write `verbose=true` in the `[DEFAULT]` section.
|
||||
|
||||
##### name
|
||||
|
||||
Section/setting name to manage from `swift.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>`
|
||||
|
||||
#### swift_account_config
|
||||
|
||||
Same as `swift_config`, but path is `/etc/swift/account-server.conf`
|
||||
|
||||
#### swift_bench_config
|
||||
|
||||
Same as `swift_config`, but path is `/etc/swift/swift-bench.conf`
|
||||
|
||||
#### swift_container_config
|
||||
|
||||
Same as `swift_config`, but path is `/etc/swift/container-server.conf`
|
||||
|
||||
#### swift_dispersion_config
|
||||
|
||||
Same as `swift_config`, but path is `/etc/swift/dispersion.conf`
|
||||
|
||||
#### swift_object_config
|
||||
|
||||
Same as `swift_config`, but path is `/etc/swift/object-server.conf`
|
||||
|
||||
#### swift_proxy_config
|
||||
|
||||
Same as `swift_config`, but path is `/etc/swift/proxy-server.conf`
|
||||
|
||||
|
||||
Limitations
|
||||
------------
|
||||
|
||||
|
@ -1,27 +1,10 @@
|
||||
Puppet::Type.type(:swift_account_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/swift/account-server.conf'
|
||||
end
|
||||
|
||||
# added for backwards compatibility with older versions of inifile
|
||||
def file_path
|
||||
self.class.file_path
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -1,27 +1,10 @@
|
||||
Puppet::Type.type(:swift_bench_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/swift/swift-bench.conf'
|
||||
end
|
||||
|
||||
# added for backwards compatibility with older versions of inifile
|
||||
def file_path
|
||||
self.class.file_path
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -1,27 +1,10 @@
|
||||
Puppet::Type.type(:swift_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/swift/swift.conf'
|
||||
end
|
||||
|
||||
# added for backwards compatibility with older versions of inifile
|
||||
def file_path
|
||||
self.class.file_path
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -1,27 +1,10 @@
|
||||
Puppet::Type.type(:swift_container_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/swift/container-server.conf'
|
||||
end
|
||||
|
||||
# added for backwards compatibility with older versions of inifile
|
||||
def file_path
|
||||
self.class.file_path
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -1,27 +1,10 @@
|
||||
Puppet::Type.type(:swift_dispersion_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/swift/dispersion.conf'
|
||||
end
|
||||
|
||||
# added for backwards compatibility with older versions of inifile
|
||||
def file_path
|
||||
self.class.file_path
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -1,27 +1,10 @@
|
||||
Puppet::Type.type(:swift_object_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/swift/object-server.conf'
|
||||
end
|
||||
|
||||
# added for backwards compatibility with older versions of inifile
|
||||
def file_path
|
||||
self.class.file_path
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -1,27 +1,10 @@
|
||||
Puppet::Type.type(:swift_proxy_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/swift/proxy-server.conf'
|
||||
end
|
||||
|
||||
# added for backwards compatibility with older versions of inifile
|
||||
def file_path
|
||||
self.class.file_path
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -14,6 +14,7 @@ Puppet::Type.newtype(:swift_account_config) do
|
||||
value.capitalize! if value =~ /^(true|false)$/i
|
||||
value
|
||||
end
|
||||
newvalues(/^[\S ]*$/)
|
||||
|
||||
def is_to_s( currentvalue )
|
||||
if resource.secret?
|
||||
@ -34,10 +35,17 @@ Puppet::Type.newtype(:swift_account_config) do
|
||||
|
||||
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
|
||||
'swift-account'
|
||||
end
|
||||
|
@ -14,6 +14,7 @@ Puppet::Type.newtype(:swift_bench_config) do
|
||||
value.capitalize! if value =~ /^(true|false)$/i
|
||||
value
|
||||
end
|
||||
newvalues(/^[\S ]*$/)
|
||||
|
||||
def is_to_s( currentvalue )
|
||||
if resource.secret?
|
||||
@ -34,10 +35,17 @@ Puppet::Type.newtype(:swift_bench_config) do
|
||||
|
||||
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
|
||||
'swift'
|
||||
end
|
||||
|
@ -14,6 +14,7 @@ Puppet::Type.newtype(:swift_config) do
|
||||
value.capitalize! if value =~ /^(true|false)$/i
|
||||
value
|
||||
end
|
||||
newvalues(/^[\S ]*$/)
|
||||
|
||||
def is_to_s( currentvalue )
|
||||
if resource.secret?
|
||||
@ -34,10 +35,17 @@ Puppet::Type.newtype(:swift_config) do
|
||||
|
||||
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
|
||||
|
||||
# Require the swift.conf to be present
|
||||
autorequire(:package) do
|
||||
'swift'
|
||||
|
@ -14,6 +14,7 @@ Puppet::Type.newtype(:swift_container_config) do
|
||||
value.capitalize! if value =~ /^(true|false)$/i
|
||||
value
|
||||
end
|
||||
newvalues(/^[\S ]*$/)
|
||||
|
||||
def is_to_s( currentvalue )
|
||||
if resource.secret?
|
||||
@ -34,10 +35,17 @@ Puppet::Type.newtype(:swift_container_config) do
|
||||
|
||||
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
|
||||
'swift-container'
|
||||
end
|
||||
|
@ -14,6 +14,7 @@ Puppet::Type.newtype(:swift_dispersion_config) do
|
||||
value.capitalize! if value =~ /^(true|false)$/i
|
||||
value
|
||||
end
|
||||
newvalues(/^[\S ]*$/)
|
||||
|
||||
def is_to_s( currentvalue )
|
||||
if resource.secret?
|
||||
@ -34,10 +35,17 @@ Puppet::Type.newtype(:swift_dispersion_config) do
|
||||
|
||||
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
|
||||
'swift'
|
||||
end
|
||||
|
@ -14,6 +14,7 @@ Puppet::Type.newtype(:swift_object_config) do
|
||||
value.capitalize! if value =~ /^(true|false)$/i
|
||||
value
|
||||
end
|
||||
newvalues(/^[\S ]*$/)
|
||||
|
||||
def is_to_s( currentvalue )
|
||||
if resource.secret?
|
||||
@ -34,10 +35,17 @@ Puppet::Type.newtype(:swift_object_config) do
|
||||
|
||||
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
|
||||
'swift-object'
|
||||
end
|
||||
|
@ -14,6 +14,7 @@ Puppet::Type.newtype(:swift_proxy_config) do
|
||||
value.capitalize! if value =~ /^(true|false)$/i
|
||||
value
|
||||
end
|
||||
newvalues(/^[\S ]*$/)
|
||||
|
||||
def is_to_s( currentvalue )
|
||||
if resource.secret?
|
||||
@ -34,10 +35,17 @@ Puppet::Type.newtype(:swift_proxy_config) do
|
||||
|
||||
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
|
||||
'swift-proxy'
|
||||
end
|
||||
|
187
spec/acceptance/swift_config_spec.rb
Normal file
187
spec/acceptance/swift_config_spec.rb
Normal file
@ -0,0 +1,187 @@
|
||||
require 'spec_helper_acceptance'
|
||||
|
||||
describe 'basic swift_config resource' do
|
||||
|
||||
context 'default parameters' do
|
||||
|
||||
it 'should work with no errors' do
|
||||
pp= <<-EOS
|
||||
Exec { logoutput => 'on_failure' }
|
||||
|
||||
File <||> -> Swift_config <||>
|
||||
File <||> -> Swift_account_config <||>
|
||||
File <||> -> Swift_bench_config <||>
|
||||
File <||> -> Swift_container_config <||>
|
||||
File <||> -> Swift_dispersion_config <||>
|
||||
File <||> -> Swift_object_config <||>
|
||||
File <||> -> Swift_proxy_config <||>
|
||||
|
||||
file { '/etc/swift' :
|
||||
ensure => directory,
|
||||
}
|
||||
|
||||
$swift_files = [ '/etc/swift/swift.conf',
|
||||
'/etc/swift/account-server.conf',
|
||||
'/etc/swift/swift-bench.conf',
|
||||
'/etc/swift/container-server.conf',
|
||||
'/etc/swift/dispersion.conf',
|
||||
'/etc/swift/object-server.conf',
|
||||
'/etc/swift/proxy-server.conf']
|
||||
|
||||
file { $swift_files :
|
||||
ensure => file,
|
||||
}
|
||||
|
||||
swift_config { 'DEFAULT/thisshouldexist' :
|
||||
value => 'foo',
|
||||
}
|
||||
|
||||
swift_config { 'DEFAULT/thisshouldnotexist' :
|
||||
value => '<SERVICE DEFAULT>',
|
||||
}
|
||||
|
||||
swift_config { 'DEFAULT/thisshouldexist2' :
|
||||
value => '<SERVICE DEFAULT>',
|
||||
ensure_absent_val => 'toto',
|
||||
}
|
||||
|
||||
swift_config { 'DEFAULT/thisshouldnotexist2' :
|
||||
value => 'toto',
|
||||
ensure_absent_val => 'toto',
|
||||
}
|
||||
|
||||
swift_account_config { 'DEFAULT/thisshouldexist' :
|
||||
value => 'foo',
|
||||
}
|
||||
|
||||
swift_account_config { 'DEFAULT/thisshouldnotexist' :
|
||||
value => '<SERVICE DEFAULT>',
|
||||
}
|
||||
|
||||
swift_account_config { 'DEFAULT/thisshouldexist2' :
|
||||
value => '<SERVICE DEFAULT>',
|
||||
ensure_absent_val => 'toto',
|
||||
}
|
||||
|
||||
swift_account_config { 'DEFAULT/thisshouldnotexist2' :
|
||||
value => 'toto',
|
||||
ensure_absent_val => 'toto',
|
||||
}
|
||||
|
||||
swift_bench_config { 'DEFAULT/thisshouldexist' :
|
||||
value => 'foo',
|
||||
}
|
||||
|
||||
swift_bench_config { 'DEFAULT/thisshouldnotexist' :
|
||||
value => '<SERVICE DEFAULT>',
|
||||
}
|
||||
|
||||
swift_bench_config { 'DEFAULT/thisshouldexist2' :
|
||||
value => '<SERVICE DEFAULT>',
|
||||
ensure_absent_val => 'toto',
|
||||
}
|
||||
|
||||
swift_bench_config { 'DEFAULT/thisshouldnotexist2' :
|
||||
value => 'toto',
|
||||
ensure_absent_val => 'toto',
|
||||
}
|
||||
|
||||
swift_container_config { 'DEFAULT/thisshouldexist' :
|
||||
value => 'foo',
|
||||
}
|
||||
|
||||
swift_container_config { 'DEFAULT/thisshouldnotexist' :
|
||||
value => '<SERVICE DEFAULT>',
|
||||
}
|
||||
|
||||
swift_container_config { 'DEFAULT/thisshouldexist2' :
|
||||
value => '<SERVICE DEFAULT>',
|
||||
ensure_absent_val => 'toto',
|
||||
}
|
||||
|
||||
swift_container_config { 'DEFAULT/thisshouldnotexist2' :
|
||||
value => 'toto',
|
||||
ensure_absent_val => 'toto',
|
||||
}
|
||||
|
||||
swift_dispersion_config { 'DEFAULT/thisshouldexist' :
|
||||
value => 'foo',
|
||||
}
|
||||
|
||||
swift_dispersion_config { 'DEFAULT/thisshouldnotexist' :
|
||||
value => '<SERVICE DEFAULT>',
|
||||
}
|
||||
|
||||
swift_dispersion_config { 'DEFAULT/thisshouldexist2' :
|
||||
value => '<SERVICE DEFAULT>',
|
||||
ensure_absent_val => 'toto',
|
||||
}
|
||||
|
||||
swift_dispersion_config { 'DEFAULT/thisshouldnotexist2' :
|
||||
value => 'toto',
|
||||
ensure_absent_val => 'toto',
|
||||
}
|
||||
|
||||
swift_object_config { 'DEFAULT/thisshouldexist' :
|
||||
value => 'foo',
|
||||
}
|
||||
|
||||
swift_object_config { 'DEFAULT/thisshouldnotexist' :
|
||||
value => '<SERVICE DEFAULT>',
|
||||
}
|
||||
|
||||
swift_object_config { 'DEFAULT/thisshouldexist2' :
|
||||
value => '<SERVICE DEFAULT>',
|
||||
ensure_absent_val => 'toto',
|
||||
}
|
||||
|
||||
swift_object_config { 'DEFAULT/thisshouldnotexist2' :
|
||||
value => 'toto',
|
||||
ensure_absent_val => 'toto',
|
||||
}
|
||||
|
||||
swift_proxy_config { 'DEFAULT/thisshouldexist' :
|
||||
value => 'foo',
|
||||
}
|
||||
|
||||
swift_proxy_config { 'DEFAULT/thisshouldnotexist' :
|
||||
value => '<SERVICE DEFAULT>',
|
||||
}
|
||||
|
||||
swift_proxy_config { 'DEFAULT/thisshouldexist2' :
|
||||
value => '<SERVICE DEFAULT>',
|
||||
ensure_absent_val => 'toto',
|
||||
}
|
||||
|
||||
swift_proxy_config { 'DEFAULT/thisshouldnotexist2' :
|
||||
value => 'toto',
|
||||
ensure_absent_val => 'toto',
|
||||
}
|
||||
EOS
|
||||
|
||||
|
||||
# Run it twice and test for idempotency
|
||||
apply_manifest(pp, :catch_failures => true)
|
||||
apply_manifest(pp, :catch_changes => true)
|
||||
end
|
||||
|
||||
$swift_files = [ '/etc/swift/swift.conf',
|
||||
'/etc/swift/account-server.conf',
|
||||
'/etc/swift/swift-bench.conf',
|
||||
'/etc/swift/container-server.conf',
|
||||
'/etc/swift/dispersion.conf',
|
||||
'/etc/swift/object-server.conf',
|
||||
'/etc/swift/proxy-server.conf']
|
||||
|
||||
$swift_files.each do |swift_conf_file|
|
||||
describe file(swift_conf_file) do
|
||||
it { should exist }
|
||||
it { should contain('thisshouldexist=foo') }
|
||||
it { should contain('thisshouldexist2=<SERVICE DEFAULT>') }
|
||||
|
||||
its(:content) { should_not match /thisshouldnotexist/ }
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
@ -9,6 +9,17 @@ $LOAD_PATH.push(
|
||||
'inifile',
|
||||
'lib')
|
||||
)
|
||||
$LOAD_PATH.push(
|
||||
File.join(
|
||||
File.dirname(__FILE__),
|
||||
'..',
|
||||
'..',
|
||||
'..',
|
||||
'fixtures',
|
||||
'modules',
|
||||
'openstacklib',
|
||||
'lib')
|
||||
)
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
@ -39,4 +50,23 @@ describe provider_class do
|
||||
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::Swift_account_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::Swift_account_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
|
||||
|
@ -9,6 +9,17 @@ $LOAD_PATH.push(
|
||||
'inifile',
|
||||
'lib')
|
||||
)
|
||||
$LOAD_PATH.push(
|
||||
File.join(
|
||||
File.dirname(__FILE__),
|
||||
'..',
|
||||
'..',
|
||||
'..',
|
||||
'fixtures',
|
||||
'modules',
|
||||
'openstacklib',
|
||||
'lib')
|
||||
)
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
@ -39,4 +50,22 @@ describe provider_class do
|
||||
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::Swift_bench_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::Swift_bench_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
|
||||
|
@ -9,6 +9,17 @@ $LOAD_PATH.push(
|
||||
'inifile',
|
||||
'lib')
|
||||
)
|
||||
$LOAD_PATH.push(
|
||||
File.join(
|
||||
File.dirname(__FILE__),
|
||||
'..',
|
||||
'..',
|
||||
'..',
|
||||
'fixtures',
|
||||
'modules',
|
||||
'openstacklib',
|
||||
'lib')
|
||||
)
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
@ -39,4 +50,23 @@ describe provider_class do
|
||||
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::Swift_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::Swift_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
|
||||
|
@ -9,6 +9,17 @@ $LOAD_PATH.push(
|
||||
'inifile',
|
||||
'lib')
|
||||
)
|
||||
$LOAD_PATH.push(
|
||||
File.join(
|
||||
File.dirname(__FILE__),
|
||||
'..',
|
||||
'..',
|
||||
'..',
|
||||
'fixtures',
|
||||
'modules',
|
||||
'openstacklib',
|
||||
'lib')
|
||||
)
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
@ -39,4 +50,23 @@ describe provider_class do
|
||||
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::Swift_container_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::Swift_container_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
|
||||
|
@ -9,6 +9,17 @@ $LOAD_PATH.push(
|
||||
'inifile',
|
||||
'lib')
|
||||
)
|
||||
$LOAD_PATH.push(
|
||||
File.join(
|
||||
File.dirname(__FILE__),
|
||||
'..',
|
||||
'..',
|
||||
'..',
|
||||
'fixtures',
|
||||
'modules',
|
||||
'openstacklib',
|
||||
'lib')
|
||||
)
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
@ -39,4 +50,22 @@ describe provider_class do
|
||||
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::Swift_dispersion_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::Swift_dispersion_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
|
||||
|
@ -9,6 +9,17 @@ $LOAD_PATH.push(
|
||||
'inifile',
|
||||
'lib')
|
||||
)
|
||||
$LOAD_PATH.push(
|
||||
File.join(
|
||||
File.dirname(__FILE__),
|
||||
'..',
|
||||
'..',
|
||||
'..',
|
||||
'fixtures',
|
||||
'modules',
|
||||
'openstacklib',
|
||||
'lib')
|
||||
)
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
@ -39,4 +50,22 @@ describe provider_class do
|
||||
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::Swift_object_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::Swift_object_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
|
||||
|
@ -9,6 +9,17 @@ $LOAD_PATH.push(
|
||||
'inifile',
|
||||
'lib')
|
||||
)
|
||||
$LOAD_PATH.push(
|
||||
File.join(
|
||||
File.dirname(__FILE__),
|
||||
'..',
|
||||
'..',
|
||||
'..',
|
||||
'fixtures',
|
||||
'modules',
|
||||
'openstacklib',
|
||||
'lib')
|
||||
)
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
@ -39,4 +50,23 @@ describe provider_class do
|
||||
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::Swift_proxy_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::Swift_proxy_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
|
||||
|
Loading…
Reference in New Issue
Block a user