Skip to content

Commit

Permalink
implement --dryrun argument
Browse files Browse the repository at this point in the history
This is a little messy: that includes a *lot* of whitespace change,
but I couldn't really figure out a better way to do it, in general.

(A better way would have been something like:

    if ($args{'dryrun'}) return 0;

... but the functions are generally too long for that kind of hack to
work at all. Alternatively, I figured it might be good to have a
generic `system()` wrapper, but I haven't dug deep enough in the code
to see if it's always called the same way, or if that would make
sense.)

This doesn't block *all* `system()` calls either: only those who
actually make changes. SSH setup commands and commands that just probe
the snapshot lists are let through, so this is not completely a
`--noop` flag (hence the `--dryrun` instead), because it
actually *does* some things still.

I have only grepped for `system()` and haven't audited the entire
source code to see if other side effects (e.g. creating files) also
exist.

Disclaimer: this patch was briefly tested on my home system, and my
level of familiarity with sanoid is "beginner".

Closes: jimsalterjrs#11
  • Loading branch information
anarcat committed May 30, 2022
1 parent ef601eb commit bea1a58
Showing 1 changed file with 173 additions and 144 deletions.

0 comments on commit bea1a58

Please sign in to comment.