def get(self, hostname): result = common.getHostnameInfo(hostname) if result: ansiblevars = [host["vars"] for host in result] data = {"vars": ansiblevars} else: data = {"vars": ""} return data
def get_hostinfo(self, hostname): result = common.getHostnameInfo(hostname) host = [item for item in result] if len(hostname) == 0: return None elif not host: return None elif host[0]["vars"] == None: return None else: for item in host: print item ansiblevars = item["vars"] return ansiblevars