check whether arg hostname exists or not
This commit is contained in:
parent
a0a30f46ae
commit
bc1854aa25
1 changed files with 4 additions and 0 deletions
4
main.py
4
main.py
|
@ -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()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue