Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] wash app delete command returns success for invalid application name #502

Closed
1 of 9 tasks
ffuerste opened this issue Dec 4, 2024 · 1 comment · Fixed by #513
Closed
1 of 9 tasks

[BUG] wash app delete command returns success for invalid application name #502

ffuerste opened this issue Dec 4, 2024 · 1 comment · Fixed by #513

Comments

@ffuerste
Copy link

ffuerste commented Dec 4, 2024

Affected project(s)

  • documentation
  • examples
  • wasmCloud host
  • wasmCloud CLI (wash)
  • wasmCloud dashboard UI (washboard)
  • capability providers
  • provider bindgen
  • control interface client
  • other / not sure

Describe the bug

If an incorrect model name is passed without a version to the wash app del <app_name> command, it still outputs a success message ("Deleted application: <app_name>") even though this app does not exist.

Steps to reproduce

  • list all applications with wash app list
  • try to delete an app using an invalid name without specifying a version
  • check the apps again with wash app list to confirm no changes have occurred

Example:

$ wash app list
  Name                                  Deployed Version                      Status
  rust-hello-world                      01JE99W346KMJR9XG33FE7QBYM            Deployed
    └ HTTP hello world demo in Rust, using the WebAssembly Component Model and WebAssembly Interfaces Types (WIT)
$ wash app del test
Deleted application: test
$ wash app list
  Name                                  Deployed Version                      Status
  rust-hello-world                      01JE99W346KMJR9XG33FE7QBYM            Deployed
    └ HTTP hello world demo in Rust, using the WebAssembly Component Model and WebAssembly Interfaces Types (WIT)

Expected behavior

The wash app del command should return a meaningful message for invalid app names instead of printing a success message. The output should be the same as for invalid versions:

$ wash app del test 1.0.0
Already deleted application: test

Environment

  • OS: MacOS
  • Shell: zsh
  • wasmcloud Versions:
    $ wash -V
    wash          v0.37.0
    ├ nats-server v2.10.20
    ├ wadm        v0.18.0
    └ wasmcloud   v1.4.2

Root Cause

wadm only checks wether the application actually exists if a version has been specified (see here). If no version was specified, wadm simply deletes the application manifest (see here) without covering the DeleteResult::Noop case.

Proposal

Checking first if for the specified application a manifest exists and start a deletion attempt only in case it does. Otherwise return early with DeleteResult::Noop.

If you agree with my proposal, I would be happy to create a PR for it.

@brooksmtownsend
Copy link
Member

@ffuerste I agree here! I think we should still mark the operation as successful for idempotency, but we should indicate that the application was "already deleted" as you said. Please feel free to open a PR anytime

ffuerste pushed a commit to ffuerste/wasmCloud-wadm that referenced this issue Dec 5, 2024
…was specified (wasmCloud#502)

Signed-off-by: Florian Fürstenberg <florian.fuerstenberg@posteo.de>
ffuerste pushed a commit to ffuerste/wasmCloud-wadm that referenced this issue Dec 5, 2024
…was specified (wasmCloud#502)

Signed-off-by: Florian Fürstenberg <florian.fuerstenberg@posteo.de>
ffuerste pushed a commit to ffuerste/wasmCloud-wadm that referenced this issue Dec 10, 2024
Signed-off-by: Florian Fürstenberg <florian.fuerstenberg@posteo.de>
thomastaylor312 pushed a commit that referenced this issue Dec 12, 2024
…was specified (#502)

Signed-off-by: Florian Fürstenberg <florian.fuerstenberg@posteo.de>
thomastaylor312 pushed a commit that referenced this issue Dec 12, 2024
Signed-off-by: Florian Fürstenberg <florian.fuerstenberg@posteo.de>
ffuerste pushed a commit to ffuerste/wasmCloud-wadm that referenced this issue Dec 18, 2024
…was specified (wasmCloud#502)

Signed-off-by: Florian Fürstenberg <florian.fuerstenberg@posteo.de>
ffuerste pushed a commit to ffuerste/wasmCloud-wadm that referenced this issue Dec 18, 2024
Signed-off-by: Florian Fürstenberg <florian.fuerstenberg@posteo.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants