Bug #23382
closedEditing Smart Class Parameter of type YAML creates malformed value in release 1.17.0
Description
When defining smart class parameter values with type YAML and submitted in GUI an Ruby error message gets prepended for each array entry.
Defining an YAML-Array like:
--- - name: foo mount_point: /bar - name: john mount_point: /doe
gets saved as:
- !ruby/hash:ActiveSupport::HashWithIndifferentAccess name: foo mount_point: "/bar" - !ruby/hash:ActiveSupport::HashWithIndifferentAccess name: john mount_point: "/doe"
Just a very simple example our YAML are much more complex. This error appears since the upgrade from 1.16.1 to 1.17.0.
As we need this system for production, we can leave this installation like it is for debugging purposes for a maximum of 36hours.
HOSTNAME: urzlxdeploy.rz.uni-leipzig.de
OS: redhat
RELEASE: CentOS Linux release 7.4.1708 (Core)
FOREMAN: 1.17.0
RUBY: ruby 2.0.0p648 (2015-12-16) [x86_64-linux]
PUPPET: 4.10.11
DENIALS: 0
Updated by Anonymous over 6 years ago
- Related to Bug #23463: YAML rendering of external nodes generates incorrect data if hashes are used added
Updated by Anonymous over 6 years ago
- Translation missing: en.field_release changed from 296 to 297
I think this is https://github.com/rails/rails/issues/29013 a fix was maerged to Rails 5.1 branch and will be part of Rails 5.1.7, which is not yet released...
Updated by Anonymous over 6 years ago
Is there any quick fix? I have upgraded to 1.17.0 recently and now all my Puppet manifests fail because the hashes are malformed? Rails 5.1.7 isn't going to be released anytime soon, so I guess we need a fix for that.
Couldn't we just revert the change that introduced this issue from 1.16.x to 1.17.0?
Updated by Tomer Brisker over 6 years ago
- Translation missing: en.field_release changed from 297 to 360
Pushing out to 1.17.2, this won't be fixed in time for 1.17.1.
Updated by Anonymous over 6 years ago
Well I fixed this in the meantime by manually editing the rails file as mentioned by Michael. Can't we just provide a patched rails release via the foreman repos?
Updated by Tobias Ehrig over 6 years ago
The fix mentioned by Henry Spanka doesnt work for me. (Debian Stretch installed via DEB Repositoy)
Updated by Anonymous over 6 years ago
@Tobias: Have you restarted foreman (Webserver) after applying the fix? Note that you also need to edit the classes again and just save the parameters again so they are correctly stored in the database. It is not required to change them but you need to resave them.
Updated by Tobias Ehrig over 6 years ago
@Henry: Yes, I've restarted the whole box. After the fix, the array values are displayed fine - without escaped doublequotes - but the puppet agent still failed with the exception above.
Updated by Tomer Brisker over 6 years ago
- Related to Bug #23581: Upgrade to Foreman 1.17 converts YAML to JSON Hash added
Updated by Daniel Lobato Garcia over 6 years ago
- Triaged set to No
I'm trying hard to reproduce this, but even complex hashes seem to be rendered properly. For example:
classes: dhcp: bootfiles: override_value: match: fqdn=server.example.com value: testvg: physical_volumes: - "/dev/sdb" - "/dev/sdc" logical_volumes: test1: size: 128M mountpath: "/opt/test1" test2: size: 128M mountpath: "/opt/test2" test3: size: 128M mountpath: "/opt/test3" test4: size: 128M mountpath: "/opt/test4" test5: size: 128M mountpath: "/opt/test5"
Updated by Daniel Lobato Garcia over 6 years ago
I do see it now, with Arrays:
classes: dhcp: bootfiles: - !ruby/hash:ActiveSupport::HashWithIndifferentAccess name: foo mount_point: "/bar" - !ruby/hash:ActiveSupport::HashWithIndifferentAccess name: john mount_point: "/doe"
Updated by Daniel Lobato Garcia over 6 years ago
JSON.parse(@host.info.to_json).to_yaml(:line_width => -1)- using this in hosts_controller, on the externalNodes method works well
Updated by The Foreman Bot over 6 years ago
- Status changed from New to Ready For Testing
- Assignee set to Daniel Lobato Garcia
- Pull request https://github.com/theforeman/foreman/pull/5769 added
Updated by Daniel Lobato Garcia over 6 years ago
- Related to deleted (Bug #23463: YAML rendering of external nodes generates incorrect data if hashes are used)
Updated by Daniel Lobato Garcia over 6 years ago
- Has duplicate Bug #23463: YAML rendering of external nodes generates incorrect data if hashes are used added
Updated by Daniel Lobato Garcia over 6 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset d477552ce73a703fbf9fb93e7b1539ec639607ee.
Updated by The Foreman Bot over 6 years ago
- Pull request https://github.com/theforeman/foreman/pull/5786 added
Updated by The Foreman Bot over 6 years ago
- Pull request https://github.com/theforeman/foreman/pull/5787 added