[chef] Re: Re: RE: RE: possible to pass options to yum on package install


Chronological Thread 
  • From: Daniel Condomitti < >
  • To:
  • Subject: [chef] Re: Re: RE: RE: possible to pass options to yum on package install
  • Date: Wed, 27 Mar 2013 23:03:20 -0700

What happens if you run `yum install tomcat7 --enablerepo=amzn-main` directly? Try adding flush_cache :before to the package provider call.

On Wednesday, March 27, 2013 at 10:36 PM, Jeremy Koerber wrote:

Thanks for the reply, Justin. I just tried yum_package instead of package, and unfortunately it seems that it doesn't honor the options either. Here's what I have in the recipe:

yum_package "tomcat7" do
  options "--enablerepo=amzn-main"
  action :install
end

and here is the chef-client error:
[2013-03-27T22:25:17-07:00] DEBUG: Processing yum_package[tomcat7] on qa-app-searchsvc-1-i-a9ea7fc9
[2013-03-27T22:25:17-07:00] INFO: Processing yum_package[tomcat7] action install (tomcat7::default line 50)
[2013-03-27T22:25:17-07:00] DEBUG: yum_package[tomcat7] couldn't match tomcat7 in installed Provides, loading available Provides - this may take a moment
[2013-03-27T22:25:52-07:00] DEBUG: yum_package[tomcat7] checking yum info for tomcat7
[2013-03-27T22:25:52-07:00] DEBUG: yum_package[tomcat7] installed version: (none) candidate version: (none)
[2013-03-27T22:25:52-07:00] ERROR: yum_package[tomcat7] (tomcat7::default line 50) has had an error
[2013-03-27T22:25:52-07:00] ERROR: yum_package[tomcat7] (/var/chef/cache/cookbooks/tomcat7/recipes/default.rb:50:in `from_file') had an error:
yum_package[tomcat7] (tomcat7::default line 50) had an error: Chef::Exceptions::Package: No version specified, and no candidate version available for tomcat7
/usr/lib/ruby/gems/1.8/gems/chef-10.12.0/bin/../lib/chef/provider/package.rb:50:in `action_install'


And here is the info in the failed-run-data.json - you can see it has my disablerepo option in there:
  {
      "json_class": "Chef::Resource::YumPackage",
      "instance_vars": {
        "arch": null,
        "delayed_notifications": [

        ],
        "resource_name": "yum_package",
        "response_file": null,
        "enclosing_provider": null,
        "allowed_actions": [
          "nothing",
          "install",
          "upgrade",
          "remove",
          "purge",
          "reconfig"
        ],
        "flush_cache": {
          "before": false,
          "after": false
        },
        "source_line": "/var/chef/cache/cookbooks/tomcat7/recipes/default.rb:50:in `from_file'",
        "provider": "Chef::Provider::Package::Yum",
        "ignore_failure": false,
        "action": [
          "install"
        ],
        "package_name": "tomcat7",
        "noop": null,
        "supports": {
        },
        "before": null,
        "retry_delay": 2,
        "candidate_version": null,
        "version": null,
        "source": null,
        "allow_downgrade": false,
        "recipe_name": "default",
        "updated_by_last_action": false,
        "params": {
        },
        "immediate_notifications": [

        ],
        "updated": false,
        "retries": 0,
        "name": "tomcat7",
        "options": "--enablerepo=amzn-main",
        "cookbook_name": "tomcat7"
      }
    }


I think it isn't using the enablerepo option when it's looking for the candidates, which needs to happen since I have the repo disabled otherwise.  I also tried setting up the yum-priorities-plugin and that gets me around this issue, but then I run into some other dependency mess. The ideal option is to just be able to temporarily enable the repo at the time of package install.

Any ideas?

Thanks


On Wed, Mar 27, 2013 at 8:03 PM, Justin Witrick < " target="_blank"> > wrote:

 

Im not sure if you saw this resource or not but if you are specifically using yum you can use the 'yum_package' resource and that allows yum options to be passed to it.

 

http://docs.opscode.com/resource_yum.html

 

 


Justin



-----Original Message-----
From: "Kevin Keane Subscription" < " target="_blank"> >
Sent: Wednesday, March 27, 2013 9:07pm
To: " " target="_blank"> " < " target="_blank"> >
Subject: [chef] RE: possible to pass options to yum on package install

I’ve had a similar situation where I needed *one* package out of repoforge, but it created dependency hell everywhere else. My solution was to create my own local repository (and I’m using a chef cookbook to set up this repository). For me, it particularly made sense because I also have a couple RPMs that I need but aren’t in available in any public repo at all.

I haven’t yet figured out a way to keep these RPMs updated automatically, though.

From: Jeremy Koerber [mailto: " target="_blank"> ]
Sent: Wednesday, March 27, 2013 2:39 PM
To: " target="_blank">
Subject: [chef] possible to pass options to yum on package install

 

Hi,

I have this in a recipe:

package "tomcat7" do
action :install
options "--enablerepo=amzn-main"
end

but the options are not being passed to yum and the package fails to install because it isn't found in my regular yum repos that are enabled by default. I can't enable the amzn-main repo by default because then the system starts using it for everything, and I end up with some messy dependency conflicts. Plus, I strongly prefer to just use the CentOS-Base repo wherever possible.

So.. Looking at http://docs.opscode.com/resource_package.html and I see:
options Additional options that are added to the underlying package command. Can be used with APT, dpkg, Gentoo, RPM Package Manager, and RubyGems. Default value: nil.

 

So that would explain why Yum isn't getting the options passed to it. So my questions are: is there a way to do this, and why can't chef pass options to yum just like APT?

Thanks much for any help..

 

Jeremy




--
Jeremy Koerber
Director - Tech Ops







Archive powered by MHonArc 2.6.16.

§