[PUP-4374] Splatting attributes into an amended attribute block isn't supported Created: 2015/04/03  Updated: 2015/05/20  Resolved: 2015/05/20

Status: Closed
Project: Puppet
Component/s: Language
Affects Version/s: PUP 3.8.0, PUP 4.0.0
Fix Version/s: PUP 3.8.1, PUP 4.1.0

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

Issue Links:
Relates
Template:
Epic Link: 4.x Language
Story Points: 2
Sprint: Language 2015-04-29, Language 2015-05-13
Release Notes: Bug Fix
QA Contact: Eric Thompson

 Description   

Per Henrik Lindberg in email, this is supposed to work... but it totally doesn't.

notify {'first':}
 
$myattrs = {"message" => "from a reference attribute block"}
 
Notify[first] { *=> $myattrs }
# Error: Could not parse for environment production: The operator '* =>' in an Object is not supported. at /Users/nick/Documents/splat_reference.pp:5:17 on node magpie.lan
 
notify {'extra': *=> $myattrs }
# works fine.
 
Notify <| title == 'first' |> { *=> $myattrs }
# Error: Could not parse for environment production: In Puppet::Pops::Model::CollectExpression : Can not use a Puppet::Pops::Model::AttributesOperation where a Puppet::Pops::Model::AttributeOperation is expected on node magpie.lan

QA


risk: medium
probability: low (passing a whole block)
severity: medium (work-arounds available, obvious problem)
test layer: unit-integration



 Comments   
Comment by Henrik Lindberg [ 2015/04/03 ]

Marked this for 4.1.0. Should also be fixed on 3.x to be included in 3.8.1.

Comment by Henrik Lindberg [ 2015/04/24 ]

Specification updated.

Comment by Thomas Hallgren [ 2015/04/27 ]

Merged to 3.x at 150e845.
Merged to stable at 755b234.
Merged to master at ac1de00.

Comment by Eric Thompson [ 2015/04/29 ]

validated on ubuntu14.04 at master SHA:

[root@fv1nemlp2jj6fpm ~]# puppet apply splat_attrs.pp
Notice: Compiled catalog for fv1nemlp2jj6fpm.delivery.puppetlabs.net in environment production in 0.38 seconds
Notice: from a reference attribute block
Notice: /Stage[main]/Main/Notify[first]/message: defined 'message' as 'from a reference attribute block'
Notice: from a reference attribute block
Notice: /Stage[main]/Main/Notify[extra]/message: defined 'message' as 'from a reference attribute block'
Notice: Applied catalog in 0.01 seconds
[root@fv1nemlp2jj6fpm ~]# cat splat_attrs.pp
notify {'first':}
$myattrs = {"message" => "from a reference attribute block"}
Notify[first] { *=> $myattrs }
# Error: Could not parse for environment production: The operator '* =>' in an Object is not supported. at /Users/nick/Documents/splat_reference.pp:5:17 on node magpie.lan
notify {'extra': *=> $myattrs }
# works fine.
Notify <| title == 'first' |> { *=> $myattrs }

Henrik Lindberg do i need to have a virtual resource to test this adequately? or is simply not erroring on the last collector good enough?

Comment by Eric Thompson [ 2015/04/29 ]

validated on windows2012r2-rubyx64 at master SHA: 8964241

Administrator@irzmc77aybd4u9s ~
$ cmd /c puppet apply splat_attrs.pp
Notice: Compiled catalog for irzmc77aybd4u9s.delivery.puppetlabs.net in environment production in 0.52 seconds
Notice: from a reference attribute block
Notice: /Stage[main]/Main/Notify[first]/message: defined 'message' as 'from a reference attribute block'
Notice: from a reference attribute block
Notice: /Stage[main]/Main/Notify[extra]/message: defined 'message' as 'from a reference attribute block'
Notice: Applied catalog in 0.03 seconds

Comment by Eric Thompson [ 2015/05/01 ]

hmmmm. Henrik Lindberg, this doesn't seem to work in 3.x on ubuntu14 at 3.x SHA: 17b75e2

[root@mupkgq3reracnf3 ~]# puppet apply splat_attrs.pp
Error: Could not parse for environment production: Syntax error at '*'; expected '}' at /root/splat_attrs.pp:3 on node mupkgq3reracnf3.delivery.puppetlabs.net
Error: Could not parse for environment production: Syntax error at '*'; expected '}' at /root/splat_attrs.pp:3 on node mupkgq3reracnf3.delivery.puppetlabs.net
 
[root@mupkgq3reracnf3 puppet]# puppet apply -e '$myattrs = {"message" => "from a reference attribute block"} Notify[first] { *=> $myattrs }'
Error: Could not parse for environment production: Syntax error at '*'; expected '}' at line 1 on node mupkgq3reracnf3.delivery.puppetlabs.net
Error: Could not parse for environment production: Syntax error at '*'; expected '}' at line 1 on node mupkgq3reracnf3.delivery.puppetlabs.net
[root@mupkgq3reracnf3 puppet]# puppet apply -e '$myattrs = {"message" => "from a reference attribute block"} notify {"extra": *=> $myattrs }'
Error: Could not parse for environment production: Syntax error at '*'; expected '}' at line 1 on node mupkgq3reracnf3.delivery.puppetlabs.net
Error: Could not parse for environment production: Syntax error at '*'; expected '}' at line 1 on node mupkgq3reracnf3.delivery.puppetlabs.net

Comment by Henrik Lindberg [ 2015/05/01 ]

Eric Thompson here is a hint: --parser future

Comment by Eric Thompson [ 2015/05/04 ]

(facepalm) whoops

Comment by Eric Thompson [ 2015/05/04 ]

validated on ubuntu14.04:

[root@n87zti4y85shins puppet]# git branch -v
* 3.x    761ccb5 Merge pull request #3884 from thallgren/issue/pup-4511/types-not-assignable
  master 8f850e5 Merge branch 'stable'
[root@n87zti4y85shins puppet]# puppet apply splat_attrs.pp --parser future
Notice: Compiled catalog for n87zti4y85shins.delivery.puppetlabs.net in environment production in 0.44 seconds
Notice: from a reference attribute block
Notice: /Stage[main]/Main/Notify[first]/message: defined 'message' as 'from a reference attribute block'
Notice: from a reference attribute block
Notice: /Stage[main]/Main/Notify[extra]/message: defined 'message' as 'from a reference attribute block'
Notice: Finished catalog run in 0.02 seconds

Generated at Wed Aug 21 00:08:30 PDT 2019 using JIRA 7.7.1#77002-sha1:e75ca93d5574d9409c0630b81c894d9065296414.