Skip to content

Latest commit

 

History

History
37 lines (27 loc) · 917 Bytes

deprecations_json_auto_inflate.md

File metadata and controls

37 lines (27 loc) · 917 Bytes

+++ title = "Deprecation: JSON Auto Inflate (CHEF-1)" draft = false

gh_repo = "chef-web-docs" robots = "noindex" sitemapExclude = true aliases = "/deprecations_json_auto_inflate.html" +++

Internally, the Chef::REST class attempts to guess which Chef class a JSON document relates too, and then automatically turns the JSON in to that class.

This deprecation warning was added in Chef Infra Client 12.7.2, and JSON auto inflation will be removed permanently in Chef Infra Client 13.

Example

When loading an environment from the Chef Infra Server, you might previously have written:

name = 'my_environment'
chef_server_rest.get("environments/#{name}")

and received a Chef::Environment object back.

Remediation

You now need to explicitly create a new object of the desired type.

name = 'my_environment'
Chef::Environment.from_hash chef_server_rest.get("environments/#{name}")