Override run list failed


#1

hey guys,
I think i need some code changes. I have a role that comprises of multiple
recipes defined via the run list. Everything is okay in the normal
chef-client run. But executing the chef-client with an override of the
runlist ( chef-client -o recipe[python_app] ) fails with the below error.

[2015-04-15T16:59:43+00:00] FATAL: Stacktrace dumped to
/var/chef/cache/chef-stacktrace.out

Chef Client failed. 0 resources updated in 8.684779084 seconds

[2015-04-15T16:59:44+00:00] ERROR: resource deploy_revision[/opt/mount/]
is configured to notify resource service[DEF] with action restart, but
service[DEF] cannot be found in the resource collection.
deploy_revision[/opt/mount1/] is defined in
/var/chef/cache/cookbooks/python_app/recipes/python-deploy.rb:32:in
`from_file’

*[2015-04-15T16:59:44+00:00] FATAL: Chef::Exceptions::ChildConvergeError:
Chef run process exited unsuccessfully (exit code 1) *

Below are the 2 recipes for the cookbook (“python_app” & “python-deploy”).
There are rooms for improvements in this cookbook, but that will be saved
for another day. I am looking for the error

Recipe: Python_app

data_bag = Chef::EncryptedDataBagItem.load("#{node.chef_environment}",
"#{node.chef_environment}")

rpm = [‘zlib-devel’, ‘openssl-devel’]
rpm.each do |pkg|
package pkg
end

user ‘python’ do
supports :manage_home => true
comment "Python user"
home "/home/python"
shell "/bin/bash"
end

directory “#{node[:base_dir]}/#{node[:application_name]}” do
owner 'python’
group 'python’
mode 00755
recursive true
end

directory ‘/home/python/.ssh’ do
recursive true
owner 'python’
group 'python’
end

template ‘/home/python/.ssh/authorized_keys’ do
source 'ssh_key.erb’
mode 00600
owner 'python’
group 'python’
variables(
:key => node[:ssh_key][:deployment]
)
end

template ‘/home/python/.ssh/github_rsa’ do
source 'ssh_key.erb’
mode 00600
owner 'python’
group 'python’
variables(
:key => data_bag[“github_key”]
)
end

template ‘/home/python/.ssh/config’ do
source 'ssh_config.erb’
mode 00644
owner 'python’
group 'python’
variables(
hosts: [{host: “abc.com”,
hostname: “abc.com”,
user: “builder”,
identityfile: ‘~/.ssh/github_rsa’,
stricthostkeychecking: “no”,
}]
)
end

ark ‘python’ do
url 'https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tgz
path "/opt/mount1/"
owner 'python’
action :put
end

execute “cd #{node[:base_dir]}/python && ./configure && make && make
altinstall” do
not_if { File.exists?(’/usr/local/bin/python2.7’) }
end

remote_file “#{node[:base_dir]}/get-pip.py” do
source “https://bootstrap.pypa.io/get-pip.py"
mode 00755
not_if { File.exists?(”#{node[:base_dir]}/get-pip.py")}
end

execute “/usr/local/bin/python2.7 #{node[:base_dir]}/get-pip.py”

cookbook_file “ua-parser-master.tar” do
path "/tmp/ua-parser-master.tar"
not_if { File.exists?(’/tmp/ua-parser-master.tar’) }
end

execute ‘tar -C /tmp -xvf /tmp/ua-parser-master.tar && chown -R root.root
/tmp/ua-parser-master/ && /usr/local/bin/pip install /tmp/ua-parser-master’

execute ‘/usr/local/bin/pip install tornado pyyaml user-agents’

include_recipe ‘python_app::python-deploy’

---------------------------------------------------------------------------…

*Recipe: python-deploy *

python-deploy
#the ‘application_name’ value is DEF <- defined in the attributes

directory “#{node[:base_dir]}/#{node[:application_name]}/logs” do
owner 'python’
group 'python’
mode 00755
recursive true
end

template “/etc/init.d/#{node[:application_name]}” do
source 'python_init’
mode 00755
owner 'root’
group 'root’
variables(
:application_name => node[:application_name],
:DEF_environment => node[:DEF][:environment],
)
end

service “#{node[:application_name]}” do
supports :restart => true
action :enable
end

execute “chown -R python:python
#{node[:base_dir]}/#{node[:application_name]}”

execute “chown -R python:python #{node[:base_dir]}/python”

data_bag = Chef::EncryptedDataBagItem.load("#{node.chef_environment}",
"#{node.chef_environment}")

deploy_revision “/opt/mount1/#{node[:application_name]}” do
repo "#{node[:application_repo]}"
user "python"
revision node.chef_environment
keep_releases 10
action :deploy
migrate false
symlink_before_migrate.clear
create_dirs_before_symlink
purge_before_symlink.clear
symlinks.clear
symlinks {}
notifies :restart, "service[DEF]"
end