Puppet: System Administration Automated

Support

Ticket #857 (assigned defect)

Opened 1 year ago

Last modified 7 months ago

Behaviour of Puppet when multiple classes of the same name are defined

Reported by: jamtur01 Assigned to: luke (accepted)
Priority: normal Milestone: elmo
Component: language Version: 0.23.2
Severity: normal Keywords: class
Cc: Triage Stage: Accepted
Attached Patches: None Complexity: Unknown

Description

When multiple classes of the same name are defined:

class mysql { notice('This is a load of the MySQL class') }

class mysql { notice('This is a load of the second MySQL class') }

class mysql { notice('This is a load of the third MySQL class') }

According to Luke the contents of each new class of the same name are just added to the initial class and processed.

Testing indicates that this isn't the behaviour and in fact only the first class is processed, i.e. using the above example the only notice returned is:

"notice: mysql: This is a load of the MySQL class"

I recommend that either this configuration throws an error - making classes unique - or the combination behaviour is fixed to include all content of each class.

Change History

10/05/07 08:55:22 changed by jamtur01

  • summary changed from Behaviour of Puppet when multiple classes of the same are defined to Behaviour of Puppet when multiple classes of the same name are defined.

10/05/07 16:48:33 changed by luke

  • owner changed from community to luke.
  • status changed from new to assigned.
  • stage changed from Unreviewed to Accepted.

Hmm:

class one {
    notify { "one": }
}

class one {
    notify { "two": }
}   
include one

And I get:

luke@phage(0) $ test.pp
notice: one
notice: two
luke@phage(0) $

Strangely, I just ran your code and got the same behaviour you're getting (that is, only the first notice). Even stranger, I added my 'notify' resources to these classes and got my new behaviour again *with* all three notices:

class mysql { 
    notice('This is a load of the MySQL class') 
    notify { one: }
}
class mysql {     notice('This is a load of the second MySQL class') 
    notify { two: }
}
class mysql {     notice('This is a load of the third MySQL class') 
    notify { three: }
}
include mysql

Returns

luke@phage(0) $ test.pp
notice: Scope(Class[mysql]): This is a load of the MySQL class
notice: Scope(Class[mysql]): This is a load of the second MySQL class
notice: Scope(Class[mysql]): This is a load of the third MySQL class
notice: two
notice: three
notice: one
luke@phage(0) $

So, I don't know what the bug is here, but there's definitely a bug.

11/24/07 06:22:39 changed by luke

  • milestone set to misspiggy.

12/12/07 01:09:23 changed by luke

  • milestone changed from misspiggy to elmo.

12/19/07 20:48:32 changed by luke

Marking #966 as a duplicate.

04/24/08 07:06:49 changed by luke

  • component changed from library to language.