Issue #5860 has been updated by Dominic Cleal.
The same goes for returning hashes from a selector:
$foo = "test"
$real_foo = $foo ? {
default => { test => "foo" },
}
notice($foo[test])
throws this:
err: Could not parse for environment production: Syntax error at '{';
expected '}' at /home/dcleal/tmp/5860.pp:3 ...
----------------------------------------
Bug #5860: arrays do not work in selectors
https://projects.puppetlabs.com/issues/5860#change-62537
Author: Adam Crews
Status: Accepted
Priority: Normal
Assignee:
Category:
Target version: 2.7.x
Affected Puppet version:
Keywords:
Branch:
Using an array in a selector does not work:
$info = [ "acrews", "Adam", "/bin/bash" ]
$shell = $info[2] ? {
/bin/ => $info[2],
default => "/sbin/nologin",
}
I get: Syntax error at '?'; expected '}
If I do this it works:
$info = [ "acrews", "Adam", "/bin/bash" ]
$AA = $info[2]
$shell => $AA ? {
/bin/ => $info[2],
default => "/sbin/nologin",
}
An array element should be able to be used exactly like any normal variable.
I see this on 2.6.4.
--
You have received this notification because you have either subscribed to it,
or are involved in it.
To change your notification preferences, please click here:
http://projects.puppetlabs.com/my/account
--
You received this message because you are subscribed to the Google Groups
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-bugs?hl=en.