I have created the following recipe block which should run at the point that the /etc/httpd/ssl
directory is created:
ruby_block "Copy SSL certificates" do
block do
certificate_file = "#{node['magento']['apache']['project_ssl_location']}/#{node['magento']['apache']['ssl_certificate_filename']}"
key_file = "#{node['magento']['apache']['project_ssl_location']}/#{node['magento']['apache']['ssl_certificate_key_filename']}"
chain_file = "#{node['magento']['apache']['project_ssl_location']}/#{node['magento']['apache']['ssl_certificate_chain_filename']}"
if File.exists?(certificate_file) && File.exists?(key_file)
FileUtils.cp(certificate_file, "#{node['apache']['dir']}/ssl")
FileUtils.cp(key_file, "#{node['apache']['dir']}/ssl")
end
if File.exists?(chain_file)
FileUtils.cp(chain_file, "#{node['apache']['dir']}/ssl")
end
end
action :nothing
subscribes :create, resources(:directory => "/etc/httpd/ssl")
end
(This is directly modelled off an opscode example - under "Stash a file in a data bag")
In the Chef output, I can see my recipe file being loaded:
[2013-09-18T13:19:45+00:00] DEBUG: Loading Recipe chef-magento::copy_ssl_certificates via include_recipe
and, lower down, I can see the directory being created:
[2013-09-18T13:22:40+00:00] INFO: Processing directory[/etc/httpd/ssl] action create (apache2::default line 138)
[2013-09-18T13:22:40+00:00] INFO: directory[/etc/httpd/ssl] created directory /etc/httpd/ssl
[2013-09-18T13:22:40+00:00] INFO: directory[/etc/httpd/ssl] owner changed to 0
[2013-09-18T13:22:40+00:00] INFO: directory[/etc/httpd/ssl] group changed to 0
[2013-09-18T13:22:40+00:00] INFO: directory[/etc/httpd/ssl] mode changed to 755
[2013-09-18T13:22:40+00:00] INFO: Processing directory[/etc/httpd/conf.d] action create (apache2::default line 145)
but at no point does it run my code.
What am I doing wrong?