Issue #20972 has been updated by Michael Stahnke. Project changed from Puppet Enterprise (Public) to Puppet
moving to core puppet ---------------------------------------- Bug #20972: create_resources cannot access virtual defined types https://projects.puppetlabs.com/issues/20972#change-92451 * Author: Matthew Pounsett * Status: Unreviewed * Priority: Normal * Assignee: * Category: * Target version: * Affected Puppet version: * Keywords: create_resources, namespace * Branch: ---------------------------------------- create_resources appears to have a namespace bug that prevents it from creating virtual resources from defined types. For example, given these files: # hieradata/common.yaml messages: one: comment: This is one two: comment: This is two # modules/mytype/manifests/init.pp define mytype ( $comment = "Default comment" ){ notify { "${title}: ${comment}": } } # modules/mymodule/manifests/init.pp class mymodule { $some_data = hiera_hash('messages') create_resources("@mytype", $some_data) Mytype <||> } An agent run results in the following error: err: Could not retrieve catalog from remote server: Error 400 on SERVER: could not create resource of unknown type @mytype at /etc/puppetlabs/puppet/modules/mymodule/manifests/init.pp:4 on node xyz However, if you modify the last file this way: # modules/mytype/manifests/init.pp class mymodule { $some_data = hiera_hash('messages') create_resources("mymodule::wrapper", $some_data) Mytype <||> } define mymodule::wrapper ( $comment = "Wrapper default" ) { @mytype { $title: comment => $comment } } Then the agent run works: notice: two: This is two notice: /Stage[main]/Mymodule/Mymodule::Wrapper[two]/Mytype[two]/Notify[two: This is two]/message: defined 'message' as 'two: This is two' notice: one: This is one notice: /Stage[main]/Mymodule/Mymodule::Wrapper[one]/Mytype[one]/Notify[one: This is one]/message: defined 'message' as 'one: This is one' notice: Finished catalog run in 6.56 seconds This is a problem because it requires the creation of wrappers for defined types which must be maintained.. any changes to the parameters of the defined type need to be reproduced in these copies that wrap it. Alterations of the defined type in this case should be as simple as modifying the type and then modifying the data to match. -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://projects.puppetlabs.com/my/account -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/puppet-bugs?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
