diff options
author | danielsdeleo <dan@chef.io> | 2015-09-14 11:29:32 -0700 |
---|---|---|
committer | danielsdeleo <dan@chef.io> | 2015-09-17 14:29:49 -0700 |
commit | 3d7ec975024e85f24ef8e4782a00eeb178d379e8 (patch) | |
tree | f680c32568e0d8575bbef8f287b50fae24389f5d /lib | |
parent | 6f65a2ea7771a319e4315d68dd5234aeedc7dfd9 (diff) | |
download | chef-3d7ec975024e85f24ef8e4782a00eeb178d379e8.tar.gz |
Add policyfile attrs to node JSON when present
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chef/node.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/chef/node.rb b/lib/chef/node.rb index 65ed21a442..34a1edf835 100644 --- a/lib/chef/node.rb +++ b/lib/chef/node.rb @@ -510,6 +510,14 @@ class Chef #Render correctly for run_list items so malformed json does not result "run_list" => @primary_runlist.run_list.map { |item| item.to_s } } + # Chef Server rejects node JSON with extra keys; prior to 12.3, + # "policy_name" and "policy_group" are unknown; after 12.3 they are + # optional, therefore only including them in the JSON if present + # maximizes compatibility for most people. + unless policy_group.nil? && policy_name.nil? + result["policy_name"] = policy_name + result["policy_group"] = policy_group + end result end |