Checking for the existance of a package

Hello,

I’m new with Chef(and ruby), please excuse me if I’m just being thick.

I’m using the windows_feature provider from the windows cookbook to
install roles on a Windows 2012 server.
On W2012 however, you cannot install .Net framework 3.5 without
providing some installation sources.
So far, I work around that by using remote_directory and by shelling
out to cmd, something like:


I’d like to skip the remote_directory copy when the feature has been
installed, however, so my question is:

Is there no way to simply check if some feature/package is installed?
The provider implements the method ‘installed?’. Can I not call it
somehow from my recipes?

Thanks alot!

regards,
Sölvi Páll Á.

On Wednesday, February 13, 2013 at 2:14 PM, Sölvi Páll Ásgeirsson wrote:

Hello,

I'm new with Chef(and ruby), please excuse me if I'm just being thick.

I'm using the windows_feature provider from the windows cookbook to
install roles on a Windows 2012 server.
On W2012 however, you cannot install .Net framework 3.5 without
providing some installation sources.
So far, I work around that by using remote_directory and by shelling
out to cmd, something like:
gist:c07e032ff7858aa53932 · GitHub
I'd like to skip the remote_directory copy when the feature has been
installed, however, so my question is:

Is there no way to simply check if some feature/package is installed?
The provider implements the method 'installed?'. Can I not call it
somehow from my recipes?

I'm not very familiar with the Windows stuff, but it seems like you should be able to get the desired behavior with either not_if (and only_if) or notifications. Those are documented at the top of this page:

http://docs.opscode.com/chef/resources.html

Thanks alot!

regards,
Sölvi Páll Á.

--
Daniel DeLeo

Hi,

Thanks, yeah - that's what I'm trying to do. :slight_smile:
The issue is however that I don't understand what I should pass as a
parameter to not_if, to ask the provider if a package is installed.

regards,
Sölvi

On Fri, Feb 15, 2013 at 4:26 PM, Daniel DeLeo dan@kallistec.com wrote:

On Wednesday, February 13, 2013 at 2:14 PM, Sölvi Páll Ásgeirsson wrote:

Hello,

I'm new with Chef(and ruby), please excuse me if I'm just being thick.

I'm using the windows_feature provider from the windows cookbook to
install roles on a Windows 2012 server.
On W2012 however, you cannot install .Net framework 3.5 without
providing some installation sources.
So far, I work around that by using remote_directory and by shelling
out to cmd, something like:
gist:c07e032ff7858aa53932 · GitHub
I'd like to skip the remote_directory copy when the feature has been
installed, however, so my question is:

Is there no way to simply check if some feature/package is installed?
The provider implements the method 'installed?'. Can I not call it
somehow from my recipes?

I'm not very familiar with the Windows stuff, but it seems like you should
be able to get the desired behavior with either not_if (and only_if) or
notifications. Those are documented at the top of this page:

All Infra Resources

Thanks alot!

regards,
Sölvi Páll Á.

--
Daniel DeLeo