Hello,
I have a module that includes several other modules to setup a developer
workstation.
Several classes have to run according to a predefined order so I''m
using
resource chaining for this.
But the problem is that a certain module I include follows the principles of
Example42 ''s Puppet modules of splitting up resources in classes
according
to the operating system.
Example:
class sunjdk {
include sunjdk::params
case $operatingsystem {
redhat, centos: { include sunjdk::redhat }
ubuntu: { include sunjdk::ubuntu }
default: {}
}
}
When I include this specific class in my developer-workstation module below,
the resource chaining doesn''t work anymore..
class dev-workstation-setup($user) {
File["install-dir"] -> File["data-dir"] ->
Class["vcs"] ->
Class["sunjdk"] -> Class["apache-ant"] ->
Class["apache-tomcat"] ->
Class["eclipse"]
$install_root = "/opt"
$data_root = "/data"
file {
"install-dir" :
ensure => directory,
path => "${install_root}",
owner => "$user",
group => "$user";
"data-dir" :
ensure => directory,
path => "${data_root}",
owner => "$user",
group => "$user";
}
include sunjdk
include vcs
class { "apache-ant" :
user => "$user",
}
class { "apache-tomcat" :
user => "$user",
}
class { "eclipse" :
user => "$user",
}
}
Does anyone have any idea on how to fix this?
Can this be a bug in Puppet? Or am i doing something wrong?
Thanks in advance...
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/puppet-users/-/3EEm7U1oWPsJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to
puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
On Sat, Aug 13, 2011 at 10:01 AM, dieterdm <dieterdemeyer@gmail.com> wrote:> Hello, > > I have a module that includes several other modules to setup a developer > workstation. > Several classes have to run according to a predefined order so I''m using > resource chaining for this. > But the problem is that a certain module I include follows the principles > of Example42 ''s Puppet modules of splitting up resources in classes > according to the operating system. > Example: > > class sunjdk { > > include sunjdk::params > > case $operatingsystem { > redhat, centos: { include sunjdk::redhat } > ubuntu: { include sunjdk::ubuntu } > default: {} > } > > } > > > When I include this specific class in my developer-workstation module > below, the resource chaining doesn''t work anymore.. > > class dev-workstation-setup($user) { > > File["install-dir"] -> File["data-dir"] -> Class["vcs"] -> > Class["sunjdk"] -> Class["apache-ant"] -> Class["apache-tomcat"] -> > Class["eclipse"] > > $install_root = "/opt" > $data_root = "/data" > > file { > "install-dir" : > ensure => directory, > path => "${install_root}", > owner => "$user", > group => "$user"; > > "data-dir" : > ensure => directory, > path => "${data_root}", > owner => "$user", > group => "$user"; > } > > include sunjdk > include vcs > > class { "apache-ant" : > user => "$user", > } > > class { "apache-tomcat" : > user => "$user", > } > > class { "eclipse" : > user => "$user", > } > > } > > Does anyone have any idea on how to fix this? > Can this be a bug in Puppet? Or am i doing something wrong? > > Thanks in advance... >Dieter, Puppet may be non-deterministic, but its parser is top-down, which means that your include statements and class declarations must come BEFORE you do your resource chaining (which references those resources). Put the chain at the bottom of your class and try it again :)> -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/puppet-users/-/3EEm7U1oWPsJ. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. >-- Gary Larizza Professional Services Engineer Puppet Labs Join us for PuppetConf <http://bit.ly/puppetconfsig>, September 22nd and 23rd in Portland, OR! -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Hi, [snip] But the problem is that a certain module I include follows the principles of> Example42 ''s Puppet modules of splitting up resources in classes according > to the operating system. >[snip]> When I include this specific class in my developer-workstation module > below, the resource chaining doesn''t work anymore.. >This smells like bug 8040. The ordering of the resources is not transferred to the included classes. It is possible to work around this problem by declaring dummy resources in the composite class that mark the start and end of the class. The guys from puppetlabs use a custom "anchor" type, but something like a notify seems to work just as well. In the composite class: class composite { notify { "Start of class composite": message => "Start of class composite" } notify { "End of class composite": message => "End of class composite" } ... } Then in the subclasses, use: class composite::sub1 { ... Notify["Start of class composite"] -> Class["composite::sub1"] -> Notify["End of class composite"] } It all looks a bit verbose to me, but as mentioned in bug 8040, this will be fixed in core. Kind regards, kristof>-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
> > This smells like bug 8040. The ordering of the resources is not transferred > to the included classes. > > It is possible to work around this problem by declaring dummy resources in > the composite class that mark > the start and end of the class. The guys from puppetlabs use a custom > "anchor" type, but something > like a notify seems to work just as well. > > In the composite class: > > class composite { > > notify { "Start of class composite": message => "Start of class > composite" } > notify { "End of class composite": message => "End of class composite" > } > > ... > } > > Then in the subclasses, use: > > class composite::sub1 { > > ... > > Notify["Start of class composite"] -> Class["composite::sub1"] -> > Notify["End of class composite"] > } > > It all looks a bit verbose to me, but as mentioned in bug 8040, this will > be fixed in core. > > Kind regards, >Ahh, If resources are being declared out of order, but the catalog still compiles (especially with using subclasses of resources), then this is probably what you''re experiencing. Take a look at the ticket and the graphs therein. The anchor type used in our modules can be found in the puppetlabs-stdlib module, and viewed directly here --> https://github.com/puppetlabs/puppetlabs-stdlib/blob/master/lib/puppet/type/anchor.rbshould you want to implement it, but the notifies are also a nice workaround.> > kristof > >> -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. >-- Gary Larizza Professional Services Engineer Puppet Labs Join us for PuppetConf <http://bit.ly/puppetconfsig>, September 22nd and 23rd in Portland, OR! -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Hi, Thanks for the replies... Currently, I made it work using stages. But I''ll try the approach of putting my resource chaining at the bottom and let you know if it works... Regards. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/hCBlfMcy49wJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
On Wed, Aug 17, 2011 at 8:27 AM, dieterdm <dieterdemeyer@gmail.com> wrote:> Hi, > > Thanks for the replies... > > Currently, I made it work using stages. > But I''ll try the approach of putting my resource chaining at the bottom and > let you know if it works... > >The ordering was my first-guess at the problem, but I would believe it to be incorrect. Instead, I would presume that it is indeed bug 8040 hitting you. Also, check out this comment about bug 8040 also being applicable for Run Stages --> https://projects.puppetlabs.com/issues/5709#note-5 -Gary> Regards. > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/puppet-users/-/hCBlfMcy49wJ. > > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. >-- Gary Larizza Professional Services Engineer Puppet Labs Join us for PuppetConf <http://bit.ly/puppetconfsig>, September 22nd and 23rd in Portland, OR! -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.