If I have: class service::common { file { ''/etc/foo'': ensure => directory; ''/etc/init.d/ss-functions'': content => template(''service/etc/init.d/ss-functions.erb''), require => File[''/etc/foo''], } } class platform::common { include service::common File { require => Class[''service::common''] } } then puppet is telling me: Aug 17 09:47:01 test01 puppet-agent[14530]: Could not apply complete catalog: Found 1 dependency cycle: (File[/etc/foo] => Class[Service::Common] => File[/etc/foo]) Try the ''--graph'' option and opening the resulting ''.dot'' file in OmniGraffle or GraphViz I don''t get it. How does /etc/foo depend on Service::Common? I mean, it''s IN that class... is that why it depends on it? Debugging these is awful... Doug, -- 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.
Don''t think you need to include if there is a require On Aug 17, 2011 9:50 AM, "Douglas Garstang" <doug.garstang@gmail.com> wrote:> If I have: > > class service::common { > file { > ''/etc/foo'': > ensure => directory; > > ''/etc/init.d/ss-functions'': > content => template(''service/etc/init.d/ss-functions.erb''), > require => File[''/etc/foo''], > } > } > > class platform::common { > include service::common > File { > require => Class[''service::common''] > } > } > > then puppet is telling me: > Aug 17 09:47:01 test01 puppet-agent[14530]: Could not apply complete > catalog: Found 1 dependency cycle: (File[/etc/foo] =>Class[Service::Common]> => File[/etc/foo]) Try the ''--graph'' option and opening the resulting''.dot''> file in OmniGraffle or GraphViz > > I don''t get it. How does /etc/foo depend on Service::Common? I mean, it''sIN> that class... is that why it depends on it? Debugging these is awful... > > Doug, > > -- > 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 topuppet-users+unsubscribe@googlegroups.com.> For more options, visit this group athttp://groups.google.com/group/puppet-users?hl=en.>-- 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.
Oh. I didn''t realise that. Thought it was.... darn.... Thanks. On Wed, Aug 17, 2011 at 10:52 AM, Scott Smith <scott@ohlol.net> wrote:> Don''t think you need to include if there is a require > On Aug 17, 2011 9:50 AM, "Douglas Garstang" <doug.garstang@gmail.com> > wrote: > > If I have: > > > > class service::common { > > file { > > ''/etc/foo'': > > ensure => directory; > > > > ''/etc/init.d/ss-functions'': > > content => template(''service/etc/init.d/ss-functions.erb''), > > require => File[''/etc/foo''], > > } > > } > > > > class platform::common { > > include service::common > > File { > > require => Class[''service::common''] > > } > > } > > > > then puppet is telling me: > > Aug 17 09:47:01 test01 puppet-agent[14530]: Could not apply complete > > catalog: Found 1 dependency cycle: (File[/etc/foo] => > Class[Service::Common] > > => File[/etc/foo]) Try the ''--graph'' option and opening the resulting > ''.dot'' > > file in OmniGraffle or GraphViz > > > > I don''t get it. How does /etc/foo depend on Service::Common? I mean, it''s > IN > > that class... is that why it depends on it? Debugging these is awful... > > > > Doug, > > > > -- > > 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. > > > > -- > 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. >-- Regards, Douglas Garstang http://www.linkedin.com/in/garstang Email: doug.garstang@gmail.com Cell: +1-805-340-5627 -- 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.
Actually, no, I think you DO need it. On Wed, Aug 17, 2011 at 11:30 AM, Douglas Garstang <doug.garstang@gmail.com>wrote:> Oh. I didn''t realise that. Thought it was.... darn.... Thanks. > > > On Wed, Aug 17, 2011 at 10:52 AM, Scott Smith <scott@ohlol.net> wrote: > >> Don''t think you need to include if there is a require >> On Aug 17, 2011 9:50 AM, "Douglas Garstang" <doug.garstang@gmail.com> >> wrote: >> > If I have: >> > >> > class service::common { >> > file { >> > ''/etc/foo'': >> > ensure => directory; >> > >> > ''/etc/init.d/ss-functions'': >> > content => template(''service/etc/init.d/ss-functions.erb''), >> > require => File[''/etc/foo''], >> > } >> > } >> > >> > class platform::common { >> > include service::common >> > File { >> > require => Class[''service::common''] >> > } >> > } >> > >> > then puppet is telling me: >> > Aug 17 09:47:01 test01 puppet-agent[14530]: Could not apply complete >> > catalog: Found 1 dependency cycle: (File[/etc/foo] => >> Class[Service::Common] >> > => File[/etc/foo]) Try the ''--graph'' option and opening the resulting >> ''.dot'' >> > file in OmniGraffle or GraphViz >> > >> > I don''t get it. How does /etc/foo depend on Service::Common? I mean, >> it''s IN >> > that class... is that why it depends on it? Debugging these is awful... >> > >> > Doug, >> > >> > -- >> > 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. >> > >> >> -- >> 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. >> > > > > -- > Regards, > > Douglas Garstang > http://www.linkedin.com/in/garstang > Email: doug.garstang@gmail.com > Cell: +1-805-340-5627 > >-- Regards, Douglas Garstang http://www.linkedin.com/in/garstang Email: doug.garstang@gmail.com Cell: +1-805-340-5627 -- 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.
On Aug 17, 1:32 pm, Douglas Garstang <doug.garst...@gmail.com> wrote:> Actually, no, I think you DO need it.Indeed yes. You cannot ''require'' a resource or class that is not declared into the node''s catalog. The ''require'' parameter does not do that for you. The include doesn''t necessarily need to be in the same class, but putting it there ensures that it is present; I consider it a best practice to do that. As for the dependency, I think it likely that your File[''foo''] depends on Class[''service::common''] by virtue of being declared by that class. I didn''t previously know that it worked that way, but it makes sense. Resources have access to the variables and other resources declared by their declaring class, and a dependency makes that work. I can see two possible workarounds; 1) Supposing that you mean the File property defaults to apply only to files declared in class platform::common, and not to those declared in other classes included by platform::common, I think you can achieve that by wrapping all platform::common''s own resources into an inner class: class platform::common { include service::common include platform::common::internal class platform::common::internal { File { require => Class[''service::common''] } # resources... } } In general, it''s dangerous to include classes into a scope wherein resource defaults apply. It''s not necessarily wrong, but it does break encapsulation. 2) You could use the ''require'' function or the resource chaining operators to set up a class dependency, instead of using resource defaults: class platform::common { require service::common } Note that unlike the same-named resource parameter, the ''require'' *function* does make ''include'' unnecessary. John -- 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.