dapr / cli

Command-line tools for Dapr.
Apache License 2.0
317 stars 202 forks source link

`dapr uninstall --all` should warn if container runtime is not running #1288

Closed shubham1172 closed 1 year ago

shubham1172 commented 1 year ago

Expected Behavior

When Docker (or any container runtime) is not running, dapr uninstall --all should throw a warning since placement, redis, and zipkin containers won't be removed.

Actual Behavior

dapr uninstall --all exits with success status code and no warning.

Steps to Reproduce the Problem

Ensure that docker is not running.

>> dapr uninstall --all
ℹ️  Removing Dapr from your machine...
ℹ️  Removing directory: /Users/shubham1172/.dapr/bin
ℹ️  Removing directory: /Users/shubham1172/.dapr
✅  Dapr has been removed successfully

Release Note

RELEASE NOTE: FIX dapr uninstall --all to throw warning if Docker is not running

mcaupybugs commented 1 year ago

Hi based on the description of the bug I can see that adding an else if condition after this piece of code and checking if uninstallPlacementContainer or uninstallAll variable is set to true and giving warning should be the solution.

containerRuntimeAvailable := false
    containerRuntimeAvailable = utils.IsDockerInstalled() || utils.IsPodmanInstalled()
    if containerRuntimeAvailable {
        containerErrs = removeContainers(uninstallPlacementContainer, uninstallAll, dockerNetwork, runtimeCmd)
    }

If this solution works, Can I contribute to this? Or please let me know if i am missing something.

mukundansundar commented 1 year ago

Contributions are always welcome. Please go ahead and comment /assign to assign the issue to yourself.

mcaupybugs commented 1 year ago

/assign