The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com

This issue tracker is now in read-only archive mode and automatic ticket export has been disabled. Redmine users will need to create a new JIRA account to file tickets using https://tickets.puppetlabs.com. See the following page for information on filing tickets with JIRA:

Bug #2523

Classes with the same name are not included

Added by Robin Bowes over 6 years ago. Updated about 6 years ago.

Status:DuplicateStart date:08/10/2009
Priority:NormalDue date:
Assignee:Luke Kanies% Done:

0%

Category:language
Target version:-
Affected Puppet version:0.25.0rc1 Branch:
Keywords:

We've Moved!

Ticket tracking is now hosted in JIRA: https://tickets.puppetlabs.com


Description

Consider the following example (written by Volcane):

class foo {
        notice("Inside foo!")
}

class bar::foo {
        include foo
        notice("inside bar::foo")
}

include bar::foo

This produces the following output:

notice: Scope(Class[bar::foo]): inside bar::foo

ie. foo is not included.

If class bar::foo is remaned to bar::foo2, it produces the correct output:

notice: Scope(Class[foo]): Inside foo!
notice: Scope(Class[bar::foo2]): inside bar::foo

Related issues

Duplicates Puppet - Bug #2053: Relative namespacing of class/define names results in big... Accepted 03/06/2009

History

#1 Updated by James Turnbull over 6 years ago

  • Status changed from Unreviewed to Needs More Information
  • Assignee set to Luke Kanies

Luke? Thoughts?

#2 Updated by seph seph over 6 years ago

  • Affected Puppet version changed from 0.24.8 to 0.25.0rc1

(I’ve updated the version of this to 0.25.0 rc1)

I hit something pretty similar.

I define my various server configurations in site::server::. They’re things like site::server::ntp and site::server::svn. I also have modules named things like ntp.

On 0.24.8, when I did something like “include ntp” from site::server::base, I’d get the module. In 0.25.0 rc1, I get site::server::ntp, and AFAIK there’s no way to explicitly include the module named ntp. This is kinda a non-starter.

#3 Updated by James Turnbull over 6 years ago

seph – this is one of those vague memories I have and could be off-base and I need to go look at the code and my notes but does:

include ::ntp

Include the module?

#4 Updated by Luke Kanies over 6 years ago

  • Status changed from Needs More Information to Duplicate

#5 Updated by Robin Bowes over 6 years ago

James,

Yes, including ::foo in the original example works as expected:

notice: Scope(Class[foo]): Inside foo!
notice: Scope(Class[bar::foo]): inside bar::foo

R.

#6 Updated by James Turnbull over 6 years ago

  • Category set to language
  • Status changed from Duplicate to Needs More Information

So seph/Robin

Does this solve the issue and close the case? I am aware the syntax is poorly documented so would adding this to various bits of documentation be a suitable fix?

#7 Updated by James Turnbull over 6 years ago

  • Status changed from Needs More Information to Duplicate

#8 Updated by seph seph over 6 years ago

Ah, that sounds like exactly what I’m looking for — a way to explicitly grab a module only.

I’m still at least a little confused about how modules are ideally supposed to work. When to use an import, an include, or both. I observe that “include ntp” works, modulo these namespace issues. “include ::ntp” only works if ntp has already been imported.

That is:

|. fails |. works| |

node “puppet-test” {
  include ::ntp
}
|
node “puppet-test” {
  import “ntp”
  include ::ntp
}
|

All my code for the ntp module is in init.pp, and I think the docs say the import shouldn’t be needed.

#9 Updated by Luke Kanies over 6 years ago

seph seph wrote:

Ah, that sounds like exactly what I’m looking for — a way to explicitly grab a module only.

I’m still at least a little confused about how modules are ideally supposed to work. When to use an import, an include, or both. I observe that “include ntp” works, modulo these namespace issues. “include ::ntp” only works if ntp has already been imported.

That is:

|. fails |. works| |[…] | […] |

All my code for the ntp module is in init.pp, and I think the docs say the import shouldn’t be needed.

This is a different bug — ‘include ::ntp’ doesn’t autoimport. Can you file it separately?

#10 Updated by seph seph over 6 years ago

done. #2549

Also available in: Atom PDF