host group parameter overrides reformatting YAML values to strings
Adding an override to a smart class parameter of type YAML from host groups with the value:
--- - Apple - Orange - Strawberry - Mango
results in the host edit form showing the parameter as:
--- ! '- Apple - Orange - Strawberry - Mango '
As a workaround I override it again from host.
For mor complexe yaml example you may found "\n"
#3 Updated by Dominic Cleal over 6 years ago
- Assignee deleted (
It's a related but definitely different to #11375 it seems.
The UI (app/views/puppetclasses/_class_parameters.html.erb and host_key_with_diagnostic helper) attempts to reverse LookupValue#value - which it expects to return a hash or array for a YAML parameter - in order to display it in the textbox. It does this essentially by calling LookupKey#value_before_type_cast(LookupValue's value) in the helper.
However it retrieves the list of LookupValues applicable to the host by calling Classification::ClassParam (via the value_hash_cache helper). In Classification::Base#update_generic_matcher, it calls LookupKey#value_before_type_cast so the value is actually the YAML string rather than the hash/array.
When this string is passed back, as above, it calls value_before_type_cast but with the YAML string, causing a second level of YAML in the textbox instead of the original one level.
Changing the behaviour of update_generic_matcher to get .value means further changes in the classification to ensure the ENC output still works (it attempts to type cast it again I think).