ZCA / zenoss-chef-cookbook

Chef Cookbook for Installing and Managing Zenoss
Apache License 2.0
8 stars 6 forks source link

MySQL installation fails with vagrant-cachier #16

Open n1koo opened 10 years ago

n1koo commented 10 years ago
remote_file "#{Chef::Config[:file_cache_path]}/#{details['rpm_file']}" do
  source "http://downloads.mysql.com/archives/mysql-5.5/#{details['rpm_file']}"
  notifies :install, "yum_package[#{name}]", :immediately
  # If the package is already installed, don't bother downloading it
  not_if "rpm -qa | grep -i #{name.gsub('.rpm', '')}"
end

yum_package name do
  source "#{Chef::Config[:file_cache_path]}/#{details['rpm_file']}"
  options "--nogpgcheck"
  not_if "rpm -qa | grep -i #{name.gsub('.rpm', '')}"
  action :nothing
end

Remote-file -block doesn't get run when the files already exist on the fs, and though yum installation doesn't get triggered. Better solutions would be to check the files and check if they are installed.

remote_file "#{Chef::Config[:file_cache_path]}/#{details['rpm_file']}" do
  source "http://downloads.mysql.com/archives/mysql-5.5/#{details['rpm_file']}"
  # If the package is already installed, don't bother downloading it
  not_if { File.exist?("#{Chef::Config[:file_cache_path]}/#{details['rpm_file']}") } 
end

yum_package name do
  source "#{Chef::Config[:file_cache_path]}/#{details['rpm_file']}"
  options "--nogpgcheck"
  not_if "rpm -qa | grep -i #{name.gsub('.rpm', '')}"
  action :install
end
n1koo commented 10 years ago

Same issue with the java recipe too :)

dpetzel commented 10 years ago

Hey @n1koo, I'm not sure I'm understanding the issue here (apologies). Is the issue only when using Vagrant-cachier or do you see this outside of that as well?