Problem using receipe ufw


#1

Hi All im trying to use the ufw receipe.
https://supermarket.chef.io/cookbooks/ufw/versions/3.1.0

I create a role "pabx"
i thne created a databag called firewall, inside the data bag i have a file called pabx.json

Contents below ip address changed for security

{
“id”: “pabx”,
“rules”: [
{“http”: {
“port”: “80”,
“action” : “deny”
}}
,
{“block http from 192.168.1.0/24”: {
“port”: “80”,
“source”: “192.168.1.0/24”,
“action”: “deny”
}}
,
{“Allow access to tcp 80 from 122.122.122.3” : {
“protocol” : “tcp”,
“port” : “80”,
“source” : “122.122.122.3”,
“dest_port” : “80”
}}
,
{“ssh”: {
“port”: “22”
}}
,
{“nrpe”: {
“port”: “5666”
}}
,
{“mysql”: {
“port”: “3306”
}}
,
{“sip”: {
“port”: “5060,5061”
}}
,
{“ssh”: {
“port”: “22”
}}
,
{“Allow access to tcp 5038 from122.122.122.3” : {
“port” : “5038”,
“source” : “122.122.122.3”,
“dest_port” : “5038”
}}
,
{“Allow access to tcp 5038 from 122.122.0.0/16” : {
“port” : “5038”,
“source” : “122.122.0.0/16”,
“dest_port” : “5038”
}}
]
}

Then i added the ufw::databag receipe to the role.

When i run chef-client i now get this error

Installing Cookbook Gems:
Compiling Cookbooks…

================================================================================
Recipe Compile Error in /var/chef/cache/cookbooks/ufw/recipes/databag.rb

NoMethodError

undefined method `concat’ for {}:Chef::Node::VividMash

Cookbook Trace:

/var/chef/cache/cookbooks/ufw/recipes/databag.rb:54:in block in from_file' /var/chef/cache/cookbooks/ufw/recipes/databag.rb:47:ineach’
/var/chef/cache/cookbooks/ufw/recipes/databag.rb:47:in `from_file’

Relevant File Content:

/var/chef/cache/cookbooks/ufw/recipes/databag.rb:

47: rlist.each do |entry|
48: Chef::Log.debug "ufw::databag: “#{entry}”"
49: next unless fw_db.member?(entry)
50:
51: # add the list of firewall rules to the current list
52: item = data_bag_item(‘firewall’, entry)
53: rules = item[‘rules’]
54>> node.normal[‘firewall’][‘rules’].concat(rules) unless rules.nil?
55: end
56:
57: # now go apply the rules
58: include_recipe 'ufw::default’
59:

System Info:

chef_version=13.5.3
platform=ubuntu
platform_version=14.04
ruby=ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-linux]
program_name=chef-client worker: ppid=7442;start=08:31:51;
executable=/opt/chef/bin/chef-client

Any ideas on what im doing wrong.
I did find this online but just someone else with the error.
No solution
https://github.com/chef-cookbooks/ufw/issues/32