pyznap icon indicating copy to clipboard operation
pyznap copied to clipboard

A mechanism to only clean source snapshots if send was successful.

Open doctorjames opened this issue 6 years ago • 5 comments

Firstly, thank you for writing and maintaining pyznap, it's a great tool.

pyznap appears to return 0 even if there was some sort of error sending snapshots, meaning:

pysnap send && pyznap snap --clean

won't do anything useful.

I'd like to avoid getting into the situation where some failure of the transfer process inadvertently leads to all the common source snapshots being cleaned (something I experienced previously with znapzend).

Might it be possible to make pyznap continue to attempt all operations, even if one fails, but then to return an error code if any operations failed? The error code could even be a count of how many operations failed.

This would obviously make manually sending an email on failure easier too, and any other sort of automation that might wrap calling pyznap in a script.

Cheers.

doctorjames avatar Nov 07 '19 13:11 doctorjames

Good point. My reasoning was that whenever there is no crash pyznap should just return 0. Though it would make sense to return a nonzero error code if there was some error during snap/send. I'll try to implement this at some point.

yboetz avatar Nov 10 '19 08:11 yboetz

Just found this wonderful tool.

Just want to say "thanks!" and toss my vote in for something like this. Would make it that much easier to use long term!

sparky8251 avatar Jan 28 '20 21:01 sparky8251

+1 to this idea.

rbrewer123 avatar Apr 14 '20 17:04 rbrewer123

+1 to this idea too. I was just about to create an issue asking why it returned 0 on failure.

I have never written python, but looks like send returns the error, but _main ignores it?

cfnz avatar Jun 25 '20 05:06 cfnz

I was a bit inconsistent with returncodes and how they are propagated from the different functions, I'll have to clean this up at some point.

yboetz avatar Jun 25 '20 06:06 yboetz