diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2016-09-09 10:24:42 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2016-09-21 10:37:59 -0700 |
commit | 723bac74427f6f605fd2c9ab855afe59ba84d08b (patch) | |
tree | 957ccc2475a557a8d96cff5b69c1dc8ebcfebcc3 /lib/chef/cookbook/metadata.rb | |
parent | ed0729ba1ef9a7494dbe374c9ee2ec0c776a76f6 (diff) | |
download | chef-723bac74427f6f605fd2c9ab855afe59ba84d08b.tar.gz |
ignore unknown metadata fields in metadata.rb
if we're just using chef-zero there's no metadata.json file so
chef-client doesn't do json parsing (which ignores unknown metadata
fields already) but parses metadata.json which explodes.
i believe since TK goes through berks it renders the rb to json before
copying to the virt so we don't see this in TK or in running chef-client
from a real server.
this only affects the chef-client -z or chef-zolo mode of operation (and
probably legacy chef-solo)
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/chef/cookbook/metadata.rb')
-rw-r--r-- | lib/chef/cookbook/metadata.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/chef/cookbook/metadata.rb b/lib/chef/cookbook/metadata.rb index ab83da9e55..212c596272 100644 --- a/lib/chef/cookbook/metadata.rb +++ b/lib/chef/cookbook/metadata.rb @@ -722,6 +722,14 @@ class Chef end end + def method_missing(method, *args, &block) + if block_given? + super + else + Chef::Log.warn "ignoring method #{method} on cookbook with name #{name}, possible typo or future metdata?" + end + end + private # Helper to match a gem style version (ohai_version/chef_version) against a set of |