I'm following the tracks/modules to learn chef.
Everything went well till now. I'm now at this course: Learn Chef
foodcritic . is okay
cookstyle . is okay
But the issue starts when I add deprecations_as_errors: true in the .kitchen.yml. I run kitchen converge and the kitchen converge seems not to fail but I get 'warnings'.
Deprecated features used! Cloning resource attributes for apt_package[install libapache2 package] from prior resource Previous apt_package[install libapache2 package]: /tmp/kitchen/cache/cookbooks/custom_apache/recipes/default.rb:31:in `block in from_file' Current apt_package[install libapache2 package]: /tmp/kitchen/cache/cookbooks/custom_apache/recipes/default.rb:31:in `block in from_file' at 1 location: - /tmp/kitchen/cache/cookbooks/custom_apache/recipes/default.rb:31:in `block in from_file' See https://docs.chef.io/deprecations_resource_cloning.html for further details. Chef Client finished, 0/12 resources updated in 02 seconds Downloading files from <default-ubuntu-1604> Finished converging <default-ubuntu-1604> (0m3.60s).
Now I just 'ignored' this and went for the fix of the deprecated features.
I replace packages = %w( libapache2-modsecurity libapache2-mod-spamhaus )
with package %w( libapache2-modsecurity libapache2-mod-spamhaus )
but now kitchen converge even fails:
Running handlers: [2018-02-25T15:05:30+00:00] ERROR: Running exception handlers Running handlers complete [2018-02-25T15:05:30+00:00] ERROR: Exception handlers complete Chef Client failed. 0 resources updated in 01 seconds [2018-02-25T15:05:30+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out [2018-02-25T15:05:30+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report [2018-02-25T15:05:30+00:00] ERROR: No resource, method, or local variable named `packages' for `Chef::Recipe "default"' [2018-02-25T15:05:30+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1) >>>>>> ------Exception------- >>>>>> Class: Kitchen::ActionFailed >>>>>> Message: 1 actions failed. >>>>>> Converge failed on instance <default-ubuntu-1604>. Please see .kitch