Bug #6019

Subclasses don't inherit run stage correctly?

Added by Roald van Loon over 1 year ago. Updated 19 days ago.

Status:Accepted Start date:01/26/2011
Priority:Normal Due date:
Assignee:- % Done:

0%

Category:-
Target version:2.7.x
Affected Puppet version: Branch:
Keywords:
Votes: 1

Description

Hi,

Seems like subclasses are not automatically placed in the correct run stage, when they inherit the stage from a parent.

Consider the following small test manifest;

stage { second: require => Stage[main] }
notify { "test": }
class testsuper {

}

class testsuper::testsub inherits testsuper {
    notify { "this is testsuper::testsub, and my stage is $stage":
        require => Notify["test"]
    }
}

class { "testsuper": stage => second }

node test {
    include testsuper::testsub
}

This results in the following;

<snip>
debug: /Stage[second]/require: requires Stage[main]
debug: /Stage[main]/Testsuper::Testsub/Notify[this is testsuper::testsub, and my stage is second]/require: requires Notify[test]
<snip>

So apparently, the $stage metaparameter in “testsuper::testsub” is set to “second” correctly, but the puppet run still indicates that the notify should take place in stage “main”.

Looks to me like this is unwanted behavior?

If I change this …

class { "testsuper": stage => second }

… into this;

class { "testsuper::testsub": stage => second }

… then the “testsub” subclass is executed in the correct stage;

<snip>
debug: /Stage[second]/require: requires Stage[main]
debug: /Stage[second]/Testsuper::Testsub/Notify[this is testsuper::testsub, and my stage is second]/require: requires Notify[test]
<snip>

But I assume it’s not by design that I have to apply the stage to every subclass.


Related issues

related to Puppet - Bug #5349: Class inheritance and stages act weirdly Accepted 11/18/2010

History

Updated by Ben Hughes about 1 year ago

  • Status changed from Unreviewed to Needs Decision
  • Assignee set to Nigel Kersten

Thank you for reporting this.

Either this is the desired behaviour and we really need to document it, or it isn’t and we need to fix it. Nigel?

Updated by Nigel Kersten about 1 year ago

  • Status changed from Needs Decision to Accepted
  • Assignee deleted (Nigel Kersten)
  • Target version set to 2.7.x

It seems sanest to me that an inherited class should also inherit the stage from the parent by default, but you should be able to override it if you desire.

Also available in: Atom PDF