[Borgbackup] Some minor issues
Hans-Peter Jansen
hpj at urpla.net
Sat Jun 18 13:59:39 EDT 2016
Hi Marian, hi Thomas,
On Freitag, 17. Juni 2016 21:35:09 public at enkore.de wrote:
> On 06/17/2016 07:31 PM, Hans-Peter Jansen wrote:
> > The point is, if you run "borg create --stats" (without -v), it
>
> doesn't print
>
> > the stats, which is rather counter intuitive...
>
> Yeah, that'll be fixed in 1.1
>
> See current development log at
> https://github.com/borgbackup/borg/blob/master/docs/changes.rst
>
> > BORG_RELOCATED_REPO_ACCESS_IS_OK=yes
>
> This should only be needed once. Check if ~/.cache/borg/<repo i>/config
> contains the correct path (the one you use to access the repository in
> your scripts), and if that file has the correct permissions etc.
Here's a patch proposal:
--- a/src/borg/helpers.py
+++ b/src/borg/helpers.py
@@ -975,6 +975,25 @@ def yes(msg=None, false_msg=None, true_msg=None,
default_msg=None,
ofile = sys.stderr
if default not in (True, False):
raise ValueError("invalid default value, must be True or False")
+ # silent acceptance via environment:
+ # if a valid answer is given via environment
+ # and no env_msg is attached to this question
+ # print msg only, if a related {true,false}_msg is attached
+ # and return the related value
+ if env_var_override and not env_msg:
+ answer = os.environ.get(env_var_override)
+ if answer in truish:
+ if true_msg:
+ if msg:
+ print(msg, file=ofile)
+ print(true_msg, file=ofile)
+ return True
+ if answer in falsish:
+ if false_msg:
+ if msg:
+ print(msg, file=ofile)
+ print(false_msg, file=ofile)
+ return False
if msg:
print(msg, file=ofile, end='', flush=True)
while True:
Would something like that be acceptable?
Thanks,
Pete
-------------- next part --------------
A non-text attachment was scrubbed...
Name: borg_silent_envvar_acceptance.patch
Type: text/x-patch
Size: 1178 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/borgbackup/attachments/20160618/c0e67563/attachment.bin>
More information about the Borgbackup
mailing list