Hi all, I''d got the impression that puppet didn''t care about ordering - ie. the ordering of imports and includes related to calling them in the manifest. Lately I''ve had big trouble getting puppet to accept that I require some resource that I _have_ defined elsewhere in the manifest. To explain it, here is a simplified example: site.pp: -------- import "class/*.pp" import "nodes/*.pp" import "packages/*.pp" node base { include base } node debian_base inherits base { include debian } nodes/internal.pp: ---------- node "foo.bar.com" inherits debian_base { include postfix } class/base.pp: -------------- class base { include monit } packages/postfix.pp: -------------------- class postfix { file { "/etc/monit/conf.d/postfix": content => template("monit/postfix.erb"), require => Package["monit"], } bla.... bla.... } packages/monit.pp: ------------------ class monit { package { "monit": ensure => latest, } } With this setup, I get the following error: Could not retrieve dependency ''Package[monit]'' But - if I move the "include base" statement out of the node definition and have it directly in site.pp it works. :-/ Can''t quite figure out if it''s me that is doing it all wrong, but I don''t know how to do it different and keep the functionality I want. Can someone shed some light on this...? -- Med venlig hilsen/Best regards Juri Rischel Jensen Fab:IT ApS Vesterbrogade 50 DK-1620 København Tlf: 70 202 407 / Fax: 33 313 640 www.fab-it.dk / juri@fab-it.dk
On May 2, 2007, at 10:16 AM, Juri Rischel Jensen wrote:> But - if I move the "include base" statement out of the node > definition and have it directly in site.pp it works. :-/ > > Can''t quite figure out if it''s me that is doing it all wrong, but I > don''t know how to do it different and keep the functionality I want. > > Can someone shed some light on this...?This *might* be a naming issue -- can you try renaming your base node to ''basenode'' and see if that fixes things? I thought I fixed any possibility of name clashes, but that might be the problem here. That''s the only thing I can think of, because I can promise you that this part of Puppet is clearly order-independent. -- There are three kinds of death in this world. There''s heart death, there''s brain death, and there''s being off the network. -- Guy Almes --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
On May 2, 2007, at 18:44, Luke Kanies wrote:> On May 2, 2007, at 10:16 AM, Juri Rischel Jensen wrote: >> But - if I move the "include base" statement out of the node >> definition and have it directly in site.pp it works. :-/ >> >> Can''t quite figure out if it''s me that is doing it all wrong, but I >> don''t know how to do it different and keep the functionality I want. >> >> Can someone shed some light on this...? > > > This *might* be a naming issue -- can you try renaming your base node > to ''basenode'' and see if that fixes things?It fixes it - thanks!> I thought I fixed any possibility of name clashes, but that might be > the problem here. > > That''s the only thing I can think of, because I can promise you that > this part of Puppet is clearly order-independent.Hmm, there is _some_ ordering problems. To refer to my last example: site.pp: -------- import "class/*.pp" import "nodes/*.pp" import "packages/*.pp" node base_node { include base_packages } node debian_base inherits base_node { $dv = "sarge" <--- I set this variable in the debian_base node include debian } nodes/internal.pp: ---------- node "foo.bar.com" inherits debian_base { $dv = "etch" <--- And I try to overwrite it on a node basis if needed include postfix } This gets $dv = sarge on puppettester - not exactly what I want... ;-) -- Med venlig hilsen Juri Rischel Jensen Fab:IT ApS Vesterbrogade 50 DK-1620 København Tlf: 70 202 407 / Fax: 33 313 640 www.fab-it.dk / juri@fab-it.dk
On May 2, 2007, at 2:37 PM, Juri Rischel Jensen wrote:>> >> This *might* be a naming issue -- can you try renaming your base node >> to ''basenode'' and see if that fixes things? > > It fixes it - thanks!Would you be willing to file that as a bug? There should either be an error there or things should resolve correctly.> Hmm, there is _some_ ordering problems. To refer to my last example: > > site.pp: > -------- > import "class/*.pp" > import "nodes/*.pp" > import "packages/*.pp" > > node base_node { > include base_packages > } > > node debian_base inherits base_node { > $dv = "sarge" <--- I set this variable in the > debian_base node > include debian > } > > nodes/internal.pp: > ---------- > node "foo.bar.com" inherits debian_base { > $dv = "etch" <--- And I try to overwrite it on a > node basis if needed > include postfix > } > > This gets $dv = sarge on puppettester - not exactly what I want... ;-)This is exactly the discussion we''ve been having in other threads on the list -- subclasses and subnodes can''t change variables for classes included by parent classes. In this case, there''s no way for the ''debian'' class to look at variables set in a subnode of debian_base. It''s not so much ordering as an inheritance problem. I''d create a ''debian_etch'' subclass and have that override as necessary, then include that class on the appropirate nodes. -- Nonreciprocal Laws of Expectations: Negative expectations yield negative results. Positive expectations yield negative results. --------------------------------------------------------------------- Luke Kanies | http://reductivelabs.com | http://madstop.com
On May 2, 2007, at 21:41, Luke Kanies wrote:> Would you be willing to file that as a bug? There should either be > an error there or things should resolve correctly.Yes of course. It''s done (#620). <snip>> This is exactly the discussion we''ve been having in other threads on > the list -- subclasses and subnodes can''t change variables for > classes included by parent classes. In this case, there''s no way for > the ''debian'' class to look at variables set in a subnode of > debian_base. It''s not so much ordering as an inheritance problem.Ok. I haven''t been able to follow all the discussions on the list - I simply don''t have the time right now.> I''d create a ''debian_etch'' subclass and have that override as > necessary, then include that class on the appropirate nodes.I''ll try that. Thanks for the advice! -- Med venlig hilsen Juri Rischel Jensen Fab:IT ApS Vesterbrogade 50 DK-1620 København Tlf: 70 202 407 / Fax: 33 313 640 www.fab-it.dk / juri@fab-it.dk