mirror of
https://github.com/FAUSheppy/athq-vm-management
synced 2025-12-06 05:41:35 +01:00
fix: don't crash on inaccessible host
This commit is contained in:
12
backup.py
12
backup.py
@@ -185,12 +185,20 @@ def sizeChanged(hostname, pathsToOptions, path):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
# check server #
|
# check server #
|
||||||
cmd = ["ssh", hostname, "-t", "/opt/check_dir_size_for_backup.py", path ]
|
cmd = [
|
||||||
|
"ssh", hostname,
|
||||||
|
"-o", "PasswordAuthentication=no",
|
||||||
|
"-o", "ConnectTimeout=3",
|
||||||
|
"-t", "/opt/check_dir_size_for_backup.py",
|
||||||
|
path
|
||||||
|
]
|
||||||
|
|
||||||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, encoding="utf-8")
|
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, encoding="utf-8")
|
||||||
stdout, stderr = p.communicate()
|
stdout, stderr = p.communicate()
|
||||||
if p.wait() != 0:
|
if p.wait() != 0:
|
||||||
raise OSError("ssh commmand for backup size info failed '{}' - '{}' Host: {}".format(
|
print("Warning: ssh commmand for backup size info failed '{}' - '{}' Host: {}".format(
|
||||||
stderr, stdout, hostname))
|
stderr, stdout, hostname))
|
||||||
|
return []
|
||||||
|
|
||||||
# parse response #
|
# parse response #
|
||||||
result = json.loads(stdout)
|
result = json.loads(stdout)
|
||||||
|
|||||||
Reference in New Issue
Block a user