This message was deleted.
# puppet
s
This message was deleted.
b
did you try it?
t
In my attempt what I'm getting is Could not parse for environment root: Syntax error at ':'
b
👍 cool cool. So the next step is to figure out what's failing
v
that's not a valid syntax for selector
☝🏼 1
b
turns out that Puppet doesn't do ternary operators
v
but even if it was, where would joy come from?
b
short answer, you can do selectors in a class signature, but it makes the code less readable. You should consider refactoring to something favoring readability rather than conciseness.
s
In general, when I've thought I've needed conditional logic in a class parameter, it turns out I can use Hiera instead.
t
If $main_joy was true, $joy would be true otherwise it would be false. That would make $test_var1 true or false
h
You can have (almost) any puppet expression as the default value expression. As pointed out it may not read all that nicely, and tools that generate documentation for your classes won’t do a good job.
@Tom Hilburn unclear what you are trying to do - looks like both $joy and $main_joy are two global variables acting as independent input? Or, are you trying to state that the class has three parameters $test_var1, $joy, and $main_joy and that $test_var1 is a combination of the two using “and” ?