[chef] Re: Package resource action :purge does nothing when package is not installed


Chronological Thread 
  • From: AJ Christensen < >
  • To: chef < >
  • Subject: [chef] Re: Package resource action :purge does nothing when package is not installed
  • Date: Wed, 6 Mar 2013 08:40:16 +1300

Sounds like a bug due to idempotency checking in the package provider!

I'd expect purge (although naturally, it is a dpkg provider action
technically) to purge all states that are able to be purged, including
dpkg 'c' state.

It looks like the way the apt and dpkg providers are written
(subclassed from Package base) they explicitly check if the package is
'being removed' before allowing a purge. You may be able to adjust
this method temporarily (with a monkey patch, or similar) in order to
affect some test resolution. [0]

Open a ticket up :)

--AJ

[0] 
https://github.com/opscode/chef/blob/master/lib/chef/provider/package.rb#L113-L133

On 6 March 2013 08:33, Cassiano Leal 
< >
 wrote:
> The subject says it all :)
>
> I've got a recipe that purge a package, but I noticed that if the package is
> not installed, :purge doesn't do anything, potentially leaving configuration
> files behind.
>
> In my specific use case, I have uninstalled the package manually, so I have
> it in the "c" state on the apt system -- this is on Ubuntu 12.04. I would
> have expected :purge to actually purge the package.
>
> Is the current behaviour expected, is it a bug, or am I missing something?
>
> Thanks!
> - cassiano
>



Archive powered by MHonArc 2.6.16.

§