-
Type:
Bug
-
Status: Closed
-
Priority:
Normal
-
Resolution: Fixed
-
Affects Version/s: PUP 3.4.3, PUP 4.2.1
-
Fix Version/s: PUP 4.5.0
-
Component/s: Compiler
-
Labels:None
-
Environment:
PE 3.2.1
-
Template:customfield_10700 37482
-
Epic Link:
-
Story Points:2
-
Sprint:Language 2016-03-09
-
CS Priority:Reviewed
-
Release Notes:New Feature
-
Release Notes Summary:
A new hire (Erin Buckley) is working through exercises and inadvertently defined a class twice in a file with surprising results.
class test {
|
notice('testing')
|
notify { 'first': }
|
}
|
|
class test {
|
notice('again')
|
notify { 'surprise!': }
|
}
|
|
include test
|
[root@student ~]# puppet apply test.pp
|
Notice: Scope(Class[Test]): testing
|
Notice: Scope(Class[Test]): again
|
Notice: Compiled catalog for student.puppetlabs.vm in environment production in 0.04 seconds
|
Notice: surprise!
|
Notice: /Stage[main]/Test/Notify[surprise!]/message: defined 'message' as 'surprise!'
|
Notice: first
|
Notice: /Stage[main]/Test/Notify[first]/message: defined 'message' as 'first'
|
Notice: Finished catalog run in 0.18 seconds
|
Shouldn't the parser error out on this? If not that, shouldn't the second definition replace the first? I would never expect this combining effect.
This should be controlled by the new --strict flag (PUP-5889). When it is set to warning or error output should be produced to indicate the problem.