1

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.

Etan Reisner
  • 77,877
  • 8
  • 106
  • 148
bablu
  • 75
  • 4
  • 11
  • Can `source` in the recipe be a remote URL like that? The documentation I can see doesn't seem to indicate it can. – Etan Reisner Apr 11 '16 at 15:45
  • @EtanReisner I guess we could use as i observed from the example at chef document for remote_file https://docs.chef.io/resource_remote_file.html, but i agree it should be declared in attributes and access it in recipe. I have changed that.Thank you – bablu Apr 12 '16 at 12:56
  • `remote_file` and `package` are not the same thing. And `remote_file` sounds like exactly the sort of thing I'd expect to make the `source` entry in `package` work... just as the posted answer would indicate. – Etan Reisner Apr 12 '16 at 12:59

1 Answers1

0

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
Fabrice Devaux
  • 356
  • 1
  • 3
  • Thank you for correcting me on that. I was able to install the package successfully by correcting the location. But, i am curious to know what path is considered usually for installing packages in Rhel. would it be always "/tmp". I also observed "#{Chef::Config['file_cache_path']" defined in some recipes in the path location and not sure if that points to /tmp location or a different place. could you advice me on that and what does file_cache_path corresponds to.Thanks for your time. – bablu Apr 12 '16 at 13:00