Skip to content
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

chef-shell fails on firewall resources #187

Open
kam1kaze opened this issue Feb 5, 2018 · 1 comment
Open

chef-shell fails on firewall resources #187

kam1kaze opened this issue Feb 5, 2018 · 1 comment
Labels
Priority: Medium Will bring visible benefit to the project

Comments

@kam1kaze
Copy link

kam1kaze commented Feb 5, 2018

Cookbook version

2.6.3

Chef-client version

13.7.16

Platform Details

CentOS 7

Scenario:

I wanna run my run_list using chef-shell -z to debug the code.

Steps to Reproduce:

Add recipe 'firewall::default' to run_list and execute run_chef in chef-shell -z

Expected Result:

successfully executed

Actual Result:

Getting track-back

================================================================================
Error executing action `create` on resource 'firewall_rule[established]'
================================================================================

NoMethodError
-------------
undefined method `resource_collection' for nil:NilClass

Cookbook Trace:
---------------
/var/chef/cache/cookbooks/firewall/libraries/provider_firewall_rule.rb:27:in `action_create'

Full log has been attached:
chef.log

The issue could be fixed by changing how we access run_context, Chef.run_context.resource_collection to Chef.node.run_context.resource_collection in all resources. But I'm not sure if it's right?

@martinb3
Copy link
Contributor

martinb3 commented Feb 6, 2018

Hey there -- I actually asked around when I decided on Chef.run_context; supposedly that's the standard interface. It's possible Chef Shell is just going to be incompatible with an accumulator pattern cookbook (where multiple resources matter); I'd welcome input from Chef developers on the right way to do this, but I'm not sure switching to Chef.node is it (it'll break other use cases, IIRC).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: Medium Will bring visible benefit to the project
Projects
None yet
Development

No branches or pull requests

4 participants