don't mask backend errors

Bug #1668750 reported by Douglas J Hunley
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Duplicity
Fix Released
Medium
Unassigned

Bug Description

When duplicity's backend throws an error (for example, PyDrive can't find a required module) it is currently masked and a generic error is emitted like so:
PyDrive backend requires PyDrive installation. Please read the manpage to fix.

Instead, the actual Python error should come back to the user so they can actually see what happened. As suggest on the mailing list:
try replacing /usr/local/Cellar/duplicity/0.7.11/libexec/lib/python2.7/site-packages/duplicity/backends/pydrivebackend.py", line 39-40, in __init__

OLD:

except ImportError:
            raise BackendException('PyDrive backend requires PyDrive installation'
                                   'Please read the manpage to fix.')
NEW:

except ImportError as error:
            raise error

worked to actually show me the error in question and I had my problem solved in minutes

doug@ReturnOfTheMac ~ » brew info duplicity
duplicity: stable 0.7.11 (bottled)
Bandwidth-efficient encrypted backup
http://www.nongnu.org/duplicity/
/usr/local/Cellar/duplicity/0.7.11 (5,009 files, 63MB) *
  Poured from bottle on 2017-02-27 at 15:25:55
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/duplicity.rb
==> Dependencies
Required: librsync ✔, openssl@1.1 ✔
Optional: par2 ✘
==> Requirements
Required: gpg2 ✔
==> Options
--with-par2
 Build with par2 support
doug@ReturnOfTheMac ~ » python -V
Python 2.7.13

OSX Sierra

The error I was seeing prior to the above edit:
doug@ReturnOfTheMac ~ » duply googledrive backup --force --asynchronous-upload --full-if-older-than 1W
Start duply v2.0.1, time is 2017-02-28 07:54:37.
Using profile '/Users/doug/.duply/googledrive'.
Using installed duplicity version 0.7.11, python 2.7.13, gpg 2.0.30 (Home: ~/.gnupg), awk 'awk version 20070501', grep 'grep (BSD grep) 2.5.1-FreeBSD', bash '3.2.57(1)-release (x86_64-apple-darwin16)'.
Checking TEMP_DIR '/Users/doug/.cache/tmp' is a folder and writable (OK)
Test - En/Decryption skipped. (GPG disabled)

--- Start running command PRE at 07:54:44.388 ---
Running '/Users/doug/.duply/googledrive/pre' - OK
--- Finished state OK at 07:54:44.506 - Runtime 00:00:00.118 ---

--- Start running command BKP at 07:54:44.552 ---
Using archive dir: /Users/doug/.cache/duplicity/duply_googledrive
Using backup name: duply_googledrive
Import of duplicity.backends.acdclibackend Succeeded
Import of duplicity.backends.azurebackend Succeeded
Import of duplicity.backends.b2backend Succeeded
Import of duplicity.backends.botobackend Succeeded
Import of duplicity.backends.cfbackend Succeeded
Import of duplicity.backends.copycombackend Succeeded
Import of duplicity.backends.dpbxbackend Succeeded
Import of duplicity.backends.gdocsbackend Succeeded
Import of duplicity.backends.giobackend Succeeded
Import of duplicity.backends.hsibackend Succeeded
Import of duplicity.backends.hubicbackend Succeeded
Import of duplicity.backends.imapbackend Succeeded
Import of duplicity.backends.lftpbackend Succeeded
Import of duplicity.backends.localbackend Succeeded
Import of duplicity.backends.mediafirebackend Succeeded
Import of duplicity.backends.megabackend Succeeded
Import of duplicity.backends.multibackend Succeeded
Import of duplicity.backends.ncftpbackend Succeeded
Import of duplicity.backends.onedrivebackend Succeeded
Import of duplicity.backends.par2backend Succeeded
Import of duplicity.backends.pydrivebackend Succeeded
Import of duplicity.backends.rsyncbackend Succeeded
Import of duplicity.backends.ssh_paramiko_backend Succeeded
Import of duplicity.backends.ssh_pexpect_backend Succeeded
Import of duplicity.backends.swiftbackend Succeeded
Import of duplicity.backends.sxbackend Succeeded
Import of duplicity.backends.tahoebackend Succeeded
Import of duplicity.backends.webdavbackend Succeeded
Using temporary directory /Users/doug/.cache/tmp/duplicity-kRJfEB-tempdir
Backend error detail: Traceback (most recent call last):
  File "/usr/local/bin/duplicity", line 1546, in <module>
    with_tempdir(main)
  File "/usr/local/bin/duplicity", line 1540, in with_tempdir
    fn()
  File "/usr/local/bin/duplicity", line 1375, in main
    action = commandline.ProcessCommandLine(sys.argv[1:])
  File "/usr/local/Cellar/duplicity/0.7.11/libexec/lib/python2.7/site-packages/duplicity/commandline.py", line 1126, in ProcessCommandLine
    backup, local_pathname = set_backend(args[0], args[1])
  File "/usr/local/Cellar/duplicity/0.7.11/libexec/lib/python2.7/site-packages/duplicity/commandline.py", line 1015, in set_backend
    globals.backend = backend.get_backend(bend)
  File "/usr/local/Cellar/duplicity/0.7.11/libexec/lib/python2.7/site-packages/duplicity/backend.py", line 223, in get_backend
    obj = get_backend_object(url_string)
  File "/usr/local/Cellar/duplicity/0.7.11/libexec/lib/python2.7/site-packages/duplicity/backend.py", line 209, in get_backend_object
    return factory(pu)
  File "/usr/local/Cellar/duplicity/0.7.11/libexec/lib/python2.7/site-packages/duplicity/backends/pydrivebackend.py", line 40, in __init__
    raise BackendException('PyDrive backend requires PyDrive installation'
BackendException: PyDrive backend requires PyDrive installationPlease read the manpage to fix.

BackendException: PyDrive backend requires PyDrive installationPlease read the manpage to fix.
07:54:52.288 Task 'BKP' failed with exit code '23'.
--- Finished state FAILED 'code 23' at 07:54:52.288 - Runtime 00:00:07.735 ---

--- Start running command POST at 07:54:52.347 ---
Running '/Users/doug/.duply/googledrive/post' - OK
--- Finished state OK at 07:54:52.445 - Runtime 00:00:00.097 ---

Changed in duplicity:
assignee: nobody → Kenneth Loafman (kenneth-loafman)
importance: Undecided → Medium
milestone: none → 0.7.12
status: New → In Progress
Changed in duplicity:
assignee: Kenneth Loafman (kenneth-loafman) → nobody
status: In Progress → Fix Committed
Changed in duplicity:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.