consulate icon indicating copy to clipboard operation
consulate copied to clipboard

Bug is in api method deregister service.

Open linuxoid69 opened this issue 7 years ago • 3 comments

import consulate

consul_host = os.environ['CONSUL_HOST']

consul = consulate.Consul(consul_host)

consul.agent.service.deregister('redis')

Your code use Method GET. You need to use ### PUT. So, service can't been deleted.

16:55:48.376090 IP colswic01.test.local.56820 > 172.18.0.2.8500: Flags [P.], seq 323:501, ack 491, win 245, options [nop,nop,TS val 1460761607 ecr 1460761605], length 178 E...L.@.@.............!4..:68.......Y...... W.t.W.t.GET /v1/agent/service/deregister/redis HTTP/1.1 Host: 127.0.0.1:8500 Accept-Encoding: gzip, deflate Connection: keep-alive User-Agent: python-requests/2.19.1 Accept: /

16:55:48.376423 IP 172.18.0.2.8500 > colswic01.test.local.56820: Flags [P.], seq 491:737, ack 501, win 252, options [nop,nop,TS val 1460761607 ecr 1460761607], length 246 E..*..@[email protected].........!4..8.....:.....YD..... W.t.W.t.HTTP/1.1 405 Method Not Allowed Allow: OPTIONS,PUT Content-Encoding: gzip Content-Type: text/plain; charset=utf-8 Vary: Accept-Encoding Date: Mon, 25 Jun 2018 13:55:48 GMT Content-Length: 46

linuxoid69 avatar Jun 25 '18 14:06 linuxoid69

I'm seeing this as well. Is this the wrong API to call?

gbiv avatar Oct 11 '18 17:10 gbiv

This seems related to the following change in Consul: https://github.com/hashicorp/consul/issues/3659#issuecomment-342519570

karma0 avatar Oct 25 '18 20:10 karma0

pip was not updated https://pypi.org/project/consulate/#files consul.agent.service.deregister('redis') still use return self._get_no_response_body(['deregister', service_id]) instead _put_no_response_body().

Deadkorskiy avatar Jan 16 '19 10:01 Deadkorskiy