I have the following class which purely initiates the create_resource function:
class server_packages ( $server_packages, $enable_repo = '*' ){ Package { install_options => [ { '--disablerepo' => '*' } , { '--enablerepo' => $enable_repo }] } create_resources(package, $server_packages,) } This is called in a profile: class { 'server_packages': # list of packages server_packages => hiera('server_packages'), enable_repo => 'my-rpms,base', } class { 'some_class': # params here } Puppet run: Notice: Compiled catalog for automation01 in environment production in 2.44 seconds Notice: /Stage[main]/Server_packages/Package[gcc-c++]/ensure: current_value absent, should be present (noop) Notice: /Stage[main]/Server_packages/Package[openssl-devel]/ensure: current_value absent, should be present (noop) Notice: /Stage[main]/Server_packages/Package[apr-util-devel]/ensure: current_value absent, should be present (noop) Notice: /Stage[main]/Server_packages/Package[mysql.x86_64]/ensure: current_value absent, should be present (noop) Notice: /Stage[main]/Server_packages/Package[glibc-devel.i686]/ensure: current_value absent, should be present (noop) Notice: /Stage[main]/Server_packages/Package[libffi-devel]/ensure: current_value absent, should be present (noop) Notice: /Stage[main]/Server_packages/Package[apr-devel]/ensure: current_value absent, should be present (noop) Notice: /Stage[main]/Server_packages/Package[gcc]/ensure: current_value absent, should be present (noop) Notice: /Stage[main]/Server_packages/Package[zlib-devel]/ensure: current_value absent, should be present (noop) Notice: /Stage[main]/Server_packages/Package[libcurl-devel]/ensure: current_value absent, should be present (noop) Notice: /Stage[main]/Server_packages/Package[httpd-devel]/ensure: current_value absent, should be present (noop) Notice: /Stage[main]/Server_packages/Package[sqlite-devel]/ensure: current_value absent, should be present (noop) Notice: /Stage[main]/Server_packages/Package[jre]/ensure: current_value absent, should be 1.7.0_79-fcs (noop) Notice: /Stage[main]/Server_packages/Package[httpd]/ensure: current_value absent, should be present (noop) Notice: /Stage[main]/some_class::Install/Package[app]/ensure: current_value absent, should be 1.0-1 (noop) Notice: Class[some_class::Install]: Would have triggered 'refresh' from 1 events Notice: /Stage[main]/some_class::Config/File[/etc/init.d/appservice]/ensure: current_value absent, should be file (noop) Notice: /Stage[main]/some_class::Config/File[/opt/vendor]/ensure: current_value absent, should be directory (noop) Notice: /Stage[main]/some_class::Config/File[/opt/vendor/product-some_class/current/config/b.json]/ensure: current_value absent, should be present (noop) Notice: /Stage[main]/some_class::Config/File[/opt/vendor/product-some_class/current/scripts/run.rb]/ensure: current_value absent, should be present (noop) Notice: /Stage[main]/some_class::Config/File[/opt/app]/ensure: current_value absent, should be present (noop) Notice: /Stage[main]/some_class::Config/File[/opt/app/gem.sh]/ensure: current_value absent, should be file (noop) Notice: /Stage[main]/some_class::Config/File[/opt/app/.bash_profile]/ensure: current_value absent, should be file (noop) Notice: /Stage[main]/some_class::Config/File[/opt/app/app_stop.sh]/ensure: current_value absent, should be file (noop) Notice: /Stage[main]/some_class::Config/File[/etc/logrotate.d/app]/ensure: current_value absent, should be file (noop) Notice: /Stage[main]/some_class::Config/File[/opt/vendor/product-some_class/current/config/config.json]/ensure: current_value absent, should be present (noop) Notice: /Stage[main]/some_class::Config/File[/opt/vendor/product-some_class/mbct/mbct.properties]/ensure: current_value absent, should be present (noop) Notice: /Stage[main]/some_class::Config/File[/opt/app/app_startup.sh]/ensure: current_value absent, should be file (noop) Notice: /Stage[main]/some_class::Config/File[/opt/ffmpeg]/ensure: current_value absent, should be directory (noop) Notice: Class[some_class::Config]: Would have triggered 'refresh' from 13 events Notice: /Stage[main]/some_class::Gem_install/Exec[/opt/app/gem.sh]/returns: current_value notrun, should be 0 (noop) Notice: Class[some_class::Gem_install]: Would have triggered 'refresh' from 1 events Notice: /Stage[main]/some_class::Service/Service[appservice]/ensure: current_value stopped, should be running (noop) Notice: /Stage[main]/some_class::Service/Service[httpd]/ensure: current_value stopped, should be running (noop) Notice: Class[some_class::Service]: Would have triggered 'refresh' from 2 events Notice: /Stage[main]/Server_packages/Package[mysql-devel.x86_64]/ensure: current_value absent, should be present (noop) As you can see in the output above server_packges will be executed again after the execution of some_class: Notice: Class[some_class::Service]: Would have triggered 'refresh' from 2 events Notice: /Stage[main]/Server_packages/Package[mysql-devel.x86_64]/ensure: current_value absent, should be present (noop) I came across the following which seems to highlight the problem but it was fixed in an older version: *create_resources should contain native types in the local scope* https://projects.puppetlabs.com/issues/8032 -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/19d3bd29-f8cf-4cb6-8bb9-3a980109de5a%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.