Project

General

Profile

Bug #12324

Hash and array smart parameters are getting corrupted after multiple saves

Added by Tim Verhoeven over 6 years ago. Updated over 6 years ago.

Status:
Duplicate
Priority:
High
Assignee:
-
Category:
Web Interface
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:

Description

I define (override) a smart parameter and made sure the correct type was set (hash or array) for a Puppet class.
Then I go to a host or hostgroup and enter a value for this parameter in YAML notation.
I can then see in the YAML output for the host that de value is displayed correctly.
Then I edit the host or hostgroup again, but now the value I've entered is quoted and or escaped.

Example: for the hash_resources class, I've overridden the resources parameter. This is the value I've entered:
dns::zone:
dap:
zonetype: slave
masters:
- 10.67.75.155
75.67.10.in-addr.arpa:
reverse: true
zonetype: slave
masters:
- 10.67.75.155

This is the value I see when I edit the host again:
--- ! "dns::zone:\r\n dap:\r\n zonetype: 'slave'\r\n masters:\r\n - 10.67.75.155\r\n
\ 75.67.10.in-addr.arpa:\r\n reverse: true\r\n zonetype: 'slave'\r\n masters:\r\n
\ - 10.67.75.155"

Trying to save a host with this value returns an error because foreman can't validate this as a correct hash, which is of course correct.

This means that when editing a host you have to reenter these values each time.

I'm currently running Foreman 1.9.2 on CentOS7, installed using the katello installer.


Related issues

Is duplicate of Foreman - Bug #11375: Smart class parameters turn YAML to string when using a multi line yamlClosed2015-08-16

History

#1 Updated by Dominic Cleal over 6 years ago

  • Is duplicate of 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

  • Status changed from New to Duplicate

Thanks for the report. This has been fixed under ticket #11375, due for inclusion in 1.9.3 and also currently available in the 1.10 release candidates if you'd like to test.

#3 Updated by Tim Verhoeven over 6 years ago

Thanks for the info. That looks indeed like the issue. But the #11375 only talks about YAML. But I see something similar with arrays.
For example, I enter:
[ "root", "oneadmin", ]

Which then becomes:
"[ \"root\", \"oneadmin\", ]"

Is this also fixed in the new release?

#4 Updated by Dominic Cleal over 6 years ago

Yes, I think it affects all types of smart class parameters.

#5 Updated by Stefan Hölzle over 6 years ago

I had this issue with arrays. Following the instructions in comment http://projects.theforeman.org/issues/11375#note-31 fixed it for me.

Also available in: Atom PDF