Issue #4472 has been updated by James Turnbull.

Status changed from Unreviewed to Accepted


----------------------------------------
Bug #4472: Autoloading of .pp files doesn't search all namespace nestings
http://projects.puppetlabs.com/issues/4472

Author: Paul Berry
Status: Accepted
Priority: Normal
Assigned to: Paul Berry
Category: 
Target version: 
Affected version: 2.6.1rc1
Keywords: 
Branch: 


I found this bug while investigating issue #4211.  The failure applies to 
0.25.5 as well as 2.6.1rc1.

The following (admittedly contrived) example works if it is all in one source 
file:

<pre>
class baz1 {
  notify {"baz1": }
}
class foo::baz2 {
  notify {"baz2": }
}
class foo::bar::baz3 {
  notify {"baz3": }
}
class foo::bar {
  class x inherits baz1 { }
  class y inherits baz2 { }
  class z inherits baz3 { }
}
include foo::bar::x
include foo::bar::y
include foo::bar::z
</pre>

But if it is split up into multiple files:

baz1.pp:
<pre>
class baz1 {
  notify {"baz1": }
}
</pre>

foo/baz2.pp:
<pre>
class foo::baz2 {
  notify {"baz2": }
}
</pre>

foo/bar/baz3.pp:
<pre>
class foo::bar::baz3 {
  notify {"baz3": }
}
</pre>

init.pp:
<pre>
class foo::bar {
  class x inherits baz1 { }
  class y inherits baz2 { }
  class z inherits baz3 { }
}
include foo::bar::x
include foo::bar::y
include foo::bar::z
</pre>

Then it fails with the error message:

<pre>
Could not find class parent baz2 at .../init.pp:3 on node 
paul-berrys-macbook-pro.local
</pre>

If you comment out the lines "class y inherits baz2" and "include foo::bar::y" 
you can see that this failure is also occurring:

<pre>
Could not find class parent baz3 at .../init.pp:4 on node 
paul-berrys-macbook-pro.local
</pre>

The problem is that when autoloading a class, puppet doesn't consider all the 
possible namespace resolutions.  For example, when trying to resolve "baz2", it 
only looks for "baz2" and "foo::bar::y::baz2".  It should also be looking for 
"foo::baz2" and "foo::bar::baz2".

(Note: some might argue that it shouldn't be looking for "foo::bar::y::baz2" at 
all--I will file that as a separate ticket).



-- 
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to