Default behavior of the deletion of services' volumes

Hey guys, I would like to speak about the default behavior of the deletion of service’s volumes in the command service delete and service dev.

We introduced in v0.5 the persistence of volume across different service that have the same SID. It’s a great functionality but now we have to think about its default behavior when deleting a service (and its volumes).

Command service delete

The current implementation of the command service delete ask the user 2 confirmations, one for deleting the service and one for deleting the volumes:

➜  core git:(dev) ./dev-cli service delete com.mesg.ethereum.parity.dev
? Are you sure to delete service(s)? Yes
? Are you sure to remove service(s) persistent data as well? Yes
✔ service "com.mesg.ethereum.parity.dev" deleted

The command service delete also offers the flag --keep-data to prevent the deletion of the volumes.

Suggestion

I suggest to remove the second confirmation, but keep the flag --keep-data.
So by default (without passing flag), the service and the volumes are removed. Eg:

➜  core git:(dev) ./dev-cli service delete com.mesg.ethereum.parity.dev
? Are you sure to delete service(s) and its persistent data? Yes
✔ service "com.mesg.ethereum.parity.dev" and its persistent data deleted

If the flag --keep-data is passed, then only the service is removed (not the volumes). Eg:

➜  core git:(dev) ./dev-cli service delete com.mesg.ethereum.parity.dev --keep-data
The persistent data of the service(s) will not be deleted.
? Are you sure to delete service(s)? Yes
✔ service "com.mesg.ethereum.parity.dev" deleted

Command service dev

The command service dev doesn’t delete volumes and there is no option to delete the volumes.
This is quite annoying because the service is removed, so there is no way with the CLI to directly remove the volume (have to deploy the service and delete it).

Suggestion

I suggest that the command service dev removes the volumes by default, and to add the flag --keep-data to prevent the deletion of volumes.


@krhubert @ilgooz @Anthony what do you think about this?

I like this, lgtm. :+1:

100% agree :slight_smile: