Query if the package already installed


#1

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


#2

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


#3

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


#4

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


#5

В Втр, 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


#6

В Срд, 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