Feature #1612

Parent classes should not need dissimilar names

Added by Digant Kasundra over 3 years ago. Updated 6 months ago.

Status:Closed Start date:09/26/2008
Priority:Normal Due date:
Assignee:Markus Roberts % Done:

0%

Category:-
Target version:-
Affected Puppet version:0.24.4 Branch:
Keywords:
Votes: 2

Description

class cat {
        exec { "/bin/echo I'm a cat": }
}

class tom::cat inherits cat {
        exec { "/bin/echo I'm a tomcat": }
}
include tom::cat  

Parent classes must have dissimilar names at line 7 on node henson1

History

Updated by Peter Meier over 3 years ago

  • Status changed from Unreviewed to Needs Decision

Parent classes must have dissimilar names at line 7 on node henson1

if you call the class cat::tom it works. And actually this is what the naming scheme for inheritance should be: subclass naming +after+ the parent name.

I suggest to reject this feature request, as I don’t see really a need for that. Or could you point out your opinion why this should be possible?

Updated by Joshua Corbin over 1 year ago

My scenario that caused me to hit this: * General module widget defines general characteristics of widget * Specific module suite pulls together multiple widgets, and adds project-specific settings

e.g.

class widget {
    package {widget: ...}
    service {widgetd: ...}
    file {widget.conf: ...}
}

class suite::widget inherits widget {
    File[widget.conf] {
        source => "puppet:///modules/suite/widget.conf";
    }
}

class suite {
   include suite::widget
}

Really, this comes down to an issue of what kind of organization layout makes sense. Right now, it feels like Puppet is being artificially restrictive for unclear reasons.

Updated by Nigel Kersten over 1 year ago

  • Assignee set to Markus Roberts

Markus, I’m passing this one over to you to see if there’s some technical reason why we can’t make this change.

(apparently this is because we look up reflixively first?)

Workaround: (note the ::)

class cat {
        exec { "/bin/echo cat": }
}

class tom::cat inherits ::cat {
        exec { "/bin/echo tom": }
}
include tom::cat  

Updated by Nigel Kersten over 1 year ago

  • Status changed from Needs Decision to Investigating

Markus, I’m passing this one over to you to see if there’s some technical reason why we can’t make this change.

Updated by Digant Kasundra 11 months ago

Any word on this? I think this is still true in 2.6

Updated by Digant Kasundra 6 months ago

  • Status changed from Investigating to Closed

I believe this has been fixed.

Also available in: Atom PDF