checking is package is installed ?

31 views
Skip to first unread message

kaustubh chaudhari

unread,
Jan 28, 2014, 1:21:11 PM1/28/14
to puppet...@googlegroups.com
Hi,

How do we check if the package is installed, before installing it.

I with to uninstall a package which i can do with ensure => absent, but before doing this, i would like to check if the package really exists on the system or not?

Can someone help in here or redirect me to the correct documentation.

-Kaustubh

Gareth Rushgrove

unread,
Jan 28, 2014, 5:42:30 PM1/28/14
to puppet...@googlegroups.com
This isn't really how puppet works, but that's a good thing.

By saying absent you're not saying "uninstall this package" you're
saying "I want this package to be absent".

Therefore when you run the Puppet code with ensure => absent on a
system where the package isn't already installed it won't do anything,
the state is already as you have requested. Under the hood it will
check if the package is already installed - you don't have to do this
yourself.

Think of Puppet as describing the state you want, not as running a
series of commands and you'll write much better code.

Gareth

> -Kaustubh
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to puppet-users...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/90e7a177-d567-4b7c-8fe7-cb30e06af0be%40googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.



--
Gareth Rushgrove
@garethr

devopsweekly.com
morethanseven.net
garethrushgrove.com
Message has been deleted

Andreas Dvorak

unread,
Jan 30, 2014, 10:41:00 AM1/30/14
to puppet...@googlegroups.com
Hi,

I think the explaination of Gareth is wrong.
absend will uninstall a package

I am using absend to uninstall package and here is a web site about that.
http://www.puppetcookbook.com/posts/remove-package.html

Best regards
Andreas

Matthew Burgess

unread,
Jan 30, 2014, 10:51:49 AM1/30/14
to puppet...@googlegroups.com
On 30 January 2014 15:41, Andreas Dvorak <andreas...@gmail.com> wrote:
Hi,

I think the explaination of Gareth is wrong.

​No, he's exactly right.  And please be careful with your spelling...it's 'absent', not 'absend'.  Your puppet manifests are not scripts/sets of instructions.  They define what end-state you want the node that applies the resource to be in when the agent has finished running.  i.e. by specifying 'absent' in your package resource you're not explicitly telling puppet to uninstall the package.  The package may already not be present, in which case puppet won't do anything at all (it has nothing to do).  If the package is present though, puppet will indeed uninstall it.​


​Kind Regards,

Matt.

José Luis Ledesma

unread,
Jan 30, 2014, 11:51:20 AM1/30/14
to puppet...@googlegroups.com

Hi,

   If you want to check if a server is compliant with a defined  end state, you can set noop=true in the resources, or just run puppet in noop mode.

Regards

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages