Merge "Rely on autorequire for config resource ordering"

This commit is contained in:
Jenkins
2015-08-13 09:26:47 +00:00
committed by Gerrit Code Review
5 changed files with 21 additions and 8 deletions

View File

@@ -39,4 +39,9 @@ Puppet::Type.newtype(:nova_config) do
defaultto false
end
autorequire(:package) do
'nova-common'
end
end

View File

@@ -40,4 +40,8 @@ Puppet::Type.newtype(:nova_paste_api_ini) do
defaultto false
end
autorequire(:package) do
'nova-common'
end
end

View File

@@ -188,8 +188,6 @@ class nova::api(
require ::keystone::python
include ::cinder::client
Package<| title == 'nova-api' |> -> Nova_paste_api_ini<| |>
Package<| title == 'nova-common' |> -> Class['nova::api']
Package<| title == 'nova-common' |> -> Class['nova::policy']

View File

@@ -411,12 +411,6 @@ class nova(
}
}
# all nova_config resources should be applied
# after the nova common package
# before the file resource for nova.conf is managed
# and before the post config resource
Package['nova-common'] -> Nova_config<| |> -> File['/etc/nova/nova.conf']
Nova_config<| |> ~> Exec['post-nova_config']
# TODO - see if these packages can be removed

View File

@@ -49,4 +49,16 @@ describe 'Puppet::Type.type(:nova_config)' do
@nova_config[:ensure] = :latest
}.to raise_error(Puppet::Error, /Invalid value/)
end
it 'should autorequire the package that install the file' do
catalog = Puppet::Resource::Catalog.new
package = Puppet::Type.type(:package).new(:name => 'nova-common')
catalog.add_resource package, @nova_config
dependency = @nova_config.autorequire
expect(dependency.size).to eq(1)
expect(dependency[0].target).to eq(@nova_config)
expect(dependency[0].source).to eq(package)
end
end