Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Normal
-
Resolution: Won't Fix
-
Affects Version/s: PUP 4.0.0
-
Fix Version/s: None
-
Component/s: Language
-
Labels:None
-
Template:customfield_10700 77621
Description
A user reported via IRC, and Richard Clamp repro'ed, the following issue using anonymous data structures to iterate over. The short version is that using an array, then a hash, confuses the parser, but hash then array works. So this is OK:
class munin { |
|
{
|
'if_eth0' => 'if_', |
'if_err_eth0' => 'if_err_', |
}.each |$plugin, $target| { |
notify { "hash ${plugin} ${target}": } |
}
|
|
[
|
'vmstat', |
].each |$plugin| { |
notify { "array ${plugin}": } |
}
|
|
}
|
include munin
|
but this is not:
class munin { |
[
|
'vmstat', |
].each |$plugin| { |
notify { "array ${plugin}": } |
}
|
|
{
|
'if_eth0' => 'if_', |
'if_err_eth0' => 'if_err_', |
}.each |$plugin, $target| { |
notify { "hash ${plugin} ${target}": } |
}
|
}
|
include munin
|
The error is:
Error: Could not parse for environment production: Syntax error at '=>' at /home/vagrant/test.pp:8:15 on node glitched.local
|