chef-cookbooks / iptables

Development repository for Chef Cookbook iptables

Home Page:https://supermarket.chef.io/cookbooks/iptables

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compile time errors in ChefSpec

martinisoft opened this issue · comments

Cookbook version

4.3.3

Chef-client version

ChefDK 2.4.17

Platform Details

Travis-CI

Scenario:

Trying to get what were passing specs to run and it looks like a recent change has now caused compile errors.

Steps to Reproduce:

Write a ChefSpec test with a cookbook that includes the iptables cookbook as a dependency, doesn't even have to be a direct dependency, it will fail.

Expected Result:

I expect it to compile and run the tests, but it does not get that far.

Actual Result:

Here is the backtrace I see in CI:

Chef::Exceptions::ValidationFailed:
       Property source must be one of: String!  You passed nil.
     # /tmp/chefspec20180215-4772-1f2r2qhfile_cache_path/cookbooks/iptables/resources/rule.rb:20:in `class_from_file'
     # ./spec/unit/recipes/networking_spec.rb:28:in `block (2 levels) in <top (required)>'
     # ./spec/unit/recipes/networking_spec.rb:37:in `block (3 levels) in <top (required)>'

The spec backtrace lines at the bottom are the ChefSpec::ServerRunner block calling env.converge(described_recipe) so this is definitely a compile time issue and validation is exploding.

I have pushed up a PR with a proposed fix.

Having the same issue with 4.3.3. openssh cookbook depends on this one, even though we're not using iptables at all and aren't calling any resources from it, but we are using openssh, and 4.3.3 is throwing the above exception with chef-client 13.7.6

I can provide more data if needed. Locking iptables to 4.3.2 for now as this fixes the issue.

4.3.3 was released shortly after this post and my PR so this is good to go now. See 3048af7