[PUP-4428] The 'err' logging function cannot be called as a statement Created: 2015/04/16  Updated: 2015/05/20  Resolved: 2015/05/20

Status: Closed
Project: Puppet
Component/s: None
Affects Version/s: None
Fix Version/s: PUP 3.8.1, PUP 4.1.0

Type: Bug Priority: Normal
Reporter: Henrik Lindberg Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Epic Link: 4.x Language
Story Points: 1
Sprint: Language 2015-04-29
Release Notes: Bug Fix

 Description   

In the language specification: https://github.com/puppetlabs/puppet-specifications/blob/master/language/expressions.md#function-calls

under the "statement style" subhead, there's a list like:

# logging
debug
info
notice
warning
error

Where "error" is wrong and don't exist. There are also several similar functions that aren't listed. cf. http://docs.puppetlabs.com/references/latest/configuration.html#loglevel

We should allow the 'err' function to be called as a statement. The remaining logging functions are almost never used and should continue to require parentheses.

risk: medium (qa manual validate only for now)
probability: medium
severity: low (work arounds exist)
test layer: acceptance (unit test only confirms parser transform)



 Comments   
Comment by Nicholas Fagerlund [ 2015/04/16 ]

This sounds legit to me. I'd forgotten those other log levels even existed.

Comment by Thomas Hallgren [ 2015/04/19 ]

Merged to 3.x at 5775dc11.

Comment by Thomas Hallgren [ 2015/04/19 ]

Merged to master at a1d698f.

Comment by Eric Thompson [ 2015/04/21 ]

validated on ubuntu14 at SHA: ffaffb9

[root@plgf5s85ojlj8m1 puppet]# puppet apply -e "err yup"
Error: Scope(Class[main]): yup
Notice: Compiled catalog for plgf5s85ojlj8m1.delivery.puppetlabs.net in environment production in 0.41 seconds
Notice: Applied catalog in 0.01 seconds
[root@plgf5s85ojlj8m1 puppet]# puppet apply -e "error yup"
Error: Could not parse for environment production: This Name has no effect. A value-producing expression without other effect may only be placed last in a block/sequence  at line 1:1 on node plgf5s85ojlj8m1.delivery.puppetlabs.net
Error: Could not parse for environment production: This Name has no effect. A value-producing expression without other effect may only be placed last in a block/sequence  at line 1:1 on node plgf5s85ojlj8m1.delivery.puppetlabs.net
[root@plgf5s85ojlj8m1 puppet]# puppet apply -e "warning yup"
Warning: Scope(Class[main]): yup
Notice: Compiled catalog for plgf5s85ojlj8m1.delivery.puppetlabs.net in environment production in 0.37 seconds
Notice: Applied catalog in 0.01 seconds
[root@plgf5s85ojlj8m1 puppet]# puppet apply -e "info yup"
Notice: Compiled catalog for plgf5s85ojlj8m1.delivery.puppetlabs.net in environment production in 0.36 seconds
Notice: Applied catalog in 0.01 seconds
[root@plgf5s85ojlj8m1 puppet]# puppet apply -e "notice yup"
Notice: Scope(Class[main]): yup
Notice: Compiled catalog for plgf5s85ojlj8m1.delivery.puppetlabs.net in environment production in 0.36 seconds
Notice: Applied catalog in 0.01 seconds
[root@plgf5s85ojlj8m1 puppet]# puppet apply -e "debug yup"
Notice: Compiled catalog for plgf5s85ojlj8m1.delivery.puppetlabs.net in environment production in 0.37 seconds
Notice: Applied catalog in 0.01 seconds
[root@plgf5s85ojlj8m1 puppet]# puppet apply -e "fail yup"
Error: Evaluation Error: Error while evaluating a Function Call, yup  at line 1:1 on node plgf5s85ojlj8m1.delivery.puppetlabs.net
Error: Evaluation Error: Error while evaluating a Function Call, yup  at line 1:1 on node plgf5s85ojlj8m1.delivery.puppetlabs.net
[root@plgf5s85ojlj8m1 puppet]# puppet apply -e "info('yup')"
Notice: Compiled catalog for plgf5s85ojlj8m1.delivery.puppetlabs.net in environment production in 0.36 seconds
Notice: Applied catalog in 0.01 seconds

Comment by Eric Thompson [ 2015/04/21 ]

validated on windows2012r2-rubyx64 at SHA: 39bd7a7

Administrator@f67onhgjleryc6t /opt/puppet-git-repos/puppet
$ cmd /c  puppet apply -e "err yup"
Error: Scope(Class[main]): yup
Notice: Compiled catalog for f67onhgjleryc6t.delivery.puppetlabs.net in environment production in 0.47 seconds
Notice: Applied catalog in 0.02 seconds

Generated at Sat Dec 14 02:33:12 PST 2019 using JIRA 7.7.1#77002-sha1:e75ca93d5574d9409c0630b81c894d9065296414.