Duplicity Azure backend does not work
If You are using Azure Blob Storage as a backend for Duplicity or You are trying to test this solution, it's very possible that You encountered one of those Python errors with tracebacks like this:
self.WindowsAzureMissingResourceError = azure.WindowsAzureMissingResourceError\nAttributeError: 'module' object has no attribute 'WindowsAzureMissingResourceError'"
or
self.WindowsAzureMissingResourceError = azure.AzureMissingResourceHttpError\nAttributeError: 'module' object has no attribute 'AzureMissingResourceHttpError'"
Probably You encountered the first one. The second one is appearing after the first one is fixed...
What is going on?
It's because of Azure SDK for Python update. In SDK versions >1 (released 2015-08-31) some class names and modules has changed. All changes can be found in changelog on GitHub: https://github.com/Azure/azure-sdk-for-python/blob/master/ChangeLog.txt
The following were renamed and moved from 'azure' to 'azure.common':
WindowsAzureError -> AzureException and AzureHttpError
WindowsAzureConflictError -> AzureConflictHttpError
WindowsAzureMissingResourceError -> AzureMissingResourceHttpError
How to fix Duplicity?
Duplicity branch 0.7 has Azure Blob Storage as a backend option but today it is programmed to use old SDK for Python (v0.11). The old classes was used in /usr/lib/python2.7/dist-packages/duplicity/backends/azurebackend.py (the path depends on how You installed duplicity and on Your Linux Distribution - I have installed it via PPA on Ubuntu, so it's placed in python 2.7 dist-packages directory). If You want to fix it by hand, just edit azurebackend.py and change:
from azure.storage import BlobService
to
from azure.storage.blob import BlobService
in line 39,
self.WindowsAzureMissingResourceError = azure.WindowsAzureMissingResourceError
to
self.WindowsAzureMissingResourceError = azure.common.AzureMissingResourceHttpError
in line 52. And:
except azure.WindowsAzureConflictError
to
except azure.common.AzureConflictHttpError
in line 58.
Will duplicity change this in upstream?
Yes. I have contributed to the project and changed as described above. Duplicity in version 0.7.06 will be free from this bug. We are waiting for new build and release right now.
https://launchpad.net/duplicity/0.7-series
Hint: if You are looking for new (>0.0.05) version but don't want to make changes in code by Your hand, check duplicity daily ppa: https://launchpad.net/~duplicity-team/+archive/ubuntu/daily