Project

General

Profile

Bug #12284

host group parameter overrides reformatting YAML values to strings

Added by Kerguillec Paul over 6 years ago. Updated over 6 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Parameters
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:

Description

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"

before-submit.png View before-submit.png 135 KB Hector Elenes, 10/30/2015 09:15 PM
after-submit.png View after-submit.png 149 KB Hector Elenes, 10/30/2015 09:15 PM
Before submit After submit

Related issues

Related to Foreman - Bug #11375: Smart class parameters turn YAML to string when using a multi line yamlClosed2015-08-16
Related to Foreman - Bug #14292: Child hostgroup cloning issue with array parametersResolved

History

#1 Updated by Dominic Cleal over 6 years ago

  • Related to Bug #11375: Smart class parameters turn YAML to string when using a multi line yaml added

#2 Updated by Dominic Cleal over 6 years ago

  • Description updated (diff)
  • Category set to Parameters

#3 Updated by Dominic Cleal over 6 years ago

  • Assignee deleted (Dominic Cleal)

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).

#4 Updated by Hector Elenes over 6 years ago

I'm seeing this issue in 1.9.2. Attached screenshots. The current workaround is making the parameter overrides in the Puppet Class > Smart Class Parameter page.

#5 Updated by Dominic Cleal over 6 years ago

Hector, your issue is #11375 (due for 1.9.3 tomorrow) as it's just editing/saving of overrides. This bug is specifically about overriding of a value inherited from a host group.

#6 Updated by Hector Elenes over 6 years ago

Dominic Cleal wrote:

Hector, your issue is #11375 (due for 1.9.3 tomorrow) as it's just editing/saving of overrides. This bug is specifically about overriding of a value inherited from a host group.

Thank you Dominic!

#7 Updated by Kerguillec Paul over 6 years ago

Hi Dominic, it's not fixed in RC3 release ?
I have also noticed the related (same ?) issue from "Default Behavior" by editing smart class parameters inside edit parameter class subsection.

#8 Updated by Dominic Cleal over 6 years ago

Kerguillec Paul wrote:

Hi Dominic, it's not fixed in RC3 release ?

No, the issue is marked "New" so is unfixed.

#9 Updated by Dominic Cleal about 6 years ago

  • Related to Bug #14292: Child hostgroup cloning issue with array parameters added

Also available in: Atom PDF