chr4-cookbooks / duplicity_ng

Chef cookbook to install duplicity and manage duplicity backup cronjobs
Other
3 stars 5 forks source link

duplicity: error: no such option: -z #33

Closed smet-dk closed 9 years ago

smet-dk commented 9 years ago

I created a cronjob exactly as described in the readme.

  # GPG options (compression and algorithms)
  cipher_algo    'aes256'
  digest_algo    'sha512'
  compress_algo  'bzip2'
  compress_level 6

The compress_level becomes -z6, and then calling the script (cronjob) and then duplicity breaks with the errorcode in subject. I think this might be an issue with escaping, but I can't seems to find out how to fix it. I just realized that the '-z' (and more) was committed just 7 days ago. Maybe it's quotation, maybe it's that '-z' doesn't get parsed right... Please tell me if you need more info...

$ duplicity_ng is git clone Version 1.2.1

$ uname -r 2.6.32-220.23.1.el6.x86_64

$ bash --version GNU bash, version 4.1.2(1)-release (x86_64-redhat-linux-gnu)

$ duplicity --version duplicity 0.6.22

$ gpg --version gpg (GnuPG) 2.0.14 libgcrypt 1.4.5

smet-dk commented 9 years ago

Hi again.

A possible fix could be the patch that I quote below (don't know how else to do it, sry). In my sitation, it seems to be bad quoting, that sends the GPGOPT directly to duplicity, instead of through to gpg...

patch -p1 < GPGOPT-z.patch

diff -rupN smet-dk/templates/default/cronjob.sh.erb duplicity_ng/templates/default/cronjob.sh.erb
--- smet-dk/templates/default/cronjob.sh.erb    2015-04-09 09:35:24.400661942 +0200
+++ duplicity_ng/templates/default/cronjob.sh.erb   2015-04-09 09:11:16.684977864 +0200
@@ -44,7 +44,7 @@ time nice -n <%= @nice %> ionice -c <%=
   --include <%= dir %> \
 <% end -%>
   --exclude '**' \
-  ${DUPLICITY_ARGUMENTS[@]} --gpg-options $GPGOPT >> <%= @logfile %> 2>&1
+  ${DUPLICITY_ARGUMENTS[@]} --gpg-options """$GPGOPT""" >> <%= @logfile %> 2>&1

 # Unset all passphrases
 unset PASSPHRASE
diff -rupN smet-dk/templates/default/environment.erb duplicity_ng/templates/default/environment.erb
--- smet-dk/templates/default/environment.erb   2015-04-09 09:35:24.400661942 +0200
+++ duplicity_ng/templates/default/environment.erb  2015-04-09 09:16:15.922733155 +0200
@@ -8,7 +8,7 @@
 export PASSPHRASE="<%= @passphrase %>"

 # Set GPG options (algorithms and compression)
-export GPGOPT="'--compress-algo=<%= @compress_algo %> -z=<%= @compress_level %> --cipher-algo=<%= @cipher_algo %> --digest-algo=<%= @digest_algo %>'"
+export GPGOPT="--compress-algo=<%= @compress_algo %> -z=<%= @compress_level %> --cipher-algo=<%= @cipher_algo %> --digest-algo=<%= @digest_algo %>"

 <% if @swift_username && @swift_password && @swift_authurl %>
 # Settings for Swift backend
chr4 commented 9 years ago

I had some issues with quoting the gpg arguments before, though my approach fixed it. Thanks for reporting, I'll check this next week and hopefully merge it (maybe alongside with moving GPG_OPTIONS alongside DUPLICITY_ARGUMENTS.

chr4 commented 9 years ago

I'm having the exact opposite problem. When using your patch, I get the error you're describing, when not using it it works :) - Investigating.

chr4 commented 9 years ago

Ok, both seem to work. Mmh, I'll accept this if it works for more people :)

chr4 commented 9 years ago

Released in v1.2.2. Thanks again!