terra-ops / terra-cli

The Terra Command Line Interface
http://terra.readthedocs.org
GNU General Public License v2.0
48 stars 17 forks source link

Allow the user to remove an environment's containers but keep the files. #127

Closed proofoftom closed 7 years ago

proofoftom commented 8 years ago

I often find myself wanting to remove the current set of containers but leave the files in place, an example would be if I were testing out new .terra.yml/docker-compose configurations. This will only ask if you want to delete the files if you answered yes to removing the containers, or used the --yes flag.

$ terra env:remove dcco 2016
Are you sure you would like to remove the containers for environment dcco:2016? [y/N] y
Would you like to delete all files at /Users/tommy/Apps/dcco/2016? [y/N]

Running 'docker-compose kill' in /Users/tommy/.terra/environments/dcco/dcco-2016
Killing dcco2016_load_1 ... done
Killing dcco2016_app_1 ... done
Killing dcco2016_drush_1 ... done
Killing dcco2016_database_1 ... done
DOCKER >
Running 'docker-compose rm -f' in /Users/tommy/.terra/environments/dcco/dcco-2016
DOCKER > Not including one-off containers created by `docker-compose run`.
To include them, use `docker-compose rm --all`.
This will be the default behavior in the next version of Compose.

Removing dcco2016_load_1 ... done
Removing dcco2016_app_1 ... done
Removing dcco2016_drush_1 ... done
Removing dcco2016_database_1 ... done
DOCKER > Going to remove dcco2016_load_1, dcco2016_app_1, dcco2016_drush_1, dcco2016_database_1
Environment dcco:2016 has been removed.
screenshot 2016-06-10 09 54 34
proofoftom commented 7 years ago

I RTFM and realized what I was trying to do could be accomplished simply by running env:en and conceptually there's little reason to need to clean up the containers yet leave the files in place. Closing to avoid adding extra complexity.

jonpugh commented 7 years ago

I'm not opposed to a --save-containers option or something like that