Steve Shipway
2013-Feb-18 09:47 UTC
[Puppet Users] Apparent bug in ''import'' when directory name matches module name
I''ve found an apparent bug in the puppet parser. If you are using ''import'' to include the contents of a subdirectory, like this: import ''foo/*.pp'' and then you create a new module ''foo'', suddenly the import statement silently stops working. This means that any node definitions in the manifests that should have been included are not present, and those nodes fall back to the default node. The ''foo'' module can be completely minimal, just a ''class foo { }'' in the init.pp is enough to break the import. Now, in our case, our default node closes the firewall. When we productionised a new module called ''oracle'', all of the node definitions imported from oracle/*.pp suddenly stopped working, and so all the production oracle servers fell back to the default node definition, and closed their firewalls... Insert the sound of the brown stuff hitting the fan... I have successfully duplicated this, and logged it as a bug on the Puppet bug tracker. A workaround seems to be to add a ''./'' prefix to the imported directory name: import ''./foo/*.pp'' which has the same effect, but is not broken by having a ''foo'' module present. I''ve tried to delve through the parser code to track this one down, but my Ruby skills are not as good as my Perl skills, and I''ve not managed to identify the reason. Possibly the parser creates a new class for the imported directory? I''d be interested in hearing if anyone else has experienced this, or if this clears up odd behaviour you''re experiencing on your system. Also, if you also have the problem, please go to the bug tracker and give this a +1 to help it get higher priority on the fix list... Steve Steve Shipway University of Auckland ITS UNIX Systems Design Lead s.shipway@auckland.ac.nz<mailto:s.shipway@auckland.ac.nz> Ph: +64 9 373 7599 ext 86487 -- 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+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
llowder
2013-Feb-18 14:29 UTC
[Puppet Users] Re: Apparent bug in ''import'' when directory name matches module name
On Monday, February 18, 2013 3:47:40 AM UTC-6, Steve Shipway wrote:> > I''ve found an apparent bug in the puppet parser. > > If you are using ''import'' to include the contents of a subdirectory, like > this: > > import ''foo/*.pp'' > > and then you create a new module ''foo'', suddenly the import statement > silently stops working. This means that any node definitions in the > manifests that should have been included are not present, and those nodes > fall back to the default node. The ''foo'' module can be completely minimal, > just a ''class foo { }'' in the init.pp is enough to break the import. > > Now, in our case, our default node closes the firewall. When we > productionised a new module called ''oracle'', all of the node definitions > imported from oracle/*.pp suddenly stopped working, and so all the > production oracle servers fell back to the default node definition, and > closed their firewalls... Insert the sound of the brown stuff hitting the > fan... > > I have successfully duplicated this, and logged it as a bug on the Puppet > bug tracker. A workaround seems to be to add a ''./'' prefix to the imported > directory name: > > import ''./foo/*.pp'' > > which has the same effect, but is not broken by having a ''foo'' module > present. > > I''ve tried to delve through the parser code to track this one down, but my > Ruby skills are not as good as my Perl skills, and I''ve not managed to > identify the reason. Possibly the parser creates a new class for the > imported directory? > > I''d be interested in hearing if anyone else has experienced this, or if > this clears up odd behaviour you''re experiencing on your system. Also, if > you also have the problem, please go to the bug tracker and give this a +1 > to help it get higher priority on the fix list... > > Steve > >I have been working on a similar bug. The root cause (of #1372 (http://projects.puppetlabs.com/issues/1372) ) seems to be that nodes are treated as classes,and both get loaded into top scope. I''ll look into this one as well, I''m expecting to be able to spend time on it this week.> > *Steve Shipway* > University of Auckland ITS > *UNIX Systems Design Lead* > s.sh...@auckland.ac.nz <javascript:> > Ph: +64 9 373 7599 ext 86487 > ** >-- 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+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.