Issue #23121 has been updated by Matthaus Owens. Project changed from Puppet Community Package Repository to Puppet
I'm moving this to the puppet core project as this doesn't seem related to our package repositories. ---------------------------------------- Bug #23121: Bug in requires with there are classes into other classes https://projects.puppetlabs.com/issues/23121#change-99766 * Author: Francisco Huertas * Status: Unreviewed * Priority: Normal * Assignee: * Category: * Target version: * Affected Puppet version: * Keywords: require, class, exec * Branch: ---------------------------------------- The dependences are not respect between elements of modules that have dependences among them. I have created a scenario, it has a 2 modules (nada and nada2), the modules creates a list of directories using a script in the agent machine. the code is in [github](https://github.com/fhuertas/puppet-bug) Module "nada", file init.pp: define nada::mkdir ($dir ) { $in_tmp_dir = "${tomcat7::params::tmp_dir}" file { "/tmp/${module_name}-${title}.sh" : mode => 744, owner => root, group => root, content => template("${module_name}/mkdir-${::osfamily}.sh.erb") , } exec { "/tmp/${module_name}-${title}.sh": cwd => "/tmp", require => File["/tmp/${module_name}-${title}.sh"], } } class nada ($not, $dir){ class {"nada::install": dir => "$dir", not => "$not" } } class nada::install ($not, $dir) { nada::mkdir{"dir1-1" : dir => "${dir}-1", } nada::mkdir{"dir1-2" : dir => "${dir}-2", } nada::mkdir{"dir1-3" : dir => "${dir}-3", } } Module nada2, file init.pp: define nada2::mkdir ($dir ) { file { "/tmp/${module_name}-${title}.sh" : mode => 744, owner => root, group => root, content => template("${module_name}/mkdir-${::osfamily}.sh.erb") , } exec { "/tmp/${module_name}-${title}.sh": cwd => "/tmp", require => File["/tmp/${module_name}-${title}.sh"], } } class nada2 ($not, $dir){ class {"nada2::install": dir => "$dir", not => "$not" } } class nada2::install($not, $dir){ nada2::mkdir{"dir2-1" : dir => "${dir}-1", } nada2::mkdir{"dir2-2" : dir => "${dir}-2", } nada2::mkdir{"dir2-3" : dir => "${dir}-3", } nada2::mkdir{"dir2-4" : dir => "${dir}-4", } nada2::mkdir{"dir2-5" : dir => "${dir}-5", } nada2::mkdir{"dir2-6" : dir => "${dir}-6", } } Site.pp: class {'nada' : not => "class1", dir => "/tmp/dir1", } class {'nada2' : not => "class2", dir => "/tmp/dir2", require => Class['nada'], } The result: Notice: /Stage[main]/Nada2::Install/Nada2::Mkdir[dir2-1]/Exec[/tmp/nada2-dir2-1.sh]/returns: executed successfully Notice: /Stage[main]/Nada2::Install/Nada2::Mkdir[dir2-3]/Exec[/tmp/nada2-dir2-3.sh]/returns: executed successfully Notice: /Stage[main]/Nada::Install/Nada::Mkdir[dir1-3]/Exec[/tmp/nada-dir1-3.sh]/returns: executed successfully Notice: /Stage[main]/Nada2::Install/Nada2::Mkdir[dir2-6]/Exec[/tmp/nada2-dir2-6.sh]/returns: executed successfully Notice: /Stage[main]/Nada2::Install/Nada2::Mkdir[dir2-4]/Exec[/tmp/nada2-dir2-4.sh]/returns: executed successfully Notice: /Stage[main]/Nada::Install/Nada::Mkdir[dir1-2]/Exec[/tmp/nada-dir1-2.sh]/returns: executed successfully Notice: /Stage[main]/Nada::Install/Nada::Mkdir[dir1-1]/Exec[/tmp/nada-dir1-1.sh]/returns: executed successfully Notice: /Stage[main]/Nada2::Install/Nada2::Mkdir[dir2-5]/Exec[/tmp/nada2-dir2-5.sh]/returns: executed successfully Notice: /Stage[main]/Nada2::Install/Nada2::Mkdir[dir2-2]/Exec[/tmp/nada2-dir2-2.sh]/returns: executed successfully The bug can be seen in the with the firsts notices: Exec[/tmp/nada2-dir2-1.sh] and Exec[/tmp/nada2-dir2-3.sh] are executed before Exec[/tmp/nada-dir1-3.sh] The requisite of this bug is that there is a middle class (nada::install and nada2::install). If these classes are not, the requisites are respected. I have created a branch in the [repository](https://github.com/fhuertas/puppet-bug/tree/no-bug) where the middle class is not used and the requires are respected: Results: Notice: /Stage[main]/Nada/Nada::Mkdir[dir1-3]/Exec[/tmp/nada-dir1-3.sh]/returns: executed successfully Notice: /Stage[main]/Nada/Nada::Mkdir[dir1-2]/Exec[/tmp/nada-dir1-2.sh]/returns: executed successfully Notice: /Stage[main]/Nada/Nada::Mkdir[dir1-1]/Exec[/tmp/nada-dir1-1.sh]/returns: executed successfully Notice: /Stage[main]/Nada2/Nada2::Mkdir[dir2-1]/Exec[/tmp/nada2-dir2-1.sh]/returns: executed successfully Notice: /Stage[main]/Nada2/Nada2::Mkdir[dir2-3]/Exec[/tmp/nada2-dir2-3.sh]/returns: executed successfully Notice: /Stage[main]/Nada2/Nada2::Mkdir[dir2-2]/Exec[/tmp/nada2-dir2-2.sh]/returns: executed successfully NOTE: I did not put the code of modules but the code is in the [repository](https://github.com/fhuertas/puppet-bug/tree/no-bug) -- 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. For more options, visit https://groups.google.com/groups/opt_out.
