Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions duplicity/backends/azurebackend.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,26 @@ def __init__(self, parsed_url):

# TODO: validate container name
self.container = parsed_url.path.lstrip('/')

if globals.azure_region == 'global':
suffix = "core.windows.net"
elif globals.azure_region == 'germany':
suffix = "core.cloudapi.de"
elif globals.azure_region == 'china':
suffix = "core.chinacloudapi.cn"

if 'AZURE_ACCOUNT_NAME' not in os.environ:
raise BackendException('AZURE_ACCOUNT_NAME environment variable not set.')

if 'AZURE_ACCOUNT_KEY' in os.environ:
self.blob_service = BlobService(account_name=os.environ['AZURE_ACCOUNT_NAME'],
account_key=os.environ['AZURE_ACCOUNT_KEY'])
account_key=os.environ['AZURE_ACCOUNT_KEY'],
endpoint_suffix=suffix)
self._create_container()
elif 'AZURE_SHARED_ACCESS_SIGNATURE' in os.environ:
self.blob_service = BlobService(account_name=os.environ['AZURE_ACCOUNT_NAME'],
sas_token=os.environ['AZURE_SHARED_ACCESS_SIGNATURE'])
sas_token=os.environ['AZURE_SHARED_ACCESS_SIGNATURE'],
endpoint_suffix=suffix)
else:
raise BackendException(
'Neither AZURE_ACCOUNT_KEY nor AZURE_SHARED_ACCESS_SIGNATURE environment variable not set.')
Expand Down
3 changes: 3 additions & 0 deletions duplicity/commandline.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,9 @@ def add_rename(o, s, v, p):
# The number for the maximum parallel connections to use when the blob size exceeds 64MB.
# max_connections (int) - Maximum number of parallel connections to use when the blob size exceeds 64MB.
parser.add_option("--azure-max-connections", type="int", metavar=_("number"))

# The used Azure region, for Azure Germany and Azure China they used different storage endpoints
parser.add_option("--azure-region", metavar=_("global|germany|china"))

# scp command to use (ssh pexpect backend)
parser.add_option("--scp-command", metavar=_("command"))
Expand Down
3 changes: 3 additions & 0 deletions duplicity/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,9 @@
# Maximum number of parallel connections to use when the blob size for azure exceeds 64MB
azure_max_connections = None

# The Azure Region
azure_region = "global"

# Whether to use the full email address as the user name when
# logging into an imap server. If false just the user name
# part of the email address is used.
Expand Down