Skip to content

loadjson returns StringIO data which doesn't work in Puppet 8 #1414

Open
@bgibson710

Description

@bgibson710

Describe the Bug

When using loadjson in a puppet manifest with small json files, the returning Data values come in as a StringIO instead of String value which Puppet 8 can't cast properly.

Expected Behavior

Return a hash of Strings.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Use loadjson as documented to pull in a json file that you want to convert to hash.
  2. Run puppet agent and see the error.

Environment

  • RedHat Enterprise Linux 8
  • Puppet 8.3.0

Additional Context

I was able to fix this by editing the loadjson ruby code lines 56 and 63 changing from
JSON.parse(content) || args[1]
to
JSON.parse(content.string) || args[1]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions