Details
Description
You should be able to declare parameterized classes via crete_resources().
If you use a hash like:
---
|
classes:
|
testfoo::class2: {}
|
testfoo::class1:
|
require: Class['testfoo::class2']
|
and code like:
$classes = hiera_hash('classes')
|
create_resources('class', $classes)
|
you wind up with an error like:
Invalid relationship: Class[testfoo::class1] { require => Class[testfoo::class2] }, because Class[testfoo::class2] doesn't seem to be in the catalog.
|
However, specifying the hash in the manifest and using puppet apply works:
# cat ~/test.pp
|
class test1 { notify { 'test1': } }
|
class test2 { notify { 'test2': } }
|
|
$classhash = {
|
'test1' => { 'require' => "Class[test2]" },
|
'test2' => { }
|
}
|
|
create_resources('class', $classhash)
|
# puppet apply test.pp
|
Notice: Compiled catalog for pe-372-master.puppetdebug.vlan in environment production in 0.06 seconds
|
Notice: test2
|
Notice: /Stage[main]/Test2/Notify[test2]/message: defined 'message' as 'test2'
|
Notice: test1
|
Notice: /Stage[main]/Test1/Notify[test1]/message: defined 'message' as 'test1'
|
Notice: Finished catalog run in 0.23 seconds
|
QA Risk Analysis
N/A for unreproducible bugs