kapilt / juju-digitalocean

JuDo - A juju provider for digital ocean using a client side plugin and manual provisioning.
111 stars 17 forks source link

add a --force option to plugin destroy-environment #22

Closed ubuntudemon closed 10 years ago

ubuntudemon commented 10 years ago

Destroying the environment leaves the machines running. I have to destroy it by hand from the digital ocean control panel.

(judo)roald@T-2500:~/.juju$ juju status environment: digitalocean machines: "0": agent-state: started agent-version: 1.19.0 dns-name: 188...* instance-id: 'manual:' series: precise hardware: arch=i386 cpu-cores=1 mem=495M services: {}

(judo)roald@T-2500:~/.juju$ juju destroy-environment digitalocean WARNING! this command will destroy the "digitalocean" environment (type: manual) This includes all machines, services, data and other resources.

Continue [y/N]? y

(judo)roald@T-2500:~/.juju$ juju status ERROR Unable to connect to environment "digitalocean". Please check your credentials or use 'juju bootstrap' to create a new environment.

Error details: bootstrap-host: expected string, got nothing

(judo)roald@T-2500:~/.juju$ ping 188... PING 188.226.183.87 (188.226.183.87) 56(84) bytes of data. 64 bytes from 188..._: icmpreq=1 ttl=55 time=10.1 ms 64 bytes from 188...: icmpreq=2 ttl=55 time=10.8 ms 64 bytes from 188...: icmpreq=3 ttl=55 time=10.3 ms 64 bytes from 188...: icmpreq=4 ttl=55 time=11.2 ms ^C --- 188.._.\ ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 3003ms rtt min/avg/max/mdev = 10.101/10.633/11.254/0.449 ms

kapilt commented 10 years ago

you need to destroy the environment using the plugin. The plugin can't override the behavior of built-in commands. Ie per the docs/readme you can destroy an environment with

$ juju docean destroy-environment.

and all machines in the environment will be terminated.

kapilt commented 10 years ago

I'm leaving this open cause i think it would be good to add a --force option on the plugin to delete all docean instances that are associated to an environment, instead of resolving against the environment status. ie.. cleanup nicely if a user accidentally destroys their environment with juju destroy-environment, but still wants to use the plugin to remove any associated environment resources/instances.

kapilt commented 10 years ago

the --force option was added to destroy-environment it only uses the digital ocean api (doesn't interact with juju) at all.

also added a juju docean list-machines cli which uses the api to just return information on machines in the environment (-a for all machines on account in do).