[chef] Chef::Exceptions::FileTypeMismatch


Chronological Thread 
  • From: David Montgomery < >
  • To:
  • Subject: [chef] Chef::Exceptions::FileTypeMismatch
  • Date: Sun, 28 Jul 2013 14:54:23 +0800

Why will this not work?  I am trying to use a override for a cookbook file.  Yet I get the below error

In Attributes:

default['environment']['chef']['validation_key'] = nil
default['environment']['chef']['client_key'] = nil


In recipe:


directory "/home/ubuntu/.chef" do
  owner "ubuntu"
  group "ubuntu"
  mode "0755"
  recursive true
  action :create
end

validation_key = node['environment']['chef']['validation_key']
client_key = node['environment']['chef']['client_key']

cookbook_file "/home/ubuntu/.chef/#{validation_key}" do
  source "#{validation_key}"
  mode 00644
end
cookbook_file "/home/ubuntu/.chef/#{client_key}" do
  source "#{client_key}"
  mode 00644
end



In role with override attribute

"override_attributes": {
                             "environment":{"chef":{"validation_key":"t1"}},
                             "environment":{"chef":{"client_key":"t2"}}   
}






================================================================================
Error executing action `create` on resource 'cookbook_file[/home/ubuntu/.chef/]'
================================================================================


Chef::Exceptions::FileTypeMismatch
----------------------------------
File /home/ubuntu/.chef/ exists, but is a directory, set force_unlink to true to remove


Resource Declaration:
---------------------
# In /home/ubuntu/workspace/chef-repo/cookbooks/environment/recipes/local_chef.rb

 20: cookbook_file "/home/ubuntu/.chef/#{validation_key}" do
 21:   source "#{validation_key}"
 22:   mode 00644
 23: end
 24: cookbook_file "/home/ubuntu/.chef/#{client_key}" do



Compiled Resource:
------------------
# Declared in /home/ubuntu/workspace/chef-repo/cookbooks/environment/recipes/local_chef.rb:20:in `from_file'

cookbook_file("/home/ubuntu/.chef/") do
  provider Chef::Provider::CookbookFile
  action "create"
  retries 0
  retry_delay 2
  path "/home/ubuntu/.chef/"
  backup 5
  atomic_update true
  cookbook_name :environment
  recipe_name "local_chef"
  mode 420
end





Archive powered by MHonArc 2.6.16.

§