Search code examples
chef-infrayumtest-kitchen

Error executing action `install` on resource 'yum_package[newrelic-repo]'


I was trying to download newrelic-5-3.rpm file and then try to install the package in my chef receipe. I am getting the following exception when I try to run kitchen-verify

 Chef::Exceptions::Package
       -------------------------
       Package newrelic-repo not found: https://download.newrelic.com/pub/newrelic/el5/i386/newrelic-repo-5-3.noarch.rpm

My recipe:

remote_file "newrelic.rpm" do
  source "https://download.newrelic.com/pub/newrelic/el5/i386/newrelic-repo-5-3.noarch.rpm"
  owner 'root'
  group 'root'
  mode  0755
end

package "newrelic-repo" do
  source "https://download.newrelic.com/pub/newrelic/el5/i386/newrelic-repo-5-3.noarch.rpm"
  action  :install
end

Commands

yum -y install https://download.newrelic.com/pub/newrelic/el5/i386/newrelic-repo-5-3.noarch.rpm
yum -y install newrelic-sysmond

However, when I try to run the commands individually as root user on the rhel-67 box, I was able to install them successfully. Can any one help me to figure out where I am going wrong in my recipe and I guess I could be giving incorrect source location on the package resource in my recipe and I am stuck here.


Solution

  • The source property of the yum_package resource is not a URL but a path on the local filesystem.

    You should point it at the location where you are download it to with the remote_file resource. I'd recommend an absolute path.

    E.g.

    remote_file "/tmp/newrelic.rpm" do
      source "https://download.newrelic.com/pub/newrelic/el5/i386/newrelic-repo-5-3.noarch.rpm"
      owner 'root'
      group 'root'
      mode  0755
    end
    
    package "newrelic-repo" do
      source "/tmp/newrelic.rpm"
      action  :install
    end