Handling package removal

Hi

Forgive me if this is a newbie question, but is there a good way to check if a package (rpm) is installed before i remove it? I tried to search the archives but couldn’t dig anything useful so far.

Thanks in advance,
Greg

If you have a package resource with a remove action nothing will
happen unless the package is installed. I assume you have some other
reason you want to know if the package is installed ?

On Thu, Jul 26, 2012 at 4:17 PM, Greg Pendler pendler@gmail.com wrote:

Hi

Forgive me if this is a newbie question, but is there a good way to check if
a package (rpm) is installed before i remove it? I tried to search the
archives but couldn't dig anything useful so far.

Thanks in advance,
Greg

The original recipe has "rpm -e --nodeps" - i'll probably need to change that.

--
Greg Pendler
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

On Thursday, July 26, 2012 at 4:26 PM, Jesse Nelson wrote:

If you have a package resource with a remove action nothing will
happen unless the package is installed. I assume you have some other
reason you want to know if the package is installed ?

On Thu, Jul 26, 2012 at 4:17 PM, Greg Pendler <pendler@gmail.com (mailto:pendler@gmail.com)> wrote:

Hi

Forgive me if this is a newbie question, but is there a good way to check if
a package (rpm) is installed before i remove it? I tried to search the
archives but couldn't dig anything useful so far.

Thanks in advance,
Greg

This is in an execute resource, you should probably be using package
with the rpm provider which should ensure idempotence.

something like:

package "foo" do
action :remove
options "--nodeps"
provider Chef::Provider::package::Rpm
end

Untested, but should work. Wiki says the rpm provider supports passing options.

On Thu, Jul 26, 2012 at 4:28 PM, Greg Pendler pendler@gmail.com wrote:

The original recipe has "rpm -e --nodeps" - i'll probably need to change
that.

--
Greg Pendler
Sent with Sparrow

On Thursday, July 26, 2012 at 4:26 PM, Jesse Nelson wrote:

If you have a package resource with a remove action nothing will
happen unless the package is installed. I assume you have some other
reason you want to know if the package is installed ?

On Thu, Jul 26, 2012 at 4:17 PM, Greg Pendler pendler@gmail.com wrote:

Hi

Forgive me if this is a newbie question, but is there a good way to check if
a package (rpm) is installed before i remove it? I tried to search the
archives but couldn't dig anything useful so far.

Thanks in advance,
Greg

Will try, thanks a lot...

--
Greg Pendler
Sent with Sparrow (http://www.sparrowmailapp.com/?sig)

On Thursday, July 26, 2012 at 4:34 PM, Jesse Nelson wrote:

This is in an execute resource, you should probably be using package
with the rpm provider which should ensure idempotence.

something like:

package "foo" do
action :remove
options "--nodeps"
provider Chef::Provider::package::Rpm
end

Untested, but should work. Wiki says the rpm provider supports passing options.

On Thu, Jul 26, 2012 at 4:28 PM, Greg Pendler <pendler@gmail.com (mailto:pendler@gmail.com)> wrote:

The original recipe has "rpm -e --nodeps" - i'll probably need to change
that.

--
Greg Pendler
Sent with Sparrow

On Thursday, July 26, 2012 at 4:26 PM, Jesse Nelson wrote:

If you have a package resource with a remove action nothing will
happen unless the package is installed. I assume you have some other
reason you want to know if the package is installed ?

On Thu, Jul 26, 2012 at 4:17 PM, Greg Pendler <pendler@gmail.com (mailto:pendler@gmail.com)> wrote:

Hi

Forgive me if this is a newbie question, but is there a good way to check if
a package (rpm) is installed before i remove it? I tried to search the
archives but couldn't dig anything useful so far.

Thanks in advance,
Greg

On Thu, Jul 26, 2012 at 7:34 PM, Jesse Nelson spheromak@gmail.com wrote:

Untested, but should work. Wiki says the rpm provider supports passing options.

http://wiki.opscode.com/display/chef/Resources

Greg, this is the wiki reference for resources and providers. If you
haven't already you should familiarize yourself with the primitive
resources that Chef supports. You'll get better support using them and
saving the execute resource when you have to run a specific program or
there is no other workaround.

Bryan