New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default chef attributes value may lead to accessing nil. #282
Comments
This is caused due to the desription in this readme: One solution to this problem may be: default_attributes = {}
default_attributes.default_proc=->(a,_){a}
chef_node = attribute('chef_node', description: 'Chef Node', default: default_attributes) It's not pretty at all, but it works. We could also predefine it somewhere and just call it. Or let inspec get a default for chef_node = attribute('chef_node', description: 'Chef Node', type: :hash) |
This doesn't feel like an audit cookbook problem, it feels like an InSpec problem. Since we don't support the passing of attributes during a |
@adamleff Fully agreed. Hide the implementation, maybe respect types.... moving this to InSpec. |
Prevents #282 with InSpec >= 1.38.4 Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
Prevents #282 with InSpec >= 1.38.4 Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
Using "Option 2: Use the chef node object" to pull in chef attributes may lead to code like this:
During an
inspec check
the value ofchef_node
by default is{}
which lead to accessing[] from nil
.Proposed solution: Use a mesh that always returns something accessible by default.
The text was updated successfully, but these errors were encountered: