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

Bug #4220

Could not find class ssh::client in namespaces baseclass

Added by Todd Zullinger about 4 years ago. Updated about 4 years ago.

Status:ClosedStart date:07/13/2010
Priority:HighDue date:
Assignee:Markus Roberts% Done:

0%

Category:parser
Target version:2.6.0
Affected Puppet version:2.6.0rc2 Branch:
Keywords:

We've Moved!

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

This issue is currently not available for export. If you are experiencing the issue described below, please file a new ticket in JIRA. Once a new ticket has been created, please add a link to it that points back to this Redmine ticket.


Description

Testing some basic manifests on CentOS 5 and Fedora 10, I’m running into problems finding classes. These manifests worked with previous puppet versions.

# cat manifests/site.pp modules/ssh/manifests/init.pp 
# manifests/site.pp
class baseclass {
    include ssh::client
}
   
node default {
    include baseclass
}

# modules/ssh/manifests/init.pp
class ssh {
    notify { 'ssh': message => "class = ssh" }
}

class ssh::client inherits ssh {
    notify { 'ssh::client': message => "class = ssh::client" }
}

# puppet agent -tv --noop
err: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find class ssh::client in namespaces baseclass at /etc/puppet/manifests/site.pp:3 on node c54-64-test.example.net
warning: Not using cache on failed catalog
err: Could not retrieve catalog; skipping run

History

#1 Updated by James Turnbull about 4 years ago

  • Category set to RAL
  • Status changed from Unreviewed to Accepted
  • Target version set to 2.6.0

#2 Updated by Markus Roberts about 4 years ago

  • Category changed from RAL to parser
  • Assignee set to Markus Roberts

#3 Updated by Markus Roberts about 4 years ago

This works if modules/ssh/manifests/init.pp:

class ssh {
    notify { 'ssh': message => "class = ssh" }
}

class ssh::client inherits ssh {
    notify { 'ssh::client': message => "class = ssh::client" }
}

Is split into two files:

modules/ssh/manifests/init.pp:

class ssh {
    notify { 'ssh': message => "class = ssh" }
}

modules/ssh/manifests/client.pp

class ssh::client inherits ssh {
    notify { 'ssh::client': message => "class = ssh::client" }
}

#4 Updated by Markus Roberts about 4 years ago

  • Status changed from Accepted to Rejected

After some discussion / consideration I’m going to reject this on the grounds that expecting puppet to find a class in an ill-named file is a slippery slope with nothing good at the end of it.

If anyone disagrees, feel free to reopen the ticket but please provide a rational.

#5 Updated by Todd Zullinger about 4 years ago

  • Status changed from Rejected to Re-opened

This ought to be called out loudly in the release notes then, as it breaks currently working manifests. I have had trouble in the past when trying to place all sub-classes in separate files, which is why I often have something like ssh::client in modules/ssh/manifests/init.pp. I’m glad if many of those issues are fixed now, but going from “causes fun issues that lead folks to put classes in init.pp” to “breaks badly if subclasses are in init.pp” in one leap is going to leave a bad taste in a lot of users mouths.

Please take a poke through the modules on forge.puppetlabs.com and notice a fair number of them will be broken with this change in behaviour.

I’d surely hesitate to push this to Fedora and EPEL updates with a change like this. I understand the desire to keep improving, but I would have to wager that most puppet users are running large, enterprise style deployments and are not so happy to have to manually change working manifests from one version to the next just to have them keep working. :(

I don’t have time to test this right now, but does this also affect usage like:

class foo { # do something

class client inherits foo {

# blah

} }

?

#6 Updated by Jasper Poppe about 4 years ago

This is indeed quite a big change in behavior, all of my (our) small modules which have subclasses are done in one file. And personally when I’m developing a new module I like to have everything in the init.pp file so I can easier keep the overview. For example our PHP module contains about 12 submodules, most of those submodules just install one or 2 packages. (again) personally I prefer to have this in one file instead of 12 files with a few lines in each.

On the other hand I can understand the reason why this is not allowed anymore, but like Todd said please make it clear in the release notes since many Puppet modules/setups will break!

Another thing worth to mention in the release notes is that you can’t access defines in classes directly anymore, but you can only access them after you included the class.

So classbla::customdefine { ‘bla’: foo => bar; }

Doesn’t work anymore.

But: include classbla classbla::customdefine { ‘bla’: foo => bar; }

Works fine.

#7 Updated by James Turnbull about 4 years ago

  • Status changed from Re-opened to Closed

Fixed in commit:06cc552b8b1196ff833eb911eccf1c234d4b0d67 in branch master.

Also available in: Atom PDF