0

Currently I am using consul watch & consul exec commands to create watches as well as to run some bash commands. I would like to use http api calls instead of commands to automate my system.

Is there http equivalents to do this work ?

Any help would be appreciated. Thanks

inari6
  • 401
  • 1
  • 9
  • 19

1 Answers1

0

Under "Consul SDK":

https://www.consul.io/downloads_tools.html

there are bunches of libraries in various languages to talk to Consul. I personally like Consulate, a Python API. you would be interested in the event call: http://consulate.readthedocs.io/en/stable/events.html The consul exec and watches commands both use the event system. I don't know the exact event(s) you would need to send to simulate an exec call, but I'm sure you can break out a watch, run an exec and see what it does. Worse case you would have to look into the Consul source(written in go).

zie
  • 710
  • 4
  • 7
  • Thanks for your response. I looked at exec go command code and as you said it has calls to KV & event. It would be nice to have API calls directly instead of writing our own implementations :) – inari6 Aug 31 '16 at 17:24
  • Yes, It would be nice. Perhaps you can post here the event calls for doing exec, to help the next person wanting to do this? – zie Aug 31 '16 at 17:27
  • 1
    I just went through their code very briefly and didn't get a chance to create proper event calls yet, I will post it here once I find a way to do it. – inari6 Aug 31 '16 at 17:31