
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
188 lines
5.2 KiB
Ruby
188 lines
5.2 KiB
Ruby
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
|