cli icon indicating copy to clipboard operation
cli copied to clipboard

Create user-provided-service is not idempotent when name is already taken

Open sethboyles opened this issue 1 year ago • 0 comments

Please fill out the issue checklist below and provide ALL the requested information.

  • [x] I reviewed open and closed github issues that may be related to my problem.
  • [x] I tried updating to the latest version of the CF CLI to see if it fixed my problem.
  • [x] I attempted to run the command with CF_TRACE=1 to help debug the issue.
  • [x] I am reporting a bug that others will be able to reproduce.

Describe the bug and the command you saw an issue with Trying to create a user-provided-service that already exists fails with exit code 1 instead of succeeding (like most other commands, such as create-space and create-user). I seems like there have been previous efforts to make CF commands idempotent: https://github.com/cloudfoundry/cli/pull/2264

What happened

$ cf create-user-provided-service myservice
Creating user provided service myservice in org org-1 / space org-1-space-1 as admin...
The service instance name is taken: myservice.
FAILED
# exit code 1

Expected behavior

$ cf create-user-provided-service myservice
Creating user provided service myservice  in org org-1 / space org-1-space-1 as admin...
The service instance already exists: myservice.
OK
# exit code 0

Exact Steps To Reproduce Steps to reproduce the behavior; include the exact CLI commands and verbose output:

  1. Run cf create-user-provided-service myservice
  2. Run cf create-user-provided-service myservice again

sethboyles avatar Oct 10 '24 17:10 sethboyles