Project

General

Profile

Actions

Bug #23382

closed

Editing Smart Class Parameter of type YAML creates malformed value in release 1.17.0

Added by Vadim Bulst almost 6 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Urgent
Category:
Parameters
Target version:
Fixed in Releases:
Found in Releases:

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


Related issues 2 (0 open2 closed)

Related to Foreman - Bug #23581: Upgrade to Foreman 1.17 converts YAML to JSON HashResolvedActions
Has duplicate Foreman - Bug #23463: YAML rendering of external nodes generates incorrect data if hashes are usedDuplicate04/30/2018Actions
Actions #1

Updated by Anonymous almost 6 years ago

  • Related to Bug #23463: YAML rendering of external nodes generates incorrect data if hashes are used added
Actions #2

Updated by Anonymous almost 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...

Actions #3

Updated by Anonymous almost 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?

Actions #4

Updated by Tomer Brisker almost 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.

Actions #5

Updated by Anonymous almost 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?

Actions #6

Updated by Tobias Ehrig almost 6 years ago

The fix mentioned by Henry Spanka doesnt work for me. (Debian Stretch installed via DEB Repositoy)

Actions #7

Updated by Anonymous almost 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.

Actions #8

Updated by Tobias Ehrig almost 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.

Actions #9

Updated by Tomer Brisker almost 6 years ago

  • Related to Bug #23581: Upgrade to Foreman 1.17 converts YAML to JSON Hash added
Actions #10

Updated by Daniel Lobato Garcia almost 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" 
Actions #11

Updated by Daniel Lobato Garcia almost 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" 
Actions #12

Updated by Daniel Lobato Garcia almost 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
Actions #13

Updated by The Foreman Bot almost 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
Actions #14

Updated by Daniel Lobato Garcia almost 6 years ago

  • Related to deleted (Bug #23463: YAML rendering of external nodes generates incorrect data if hashes are used)
Actions #15

Updated by Daniel Lobato Garcia almost 6 years ago

  • Has duplicate Bug #23463: YAML rendering of external nodes generates incorrect data if hashes are used added
Actions #16

Updated by Daniel Lobato Garcia almost 6 years ago

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

Updated by The Foreman Bot almost 6 years ago

  • Pull request https://github.com/theforeman/foreman/pull/5786 added
Actions #18

Updated by The Foreman Bot almost 6 years ago

  • Pull request https://github.com/theforeman/foreman/pull/5787 added
Actions

Also available in: Atom PDF