Project

General

Profile

Bug #12095

Smart Class Parameters mangle erb interpolated variables

Added by Anonymous almost 4 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Smart Variables
Target version:
Difficulty:
Triaged:
Bugzilla link:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

This occurs on the class level. Hosts, hostgroups and nested hostgroups appear to have the correct behavior. This occurs in the nightly (October 7, 2015) installed with a default foreman-installer setup, as well as in version 1.9.2.

When adding a parameter override of type array, yaml or hash that has an element which is an interpolated erb value, the first time one clicks submit, the values appear correctly.

Open the class again and you will see that the parameter overrides have been mangled. Click submit, and the yaml values for the host will show true for arrays and hashs, and will be prefixed by multiple instances of the following (and it gets longer each submission):
! '--- ! "---\r\n

mangled hash.png View mangled hash.png 112 KB Anonymous, 10/07/2015 05:44 PM
mangled_array.png View mangled_array.png 111 KB Anonymous, 10/07/2015 05:44 PM
mangled_node_yaml.png View mangled_node_yaml.png 28.9 KB Anonymous, 10/07/2015 05:44 PM
mangled_yaml.png View mangled_yaml.png 114 KB Anonymous, 10/07/2015 05:44 PM
multi_mangled_array.png View multi_mangled_array.png 108 KB Anonymous, 10/07/2015 05:44 PM
multi_mangled_node_yaml.png View multi_mangled_node_yaml.png 30.2 KB Anonymous, 10/07/2015 05:44 PM
multi_mangled_yaml.png View multi_mangled_yaml.png 107 KB Anonymous, 10/07/2015 05:44 PM
original_array.png View original_array.png 106 KB Anonymous, 10/07/2015 05:45 PM
original_hash.png View original_hash.png 113 KB Anonymous, 10/07/2015 05:45 PM
multi_mangled_hash.png View multi_mangled_hash.png 105 KB Anonymous, 10/07/2015 05:45 PM
original_node_yaml.png View original_node_yaml.png 31.3 KB Anonymous, 10/07/2015 05:59 PM
original_yaml.png View original_yaml.png 91.2 KB Anonymous, 10/07/2015 05:59 PM
Mangled%20hash Mangled array Mangled node yaml Mangled yaml Multi mangled array Multi mangled node yaml Multi mangled yaml Original array Original hash Multi mangled hash Original node yaml Original yaml

Related issues

Related to Foreman - Bug #11375: Smart class parameters turn YAML to string when using a multi line yamlClosed2015-08-16
Has duplicate Foreman - Bug #12117: The web-interface dose not handle smart class parameters that contain templates correctlyDuplicate2015-10-08

Associated revisions

Revision 8893c3bc (diff)
Added by Dominic Cleal almost 4 years ago

fixes #12095 - prevent escaping of lookup key default value with ERB

When the current default value is retrieved from a lookup key via
default_value_before_type_cast, do not re-dump values containing ERB as
they will not have been cast already. This prevents them being escaped
again in the Puppet class edit form, and matches LookupValue behaviour.

Revision 6ab20c3f (diff)
Added by Dominic Cleal over 3 years ago

fixes #12095 - prevent escaping of lookup key default value with ERB

When the current default value is retrieved from a lookup key via
default_value_before_type_cast, do not re-dump values containing ERB as
they will not have been cast already. This prevents them being escaped
again in the Puppet class edit form, and matches LookupValue behaviour.

(cherry picked from commit 8893c3bc8d339d87ba0edb88f27a5c10d790a9b8)

History

#1 Updated by Anonymous almost 4 years ago

Looks like I missed two screenshots.

#2 Updated by Dominic Cleal almost 4 years ago

  • Category set to Smart Variables

#3 Updated by Dominic Cleal almost 4 years ago

Appears superficially similar to #11375, but that was a host common -> lookup values association issue, so it isn't applicable to this bug which can be reproduced entirely from the Puppet class edit form.

#4 Updated by Dominic Cleal almost 4 years ago

  • Has duplicate Bug #12117: The web-interface dose not handle smart class parameters that contain templates correctly added

#5 Updated by Dominic Cleal almost 4 years ago

  • Status changed from New to Assigned
  • Assignee set to Dominic Cleal

#6 Updated by The Foreman Bot almost 4 years ago

  • Status changed from Assigned to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/2806 added
  • Pull request deleted ()

#7 Updated by Dominic Cleal almost 4 years ago

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

#8 Updated by Dominic Cleal almost 4 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

#9 Updated by Dominic Cleal over 3 years ago

  • Legacy Backlogs Release (now unused) set to 104

Also available in: Atom PDF