check whether arg hostname exists or not

This commit is contained in:
ahmadbilalkhalid 2019-07-20 20:18:23 +05:00
parent a0a30f46ae
commit bc1854aa25

View file

@ -222,6 +222,10 @@ def main():
args = argparser.parse_args() args = argparser.parse_args()
host = client.get(args.hostname, value_in_json=True) host = client.get(args.hostname, value_in_json=True)
if not host:
print("No Such Host")
exit(1)
host.value["status"] = "ALIVE" host.value["status"] = "ALIVE"
host.value["last_heartbeat"] = datetime.utcnow().isoformat() host.value["last_heartbeat"] = datetime.utcnow().isoformat()