Project

General

Profile

Actions

Bug #9240

closed

Using hashes via api fails with !ruby/hash:ActiveSupport::HashWithIndifferentAccess

Added by Anonymous almost 10 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
API
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

We like to use the puppetlabs/lvm module via Foreman api.

Adding this hash via WebUI works fine:

######################################
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
######################################

When using the API with this rest call:

curl -k -u username:password -H "Accept: version=2,application/json" -H "Content-Type: application/json" -X POST -d '{"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"}}}}}}' https://foreman.example.com/api/smart_class_parameters/386/override_values

The call is accepted, but the entry in Foreman looks like this:

######################################
--- !ruby/hash:ActiveSupport::HashWithIndifferentAccess
testvg: !ruby/hash:ActiveSupport::HashWithIndifferentAccess
  physical_volumes:
  - /dev/sdb
  - /dev/sdc
  logical_volumes: !ruby/hash:ActiveSupport::HashWithIndifferentAccess
    test1: !ruby/hash:ActiveSupport::HashWithIndifferentAccess
      size: 128M
      mountpath: /opt/test1
    test2: !ruby/hash:ActiveSupport::HashWithIndifferentAccess
      size: 128M
      mountpath: /opt/test2
    test3: !ruby/hash:ActiveSupport::HashWithIndifferentAccess
      size: 128M
      mountpath: /opt/test3
    test4: !ruby/hash:ActiveSupport::HashWithIndifferentAccess
      size: 128M
      mountpath: /opt/test4
    test5: !ruby/hash:ActiveSupport::HashWithIndifferentAccess
      size: 128M
      mountpath: /opt/test5
######################################

Related issues 1 (1 open0 closed)

Related to Foreman - Refactor #23183: Remove HashWithIndifferentAccess workaroundNewActions
Actions

Also available in: Atom PDF