Comment 1 for bug 1246343

Revision history for this message
Roger Peppe (rogpeppe) wrote :

[I'm going to assume that the destroy-environment command
above printed an error message and failed - if not, my assumptions
are faulty and there's another problem going on that I have not
identified]

I think there are at least two issues going on here:

Firstly: if the bootstrap fails and the .jenv file has been
created as a result of bootstrapping, it's not removed.
I think it should.

Secondly: if destroy-environment fails to talk to the
provider, the .jenv file is not removed. This is more arguable.
It may be that the error is transient, and that running
destroy-environment again may succeed. In that
case, do we really want to destroy the .jenv file,
which may be our only handle on the environment,
including references to resources that need to be cleaned up?

To solve the second issue, perhaps we should have a --force
flag on destroy-environment which forces removal of the
.jenv file even if we cannot talk to the environment That is
slightly awkward though, as we already have a --yes flag which could
be construed as similar.

As another passing thought, we could potentially have a
"juju forget-environment" command that just removes the .jenv file without attempting
to destroy the environment. When people are passing .jenv
files around a lot, perhaps this might make sense. I'm
not keen currently though.