Problem:
No way no set hash or list parameters in smart classes
Expected outcome:
Set hash or list smart class parameters without getting format errors
Foreman and Proxy versions:
3.14
Foreman and Proxy plugin versions:
3.14
Distribution and version:
Linux Ubuntu 22.04
Other relevant data:
I’ve tried to input hash or list in smart classes parameters without success.
I always get format erros.
I’ve tried a lot of different format combinations.
I have not found any documentation about this.
I will be very pleased of any kind of help on this.
Thanks in advance and regards.
In general, you can insert both lists and hashes as either JSON or YAML.
First, you have to set the parameter type accordingly: In the UI, navigate to “Configure” → “Puppet ENC” → “Smart Class Parameters” → Select the Parameter you want to edit and set the parameter type to “array” for lists or “hash” for hashes.
A valid list in a override would look like this as JSON:
["abc","foo","bar"]
A valid has as YAML would look like this:
foo: bar
abc: foo
example: hash
For some reason, we only have JSON lists and YAML hashes in our current setup, but a JSON hash and a YAML list should also work:
# JSON hash
{"foo": "bar","abc": "foo"}
#YAML list
- foo
- bar
- abc