Merge "Rely on autorequire for config resource ordering"
This commit is contained in:
@@ -39,4 +39,9 @@ Puppet::Type.newtype(:nova_config) do
|
||||
|
||||
defaultto false
|
||||
end
|
||||
|
||||
autorequire(:package) do
|
||||
'nova-common'
|
||||
end
|
||||
|
||||
end
|
||||
|
@@ -40,4 +40,8 @@ Puppet::Type.newtype(:nova_paste_api_ini) do
|
||||
defaultto false
|
||||
end
|
||||
|
||||
autorequire(:package) do
|
||||
'nova-common'
|
||||
end
|
||||
|
||||
end
|
||||
|
@@ -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']
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user