hashicorp / hashicorp/consul

consul config delete is ambiguous

Open
#18,166 2 comments 0 reactions 1 assignee Claimed by @nvanthao View on GitHub
Dominant language
Go
Stars
30.1k
Forks
4.6k
Avg merge
2d 6h
Merged PRs (30d)
43

Description

#### Overview of the Issue

The `consul config delete` command deletes the configuration entry specified by the kind and name. However, it always reports success, even if the entry does not exist.

#### Reproduction Steps

Steps to reproduce this issue, eg:

1. Run `consul agent -dev`
1. Run `consul config delete` with any Kind and Name
1. View message

```
~ consul config delete -kind service-defaults -name foo
Config entry deleted: service-defaults/foo

~ consul config delete -kind service-resolver -name bar
Config entry deleted: service-resolver/bar

~ curl -v --request DELETE 0:8500/v1/config/service-resolver/foobar
* Trying 0.0.0.0:8500...
* Connected to 0.0.0.0 (127.0.0.1) port 8500 (#0)
> DELETE /v1/config/service-resolver/foobar HTTP/1.1
> Host: 0.0.0.0:8500
> User-Agent: curl/7.88.1
> Accept: */*
>
< HTTP/1.1 200 OK
< Content-Type: application/json
< Vary: Accept-Encoding
< X-Consul-Default-Acl-Policy: allow
< Date: Tue, 18 Jul 2023 12:02:36 GMT
< Content-Length: 3
<
{}
```

### Consul info for both Client and Server
Consul 1.16.0

I believe the fix is straightforward and would like to contribute a PR.

https://github.com/hashicorp/consul/blob/62005369b54c63ccd7842c001de740ff3795d02c/agent/consul/config_endpoint.go#L135-L150

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.