[chef] Re: Re: Re: Why does package resource not understand source packages?


Chronological Thread 
  • From: Matthias Marschall < >
  • To:
  • Subject: [chef] Re: Re: Re: Why does package resource not understand source packages?
  • Date: Wed, 23 Jan 2013 09:13:35 +0100

On Tue, Jan 22, 2013 at 11:02 PM, Adam Jacob 
< >
 wrote:
> 
> On 1/22/13 5:33 PM, "Jay Pipes" 
> < >
>  wrote:
> >I'm wondering why if I do this:
> >
> >package "mypackage" do
> >    source "/path/to/my/package.deb"
> >end
> >
> >that the package resource cannot figure out to use the Dpkg provider to
> >install the package?
> >
> >Instead, I get an error about no version specified and no candidate
> >version available:
> >
> >http://paste.openstack.org/show/29738/
> >
> >If I change package to dpkg_package, it works correctly, but I was
> >hoping the generic package resource would handle this based on the file
> >extension...
> 
> No mas. The way Chef works is to map a default provider to the platform
> you are on, not to any other magic (like file extension.) You can, as you
> correctly surmised, use dpkg_package, or specify the provider with the
> provider meta-param.
> 
> 
> Thing is that this would make the recipe platform specific. As folks 
> pointed out, on other the same provider can handle both local files and 
> repos.
You could pass both, source and provider attributes filled from a data bag to 
the package provider. That would keep your cookbook platform independent.
Or you hide a if node['platform'] == 'ubuntu' else block inside a definition. 
The definition could then either create a generic package resource for 
everything not ubuntu and a dpkg_resource on ubuntu.

- Matthias


Archive powered by MHonArc 2.6.16.

§