[BUG] Consul agent_service_maintenance using incorrect HTTP method
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.7k
- Forks
- 5.6k
- Avg merge
- 2d 44m
- Merged PRs (30d)
- 80
Description
Description
The agent_service_maintenance function int he consul module uses an HTTP GET call rather than an HTTP PUT call as defined in the API documentation https://www.consul.io/api-docs/agent/service#enable-maintenance-mode.
Setup
Set up a salt minion with the consul agent installed locally and a service running that is registered in consul.
Steps to Reproduce the behavior
Run the consul module using the command
salt '*' consul.agent_service_maintenance consul_url='http://localhost:8500' serviceid='redis' enable='True' reason='Down for upgrade'
Expected behavior
The consul service is set into maintenance mode
Additional context
The relevant context in the source code is here https://github.com/saltstack/salt/blob/f1da86977d0d690c621c33e1c2ca8eecc261c03c/salt/modules/consul.py#L1164 where the method parameter is omitted which makes it default to HTTP GET.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in salt/modules/consul.py around line 1164 and compare the agent_service_maintenance request with Consul's enable-maintenance-mode API documentation. Reproduce it with the provided salt command against a local Consul agent, then verify that the service enters maintenance mode as expected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- infrastructure
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100