Reusing Machines Previously Provisioned by Juju

Some time ago, we removed logic related to automatically uninstalling Juju assets, in order to prevent any possibility that a machine can decommission itself, or that a controller can self-destruct.

Following from this there has been the occasional case where an operator, attempting to re-provision a machine previously used by Juju has encountered an already-provisioned error. This happens when Juju detects that its services are already installed on a machine.

In order to streamline machine re-use, Juju now adds a script via cloud-init to /sbin, called remove-juju-services. Invoking this script will remove the Juju services that when present, prevent machine provisioning.

NOTE: Running this script removes the contents of directories used by the Juju MongoDB, and by Raft. Running this on a live Juju installation will render it inoperable.

Nice work @manadart. Which version of Juju is this script included in?

This was added to the 2.7 RC.