Skip to content

Using firewall_rule in custom resource not possible #212

Description

@anewb

Cookbook version

2.7.0

Chef-client version

14.11.21

Platform Details

Ubuntu 18.04

Scenario:

Using firewall_rule in a custom resource results in exception Chef::Exceptions::ResourceNotFound

Chef::Exceptions::ResourceNotFound
----------------------------------
Cannot find a resource matching firewall[default] (did you define it first?)

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

Steps to Reproduce:

Create new cookbook with recipe default.rb:

fw 'Test fw' do
	action :configure
end

and resource fw.rb:

resource_name :fw

action :configure do
	firewall 'default' do
		action :install
	end

	firewall_rule 'ssh' do
		port 22
		action :create
	end
end

Add this cookbook to the runlist of a node.

Expected Result:

Firewall is installed, enabled and the rule is added.

Actual Result:

Using firewall_rule from a custom resource results in exception Chef::Exceptions::ResourceNotFound for firewall[default], error message see under Scenario.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions