Reputation: 8375
I am currently running into the following error:
Error: Could not parse for environment production: Syntax error at end of file on node master.domain.org
while trying to run the below puppet code
puppet apply --parser future -e '$vars={
0 => '192.1.1.140',
1 => '192.1.1.141',
2 => '192.1.1.142',
} each($vars) |$id,$gate| { notice "${id} -> ${gate}" }'
Strangely though I can run this without issues,
puppet apply --parser future -e '$vars={
0 => '1.0',
1 => '1.1',
2 => '1.2',
} each($vars) |$id,$gate| { notice "${id} -> ${gate}" }'
Notice: Scope(Class[main]): 0 -> 1.0
Notice: Scope(Class[main]): 1 -> 1.1
Notice: Scope(Class[main]): 2 -> 1.2
Notice: Compiled catalog for master.domain.org in environment production in 0.33 seconds
Notice: Finished catalog run in 0.01 seconds
I assume it is something with the second(and third) dot, How can I fix this?
EDIT
I was doing some more testing and noticed this little gem
puppet apply --parser future -e '$ip='1.1-1' $vars={
0 => "${ip}.0",
1 => "${ip}.1",
2 => "${ip}.2",
} each($vars) |$id,$gate| { notice "${id} -> ${gate}" }'
Notice: Scope(Class[main]): 0 -> 0.10000000000000009.0
Notice: Scope(Class[main]): 1 -> 0.10000000000000009.1
Notice: Scope(Class[main]): 2 -> 0.10000000000000009.2
Notice: Compiled catalog for master.domain.org in environment production in 0.34 seconds
Notice: Finished catalog run in 0.02 seconds
Looks like its doing some weird mathematical expansion/interpretation?
Upvotes: 0
Views: 1248
Reputation: 45243
Seems in this case, you need use double quote.
puppet apply --parser future -e '$vars={
0 => "192.1.1.140",
1 => "192.1.1.141",
2 => "192.1.1.142",
} each($vars) |$id,$gate| { notice "${id} -> ${gate}" }'
Upvotes: 1