mirror of
https://github.com/FAUSheppy/athq-vm-management
synced 2025-12-06 13:51:35 +01:00
fix: checks for return codes
This commit is contained in:
13
backup.py
13
backup.py
@@ -146,15 +146,22 @@ def noHighData(hostname, pathsToOptions, path):
|
||||
|
||||
def sizeChanged(hostname, pathsToOptions, path):
|
||||
|
||||
# keep all generated paths #
|
||||
if "*" in path:
|
||||
return True
|
||||
|
||||
# if there are no options keep it #
|
||||
options = pathsToOptions[path]
|
||||
if not options:
|
||||
if not options or not "onlyifchanged" in options:
|
||||
return True
|
||||
|
||||
# check server #
|
||||
cmd = ["ssh", hostname, "-t", "/opt/check_dir_size_for_backup.py", path ]
|
||||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, encoding="utf-8")
|
||||
stdout, stderr = p.communicate()
|
||||
if p.wait() != 0:
|
||||
raise OSError("ssh commmand for backup size info failed '{}' - '{}'".format(stderr, stdout))
|
||||
|
||||
result = json.loads(p.stdout)
|
||||
return result.changed
|
||||
# parse response #
|
||||
result = json.loads(stdout)
|
||||
return result["changed"]
|
||||
|
||||
Reference in New Issue
Block a user