Issue #4472 has been updated by Jesse Wolfe.

Status changed from Accepted to Available In Testing Branch
Assigned to changed from Paul Berry to Jesse Wolfe
Target version set to Statler
Branch set to http://github.com/reductivelabs/puppet/tree/next

Available in `next` as 16f701edd89a320ad73b5468d883dfb017fe6e96
----------------------------------------
Bug #4472: Autoloading of .pp files doesn't search all namespace nestings
http://projects.puppetlabs.com/issues/4472

Author: Paul Berry
Status: Available In Testing Branch
Priority: Normal
Assigned to: Jesse Wolfe
Category: 
Target version: Statler
Affected version: 2.6.1rc1
Keywords: 
Branch: http://github.com/reductivelabs/puppet/tree/next


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