def get_ansible_service(self): zk = Zookeeper(options.zk_host) path_exist = yield zk.check_path_exist(options.ansible_node_path) if path_exist is False: raise Exception('Ansible Service None') try: node = yield zk.get_node(options.ansible_node_path) ansible_url = 'http://' + node[0].decode('utf8') except Exception as error: gen_log.error(error) else: raise Return(ansible_url)
def get_provision_service(self): zk = Zookeeper(options.zk_host) path_exist = yield zk.check_path_exist(options.provision_node_path) if path_exist is False: raise Exception('ProvisionService None') try: node = yield zk.get_node(options.provision_node_path) provision_service = node[0].decode('utf8') except Exception as error: gen_log.error(error) else: raise Return(provision_service)
def get_provision_service(self): zk = Zookeeper(options.zk_host) path_exist = yield zk.check_path_exist(options.provision_node_path) if path_exist is False: raise Exception('Async Provision Service None') try: node = yield zk.get_node(options.provision_node_path) provision_url = 'http://' + node[0].decode('utf8') except Exception as err: raise err else: raise Return(provision_url)
def __init__(self, cookie, async_api_url, init_json=dict()): self.task_name = init_json['task_name'] self.create_time = init_json['create_time'] self.update_time = init_json['update_time'] self.user_name = init_json['user_name'] self.result = init_json['result'] self.task_type = init_json['task_type'] self.task_flag = json_decode(init_json['task_flag']) self.task_args = json_decode(init_json['task_args']) self.zk = Zookeeper(options.zk_host) self.cookie = cookie self.async_api_url = async_api_url