Query if the package already installed

I need to do specific actions in recipe if the some packages are
installed. How can i check this automatic? Or i need to write some code
(bash …) ? Does chef Package resource provide query for installed
packages ?


Vasiliy G Tolstov v.tolstov@selfip.ru
Selfip.Ru

If you use the package resource it should be automatic.

On Jul 6, 2010, at 5:09 AM, Vasiliy G Tolstov wrote:

I need to do specific actions in recipe if the some packages are
installed. How can i check this automatic? Or i need to write some code
(bash ...) ? Does chef Package resource provide query for installed
packages ?

--
Vasiliy G Tolstov v.tolstov@selfip.ru
Selfip.Ru

I think he's asking a different question.

Vasiliy wants to conditionally do something based on packages being
installed.

My opinionated answer is, you should not think about the problem this way.

You should specify that a package is installed or it is not, then do the
appropriate things.

If you wanted to add functionality that would report installed packages, in
my opinion, the appropriate place is probably ohai.

Then you could do whatever logic in the recipes.

On Tue, Jul 6, 2010 at 11:56 AM, Alex Soto apsoto@gmail.com wrote:

If you use the package resource it should be automatic.

On Jul 6, 2010, at 5:09 AM, Vasiliy G Tolstov wrote:

I need to do specific actions in recipe if the some packages are
installed. How can i check this automatic? Or i need to write some code
(bash ...) ? Does chef Package resource provide query for installed
packages ?

--
Vasiliy G Tolstov v.tolstov@selfip.ru
Selfip.Ru

There was a ticket I opened some moons ago regarding caching the list of
installed/available packages to node/ohai data. May be relevant to this
discussion.

case has_package? :provider, 'foo' or similar.

Regards,

AJ

On 7 July 2010 06:20, Andrew Shafer andrew@cloudscaling.com wrote:

I think he's asking a different question.

Vasiliy wants to conditionally do something based on packages being
installed.

My opinionated answer is, you should not think about the problem this way.

You should specify that a package is installed or it is not, then do the
appropriate things.

If you wanted to add functionality that would report installed packages, in
my opinion, the appropriate place is probably ohai.

Then you could do whatever logic in the recipes.

On Tue, Jul 6, 2010 at 11:56 AM, Alex Soto apsoto@gmail.com wrote:

If you use the package resource it should be automatic.

On Jul 6, 2010, at 5:09 AM, Vasiliy G Tolstov wrote:

I need to do specific actions in recipe if the some packages are
installed. How can i check this automatic? Or i need to write some code
(bash ...) ? Does chef Package resource provide query for installed
packages ?

--
Vasiliy G Tolstov v.tolstov@selfip.ru
Selfip.Ru

В Втр, 06/07/2010 в 12:20 -0600, Andrew Shafer пишет:

I think he's asking a different question.

Vasiliy wants to conditionally do something based on packages being
installed.

My opinionated answer is, you should not think about the problem this
way.

You should specify that a package is installed or it is not, then do
the appropriate things.

If you wanted to add functionality that would report installed
packages, in my opinion, the appropriate place is probably ohai.

I'm try to modify ohai to get php modules under languages/php. But if
ohai would get all modules for all languages - this slowdown ohai run. I
think - do what i need only in recipes...

--
Vasiliy G Tolstov v.tolstov@selfip.ru
Selfip.Ru

В Срд, 07/07/2010 в 08:26 +1200, AJ Christensen пишет:

There was a ticket I opened some moons ago regarding caching the list
of installed/available packages to node/ohai data. May be relevant to
this discussion.

case has_package? :provider, 'foo' or similar.

Yes, interesting feature.

--
Vasiliy G Tolstov v.tolstov@selfip.ru
Selfip.Ru