puppetlabs-java icon indicating copy to clipboard operation
puppetlabs-java copied to clipboard

Support ensured => purged and/or ensured => absent

Open jgn opened this issue 12 years ago • 8 comments

It is not uncommon to want to REMOVE something.

Therefore, it would be helpful to support ensure => purged and/or ensure => absent.

There seems to be a bug in either Puppet 2.7 or the Oracle RPM that makes ensure => purged not work (it always says created).

A workaround is something like this for init.pp:

  validate_re($version, 'purged|present|installed|latest|^[._0-9a-zA-Z:-]+$')

  # deleted

  case $version {
    'purged': {
      exec {
        "removepackage_$use_java_package_name":
        # Do it "manually" because either Puppet RPM handling bad, or Java RPM can't handle
        command => "/usr/bin/yum -y erase $use_java_package_name",
        onlyif  => "/bin/rpm -ql $use_java_package_name";
      }    
    }
    default: {
      package { 'java':
        ensure => $version,
        name   => $use_java_package_name,
      }
    }
  }

jgn avatar Aug 17 '13 00:08 jgn

+1 really annoys me that so few packages support this, and it looks like a relatively easy win in this case.

stevelacey avatar Mar 03 '14 13:03 stevelacey

Post shipping the upcoming release of PE I'd like to take a look at this module in general as it's a bit of a mess and uncared for. I'll certainly try to ensure things are removable.

I'm always torn back and forth on how much to focus on how easy to make removal. Generally, with the ease of generating new images and vms and docker and etc etc it's almost not worth the effort to make the module so configurable when you can simply rebuild the instance in 20 minutes without the java module assigned to it.

Having said that, I've been in the situation where I just want to say "look, uninstall this and we'll say no more" due to crazy legacy things that make it hard to rebuild, so I'll definitely try my best to make it do so!

apenney avatar Mar 03 '14 13:03 apenney

Since I added this:

We have VMs in various clouds, etc., and it's true, we could create whole new images that has exactly what we want, installing things only.

However, we not infrequently want to do routine removals and upgrades on existing systems. We are also in a compliance environment (HIPAA) where we have some obligations to keep the systems pretty clean.

So . . . I think options to purge and remove should be routine.

jgn avatar Mar 03 '14 13:03 jgn

Obviously, new nodes could be spun up, that doesn't mean that modules shouldn't cater for uninstallation - I am hardly going to reprovision all of my nodes just because I want to switch a module. I recently had this pain switching from one Redis module to another, I had to write a service disable & purge, a kill exec because once the service was absent Puppet couldn't stop the process, and about 12 file purges just so that the nodes ended up in a state where another module could get its service running.

stevelacey avatar Mar 03 '14 13:03 stevelacey

Hello! We are doing some house keeping and noticed that this issue has been open for a long time.

We're going to close it but please do raise another issue if the issue still persists. 😄

chelnak avatar Mar 08 '22 15:03 chelnak

I think that this issue should stay open to be visible as a missing feature, @chelnak. I just had to implement it myself in our code wrapping the use of this module.

gdubicki avatar May 16 '22 11:05 gdubicki

Hey @gdubicki - is this something you'd be interested in submitting a pull request for?

chelnak avatar May 16 '22 11:05 chelnak

Hello! 👋

This issue has been open for a while and has had no recent activity. We've labelled it with attention-needed so that we can get a clear view of which issues need our attention.

If you are waiting on a response from us we will try and address your comments on a future Community Day.

Alternatively, if it is no longer relevant to you please close the issue with a comment.

github-actions[bot] avatar Aug 15 '22 02:08 github-actions[bot]