undefined method `port_range' for Chef::Resource::FirewallRule
Closed this issue · 1 comments
Cookbook version
[3.1.1]
Chef-client version
[12.18.31]
Platform Details
[ec2 AWS Ubuntu 16.04]
Scenario:
[Open range of ports]
Steps to Reproduce:
name "test"
description "ufw port range test"
run_list [
"recipe[ufw]"
]
override_attributes(
:firewall => {
:rules => [
{"allow to TCP ports 32765-32768 (NFS) from 10.x.x.x/24" => {
"port_range" => "32765..32768",
"source" => "10.x.x.x/24",
"protocol" => "tcp"
}
}
]
}
)
Expected Result:
Open range of ports defined in firewall rules.
Actual Result:
Fails.
Logs:
Recipe Compile Error in /var/chef/cache/cookbooks/ufw/recipes/default.rb
NoMethodError
undefined method `port_range' for Chef::Resource::FirewallRule
Cookbook Trace:
/var/chef/cache/cookbooks/ufw/recipes/default.rb:62:in block (3 levels) in from_file' /var/chef/cache/cookbooks/ufw/recipes/default.rb:53:in
block (2 levels) in from_file'
/var/chef/cache/cookbooks/ufw/recipes/default.rb:34:in each' /var/chef/cache/cookbooks/ufw/recipes/default.rb:34:in
block in from_file'
/var/chef/cache/cookbooks/ufw/recipes/default.rb:32:in each' /var/chef/cache/cookbooks/ufw/recipes/default.rb:32:in
from_file'
Relevant File Content:
/var/chef/cache/cookbooks/ufw/recipes/default.rb:
55: protocol params['protocol'].to_sym if params['protocol']
56: direction params['direction'].to_sym if params['direction']
57: interface params['interface'] if params['interface']
58: logging params['logging'].to_sym if params['logging']
59: port params['port'].to_i if params['port']
60: if params['port_range']
61: ends = params['port_range'].split('..').map { |d| Integer(d) }
62>> port_range ends[0]..ends[1]
63: end
64: source params['source'] if params['source']
65: destination params['destination'] if params['destination']
66: dest_port params['dest_port'].to_i if params['dest_port']
67: position params['position'].to_i if params['position']
68: action act
69: end
70: end
71: end
Platform:
x86_64-linux
Running handlers:
[2018-03-07T12:09:44+00:00] ERROR: Running exception handlers
Running handlers complete
[2018-03-07T12:09:44+00:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated in 07 seconds
[2018-03-07T12:09:44+00:00] INFO: Sending resource update report (run-id: 942f3034-e1ab-4f39-8e98-17ac8f286915)
[2018-03-07T12:09:44+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
[2018-03-07T12:09:44+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2018-03-07T12:09:44+00:00] ERROR: undefined method `port_range' for Chef::Resource::FirewallRule
[2018-03-07T12:09:44+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
Wrong cookbook