Merge "Rely on autorequire for config resource ordering"

This commit is contained in:
Jenkins 2015-08-18 04:37:41 +00:00 committed by Gerrit Code Review
commit c91b4c0941
26 changed files with 459 additions and 15 deletions

View File

@ -37,4 +37,9 @@ Puppet::Type.newtype(:swift_account_config) do
newvalues(:true, :false) newvalues(:true, :false)
defaultto false defaultto false
end end
autorequire(:package) do
'swift-account'
end
end end

View File

@ -37,4 +37,9 @@ Puppet::Type.newtype(:swift_bench_config) do
newvalues(:true, :false) newvalues(:true, :false)
defaultto false defaultto false
end end
autorequire(:package) do
'swift'
end
end end

View File

@ -39,8 +39,8 @@ Puppet::Type.newtype(:swift_config) do
end end
# Require the swift.conf to be present # Require the swift.conf to be present
autorequire(:file) do autorequire(:package) do
['/etc/swift/swift.conf'] 'swift'
end end
end end

View File

@ -37,4 +37,9 @@ Puppet::Type.newtype(:swift_container_config) do
newvalues(:true, :false) newvalues(:true, :false)
defaultto false defaultto false
end end
autorequire(:package) do
'swift-container'
end
end end

View File

@ -37,4 +37,9 @@ Puppet::Type.newtype(:swift_dispersion_config) do
newvalues(:true, :false) newvalues(:true, :false)
defaultto false defaultto false
end end
autorequire(:package) do
'swift'
end
end end

View File

@ -37,4 +37,9 @@ Puppet::Type.newtype(:swift_object_config) do
newvalues(:true, :false) newvalues(:true, :false)
defaultto false defaultto false
end end
autorequire(:package) do
'swift-object'
end
end end

View File

@ -37,4 +37,9 @@ Puppet::Type.newtype(:swift_proxy_config) do
newvalues(:true, :false) newvalues(:true, :false)
defaultto false defaultto false
end end
autorequire(:package) do
'swift-proxy'
end
end end

View File

@ -84,8 +84,6 @@ class swift::bench (
$delete = 'yes', $delete = 'yes',
){ ){
Package['swift'] -> Swift_bench_config<||>
swift_bench_config { swift_bench_config {
'bench/auth': value => $auth_url; 'bench/auth': value => $auth_url;
'bench/user': value => $swift_user; 'bench/user': value => $swift_user;

View File

@ -82,7 +82,6 @@ class swift::dispersion (
include ::swift::params include ::swift::params
Package['swift'] -> Swift_dispersion_config<||>
Swift_dispersion_config<||> ~> Exec['swift-dispersion-populate'] Swift_dispersion_config<||> ~> Exec['swift-dispersion-populate']
file { '/etc/swift/dispersion.conf': file { '/etc/swift/dispersion.conf':

View File

@ -37,8 +37,6 @@ class swift(
include ::swift::params include ::swift::params
File['/etc/swift/swift.conf'] -> Swift_config <||>
if !defined(Package['swift']) { if !defined(Package['swift']) {
package { 'swift': package { 'swift':
ensure => $package_ensure, ensure => $package_ensure,

View File

@ -37,10 +37,6 @@ describe 'swift::bench' do
shared_examples 'swift::bench' do shared_examples 'swift::bench' do
let (:p) { default_params.merge!(params) } let (:p) { default_params.merge!(params) }
it 'depends on swift package' do
is_expected.to contain_package('swift').with_before(/Swift_bench_config\[.+\]/)
end
it 'configures swift-bench.conf' do it 'configures swift-bench.conf' do
is_expected.to contain_swift_bench_config( is_expected.to contain_swift_bench_config(
'bench/auth').with_value(p[:auth_url]) 'bench/auth').with_value(p[:auth_url])

View File

@ -39,10 +39,6 @@ describe 'swift::dispersion' do
shared_examples 'swift::dispersion' do shared_examples 'swift::dispersion' do
let (:p) { default_params.merge!(params) } let (:p) { default_params.merge!(params) }
it 'depends on swift package' do
is_expected.to contain_package('swift').with_before(/Swift_dispersion_config\[.+\]/)
end
it 'configures dispersion.conf' do it 'configures dispersion.conf' do
is_expected.to contain_swift_dispersion_config( is_expected.to contain_swift_dispersion_config(
'dispersion/auth_url').with_value(p[:auth_url]) 'dispersion/auth_url').with_value(p[:auth_url])

View File

@ -0,0 +1,42 @@
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'inifile',
'lib')
)
require 'spec_helper'
provider_class = Puppet::Type.type(:swift_account_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::Swift_account_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::Swift_account_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
end

View File

@ -0,0 +1,42 @@
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'inifile',
'lib')
)
require 'spec_helper'
provider_class = Puppet::Type.type(:swift_bench_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::Swift_bench_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::Swift_bench_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
end

View File

@ -0,0 +1,42 @@
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'inifile',
'lib')
)
require 'spec_helper'
provider_class = Puppet::Type.type(:swift_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::Swift_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::Swift_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
end

View File

@ -0,0 +1,42 @@
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'inifile',
'lib')
)
require 'spec_helper'
provider_class = Puppet::Type.type(:swift_container_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::Swift_container_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::Swift_container_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
end

View File

@ -0,0 +1,42 @@
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'inifile',
'lib')
)
require 'spec_helper'
provider_class = Puppet::Type.type(:swift_dispersion_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::Swift_dispersion_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::Swift_dispersion_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
end

View File

@ -0,0 +1,42 @@
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'inifile',
'lib')
)
require 'spec_helper'
provider_class = Puppet::Type.type(:swift_object_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::Swift_object_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::Swift_object_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
end

View File

@ -0,0 +1,42 @@
$LOAD_PATH.push(
File.join(
File.dirname(__FILE__),
'..',
'..',
'..',
'fixtures',
'modules',
'inifile',
'lib')
)
require 'spec_helper'
provider_class = Puppet::Type.type(:swift_proxy_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::Swift_proxy_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::Swift_proxy_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
end

View File

@ -0,0 +1,19 @@
require 'puppet'
require 'puppet/type/swift_account_config'
describe 'Puppet::Type.type(:swift_account_config)' do
before :each do
@swift_account_config = Puppet::Type.type(:swift_account_config).new(:name => 'DEFAULT/foo', :value => 'bar')
end
it 'should autorequire the package that install the file' do
catalog = Puppet::Resource::Catalog.new
package = Puppet::Type.type(:package).new(:name => 'swift-account')
catalog.add_resource package, @swift_account_config
dependency = @swift_account_config.autorequire
expect(dependency.size).to eq(1)
expect(dependency[0].target).to eq(@swift_account_config)
expect(dependency[0].source).to eq(package)
end
end

View File

@ -0,0 +1,19 @@
require 'puppet'
require 'puppet/type/swift_bench_config'
describe 'Puppet::Type.type(:swift_bench_config)' do
before :each do
@swift_bench_config = Puppet::Type.type(:swift_bench_config).new(:name => 'DEFAULT/foo', :value => 'bar')
end
it 'should autorequire the package that install the file' do
catalog = Puppet::Resource::Catalog.new
package = Puppet::Type.type(:package).new(:name => 'swift')
catalog.add_resource package, @swift_bench_config
dependency = @swift_bench_config.autorequire
expect(dependency.size).to eq(1)
expect(dependency[0].target).to eq(@swift_bench_config)
expect(dependency[0].source).to eq(package)
end
end

View File

@ -0,0 +1,19 @@
require 'puppet'
require 'puppet/type/swift_config'
describe 'Puppet::Type.type(:swift_config)' do
before :each do
@swift_config = Puppet::Type.type(:swift_config).new(:name => 'DEFAULT/foo', :value => 'bar')
end
it 'should autorequire the package that install the file' do
catalog = Puppet::Resource::Catalog.new
package = Puppet::Type.type(:package).new(:name => 'swift')
catalog.add_resource package, @swift_config
dependency = @swift_config.autorequire
expect(dependency.size).to eq(1)
expect(dependency[0].target).to eq(@swift_config)
expect(dependency[0].source).to eq(package)
end
end

View File

@ -0,0 +1,19 @@
require 'puppet'
require 'puppet/type/swift_container_config'
describe 'Puppet::Type.type(:swift_container_config)' do
before :each do
@swift_container_config = Puppet::Type.type(:swift_container_config).new(:name => 'DEFAULT/foo', :value => 'bar')
end
it 'should autorequire the package that install the file' do
catalog = Puppet::Resource::Catalog.new
package = Puppet::Type.type(:package).new(:name => 'swift-container')
catalog.add_resource package, @swift_container_config
dependency = @swift_container_config.autorequire
expect(dependency.size).to eq(1)
expect(dependency[0].target).to eq(@swift_container_config)
expect(dependency[0].source).to eq(package)
end
end

View File

@ -0,0 +1,19 @@
require 'puppet'
require 'puppet/type/swift_dispersion_config'
describe 'Puppet::Type.type(:swift_dispersion_config)' do
before :each do
@swift_dispersion_config = Puppet::Type.type(:swift_dispersion_config).new(:name => 'DEFAULT/foo', :value => 'bar')
end
it 'should autorequire the package that install the file' do
catalog = Puppet::Resource::Catalog.new
package = Puppet::Type.type(:package).new(:name => 'swift')
catalog.add_resource package, @swift_dispersion_config
dependency = @swift_dispersion_config.autorequire
expect(dependency.size).to eq(1)
expect(dependency[0].target).to eq(@swift_dispersion_config)
expect(dependency[0].source).to eq(package)
end
end

View File

@ -0,0 +1,19 @@
require 'puppet'
require 'puppet/type/swift_object_config'
describe 'Puppet::Type.type(:swift_object_config)' do
before :each do
@swift_object_config = Puppet::Type.type(:swift_object_config).new(:name => 'DEFAULT/foo', :value => 'bar')
end
it 'should autorequire the package that install the file' do
catalog = Puppet::Resource::Catalog.new
package = Puppet::Type.type(:package).new(:name => 'swift-object')
catalog.add_resource package, @swift_object_config
dependency = @swift_object_config.autorequire
expect(dependency.size).to eq(1)
expect(dependency[0].target).to eq(@swift_object_config)
expect(dependency[0].source).to eq(package)
end
end

View File

@ -0,0 +1,19 @@
require 'puppet'
require 'puppet/type/swift_proxy_config'
describe 'Puppet::Type.type(:swift_proxy_config)' do
before :each do
@swift_proxy_config = Puppet::Type.type(:swift_proxy_config).new(:name => 'DEFAULT/foo', :value => 'bar')
end
it 'should autorequire the package that install the file' do
catalog = Puppet::Resource::Catalog.new
package = Puppet::Type.type(:package).new(:name => 'swift-proxy')
catalog.add_resource package, @swift_proxy_config
dependency = @swift_proxy_config.autorequire
expect(dependency.size).to eq(1)
expect(dependency[0].target).to eq(@swift_proxy_config)
expect(dependency[0].source).to eq(package)
end
end