Ask Your Question

Puppet class "bar" not loadable by class "foo::bar"?

asked 2014-01-30 04:53:23 -0600

robrwo gravatar image

We've run into a regular problem. We have a Puppet class "role::foo" that has the statement

include foo

which is meant to load a top-level "foo" module. But the statement has no effect. We have to rename "foo" to something else, and it works.

So, does include search the current namespace before loading a top-level namespace? That's what seems to be happening, but I've not found anything in the Puppet function reference about this (and haven't yet looked over the source code for the include function to see if this is the case).

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-01-30 09:53:08 -0600

Grant Croker gravatar image

updated 2014-01-30 16:57:44 -0600

ramindk gravatar image

Yes it searches the local namespace first. From

In the example above, the invocation of include bar will actually declare class foo::bar. This is because Puppet assumes class and defined type names are relative until proven otherwise. This is a major outstanding design issue (issue #2053) which will not be resolved in Puppet 3, as the fix will break a large amount of existing code and require a long deprecation period.

You can fix by doing

class role::foo { 
  include ::foo
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2014-01-30 04:53:23 -0600

Seen: 71 times

Last updated: Jan 30 '14