A mechanism to only clean source snapshots if send was successful.
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.
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.
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!
+1 to this idea.
+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?
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.