blob: 52d7e0eabaaa4bf6cb531c728cac156e95bc14e7 [file] [log] [blame]
Gary Wu9abb61c2018-09-27 10:38:50 -07001from robot.api import logger
2import HttpRequests
3
4CONSUL_NAME = "Consul"
5
6class 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)