Skip to content
This repository has been archived by the owner on Aug 14, 2019. It is now read-only.

Initial run fails due to missing /var/chef/handlers directory #45

Open
rgriffith opened this issue Jun 23, 2017 · 1 comment
Open

Initial run fails due to missing /var/chef/handlers directory #45

rgriffith opened this issue Jun 23, 2017 · 1 comment

Comments

@rgriffith
Copy link

I've been running into an issue with chef-client runs after adding this handler that causes the check-in to fail due to a missing /var/chef/handlers directory.

Code

As simple as the following:

include_recipe 'chef-client::cron'
include_recipe 'slack_handler'

Stack Trace

Chef::Exceptions::EnclosingDirectoryDoesNotExist
------------------------------------------------
cookbook_file[/var/chef/handlers/slack_handler_util.rb] (slack_handler::default line 37) had an error: Chef::Exceptions::EnclosingDirectoryDoesNotExist: Parent directory /var/chef/handlers does not exist.

Cookbook Trace:
---------------
  /var/chef/cache/cookbooks/slack_handler/recipes/default.rb:42:in `from_file'
  /var/chef/cache/cookbooks/cascade-cloud-instance/recipes/default.rb:22:in `from_file'
  /var/chef/cache/cookbooks/cloud-client-tdi/recipes/default.rb:10:in `from_file'

Relevant File Content:
----------------------
/var/chef/cache/cookbooks/slack_handler/recipes/default.rb:

 35:  end
 36:  
 37:  cookbook_file "#{node['chef_handler']['handler_path']}/slack_handler_util.rb" do
 38:    source 'slack_handler_util.rb'
 39:    mode "0600"
 40:    action :nothing
 41:    # end
 42>> end.run_action(:create)
 43:  
 44:  cookbook_file handler_file do
 45:    source handler_source
 46:    mode "0600"
 47:    action :nothing
 48:    # end
 49:  end.run_action(:create)
 50:  
 51:  chef_handler "Chef::Handler::Slack" do

Platform:
---------
x86_64-linux

Node is running on Amazon Linux (ami-0b33d91d) and is already bootstrapped. What's strange is didn't run into this issue when originally setting things up in test with the same exact setup.

Is it recommended to manually ensure /var/chef/handlers exists before including the recipe, or is this an issue with the Slack handler?

spuder added a commit to spuder/chef-slack_handler-1 that referenced this issue Jun 23, 2017
@spuder
Copy link
Contributor

spuder commented Jun 23, 2017

The reason is that chef_handler 3.0.0 was released a couple of days ago which has a breaking change.
There are 2 solutions

  1. Pin the slack_handler cookbook dependency on chef_handler version 2.x

  2. Pin the slack_handler cookbook dependency on chef_handler version 3.x.x and rewrite the slack_handler cookbook to use the new lwrp syntax in chef_handler 3.x.x

I've implemented solutions number 1 in MR #46

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants