I happened find that in ~/.chef/knife.rb
or /etc/chef/client.rb
,
any error will be ignored by knife or chef-client.
...
a_non_exist_method a_non_exist_var
...
puts "==== #{a_non_exist_method}"
it is totally fine, even if the a_non_exist_method a_non_exist_var
is absolutely wrong.
The result will be of course
====
How does chef-client
/knife
execute client.rb
/knife.rb
?
PS: I know knife.rb
and client.rb
is a config file, not supposed to add user program logic there, just curious that why it put anything in it without error?
It is evaluated as a Chef::Config class instance, which inherit from mixlib-config, which depending on how you tested that may not be in strict mode (relevant code)
So you may end up with a property ignored without warning nor error when not setting strict mode.
Your puts
just get evaluated as standard ruby, string interpolation search for a variable even if you called it a_non_exist_method
and from ruby duck typing, it's a nil value, wich interpolated as string is an empty string.