Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions internal/orchestrator/orchestrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -897,15 +897,9 @@ func CloneApp(

func DeleteApp(ctx context.Context, dockerClient command.Cli, app app.ArduinoApp) error {

runningApp, err := getRunningApp(ctx, dockerClient.Client())
if err != nil {
return err
}
if runningApp != nil && runningApp.FullPath.EqualsTo(app.FullPath) {
// We try to remove docker related resources at best effort
for range StopAndDestroyApp(ctx, dockerClient, app) {
// just consume the iterator
}
// We try to remove docker related resources at best effort
for range StopAndDestroyApp(ctx, dockerClient, app) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am wondering if we by default we should return an error if the app is running or if it has some data, and maybe have a parameter to force this behaviour

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was wondering whether it would be useful to add a parameter to make the command more customizable.
Then I thought: "But in this case, we would need to modify both the CLI and the API."
Looking at the code, I just realized that we don't have a CLI command for app deletion!
I am going to open an issue for that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

already done here #170

// just consume the iterator
}

return app.FullPath.RemoveAll()
Expand Down