Skip to content

Instantly share code, notes, and snippets.

@joshcooper
Last active August 30, 2018 00:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshcooper/393fb55a5d3ba371c6d627bc6882aa0b to your computer and use it in GitHub Desktop.
Save joshcooper/393fb55a5d3ba371c6d627bc6882aa0b to your computer and use it in GitHub Desktop.

Given file with binary file content:

class rich {
  file { '/tmp/binary':
    ensure => file,
    content => Binary('YWJj'),
  }
}

Without richdata, the type information is lost, and we just store the value as content:

$ bx puppet apply -e "include rich" --catalog_cache_terminus json
Notice: Compiled catalog for localhost in environment production in 0.02 seconds
Warning: File[/tmp/binary]['content'] contains a Puppet::Pops::Types::PBinaryType::Binary value. It will be converted to the String 'YWJj' (file: /Users/josh/.puppetlabs/etc/code/environments/production/modules/rich/manifests/init.pp, line: 2)

and the catalog contains:

      "parameters": {
        "ensure": "file",
        "content": "YWJj"
      }

When richdata is enabled, the catalog contains:

      "parameters": {
        "ensure": "file",
        "content": {
          "__ptype": "Binary",
          "__pvalue": "YWJj"
        }
      }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment