Skip to content

Commit

Permalink
Fix compatibility with Snapraid 8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Chronial committed Apr 27, 2015
1 parent 716d30b commit f6a2589
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions snapraid-runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def tee_thread():
return t


def snapraid_command(command, args={}):
def snapraid_command(command, args={}, ignore_errors=False):
"""
Run snapraid command
Raises subprocess.CalledProcessError if errorlevel != 0
Expand All @@ -58,7 +58,7 @@ def snapraid_command(command, args={}):
ret = p.wait()
# sleep for a while to make pervent output mixup
time.sleep(0.3)
if ret == 0:
if ret == 0 or ignore_errors:
return out
else:
raise subprocess.CalledProcessError(ret, "snapraid " + command)
Expand Down Expand Up @@ -228,11 +228,7 @@ def run():
finish(False)

logging.info("Running diff...")
try:
diff_out = snapraid_command("diff")
except subprocess.CalledProcessError as e:
logging.error(e)
finish(False)
diff_out = snapraid_command("diff", ignore_errors=True)
logging.info("*" * 60)

diff_results = Counter(line.split(" ")[0] for line in diff_out)
Expand Down

0 comments on commit f6a2589

Please sign in to comment.