← Back to team overview

duplicity-team team mailing list archive

[Merge] lp:~noizyland/duplicity/fix_azurebackend_container_names into lp:duplicity

 

Scott McKenzie has proposed merging lp:~noizyland/duplicity/fix_azurebackend_container_names into lp:duplicity.

Requested reviews:
  duplicity-team (duplicity-team)

For more details, see:
https://code.launchpad.net/~noizyland/duplicity/fix_azurebackend_container_names/+merge/246400

Azure Backend examples have underscores in the container names.  These are not valid Azure container names.  The underscores have been replaced with hypens and a note about valid container names added to the man page.

Also corrects a problem where Azure Exceptions were returing unicode strings that were not being handled correctly.

-- 
Your team duplicity-team is requested to review the proposed merge of lp:~noizyland/duplicity/fix_azurebackend_container_names into lp:duplicity.
=== modified file 'bin/duplicity.1'
--- bin/duplicity.1	2015-01-10 19:38:59 +0000
+++ bin/duplicity.1	2015-01-14 10:06:16 +0000
@@ -1105,7 +1105,7 @@
 .BR "Azure"
 .PP
 .RS
-azure://container_name
+azure://container-name
 .PP
 See also
 .B "A NOTE ON AZURE ACCESS"
@@ -1586,6 +1586,26 @@
 .BR AZURE_ACCOUNT_NAME " (required),"
 .BR AZURE_ACCOUNT_KEY " (required)"
 
+A container name must be a valid DNS name, conforming to the following naming
+rules:
+
+.RS
+.IP 1.
+Container names must start with a letter or number, and can contain only
+letters, numbers, and the dash (-) character.
+.IR
+.IP 2.
+Every dash (-) character must be immediately preceded and followed by a letter
+or number; consecutive dashes are not permitted in container names.
+.IR
+.IP 3.
+All letters in a container name must be lowercase.
+.IR
+.IP 4.
+Container names must be from 3 through 63 characters long.
+.IR
+.RE
+
 .SH A NOTE ON CLOUD FILES ACCESS
 Pyrax is Rackspace's next-generation Cloud management API, including
 Cloud Files access.  The cfpyrax backend requires the pyrax library to

=== modified file 'duplicity/backends/azurebackend.py'
--- duplicity/backends/azurebackend.py	2015-01-10 22:31:16 +0000
+++ duplicity/backends/azurebackend.py	2015-01-14 10:06:16 +0000
@@ -51,15 +51,16 @@
         account_key = os.environ['AZURE_ACCOUNT_KEY']
         self.WindowsAzureMissingResourceError = azure.WindowsAzureMissingResourceError
         self.blob_service = BlobService(account_name=account_name, account_key=account_key)
+        # TODO: validate container name
         self.container = parsed_url.path.lstrip('/')
         try:
             self.blob_service.create_container(self.container, fail_on_exist=True)
         except azure.WindowsAzureConflictError:
-            # Indicates that the resource could not be created because it already exists
+            # Indicates that the resource could not be created because it already exists.
             pass
         except Exception as e:
-            log.FatalError("Could not create Azure container: %s %s"
-                           % (e.__class__.__name__, str(e)),
+            log.FatalError("Could not create Azure container: %s"
+                           % unicode(e.message).split('\n', 1)[0],
                            log.ErrorCode.connection_failed)
 
     def _put(self, source_path, remote_filename):

=== modified file 'duplicity/commandline.py'
--- duplicity/commandline.py	2015-01-10 19:38:59 +0000
+++ duplicity/commandline.py	2015-01-14 10:06:16 +0000
@@ -860,7 +860,7 @@
   copy://%(user)s[:%(password)s]@%(other_host)s/%(some_dir)s
   dpbx:///%(some_dir)s
   onedrive://%(some_dir)s
-  azure://%(container_name)s
+  azure://%(container-name)s
 
 """ % dict
 


Follow ups