Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 1 | from robot.api import logger |
| 2 | import HttpRequests |
| 3 | |
| 4 | CONSUL_NAME = "Consul" |
| 5 | |
| 6 | class ConsulLibrary: |
| 7 | |
| 8 | def publish_hv_ves_configuration_in_consul(self, consul_url, consul_configuration_filepath): |
| 9 | logger.info("Reading consul configuration file from: " + consul_configuration_filepath) |
| 10 | file = open(consul_configuration_filepath, "rb") |
| 11 | data = file.read() |
| 12 | file.close() |
| 13 | |
| 14 | logger.info("PUT at: " + consul_url) |
| 15 | resp = HttpRequests.session_without_env().put(consul_url, data=data, timeout=5) |
| 16 | HttpRequests.checkStatusCode(resp.status_code, CONSUL_NAME) |