[euca2ools] Backport support for bundle upload location constraints

gholms gholms at fedoraproject.org
Tue Jul 26 20:46:24 UTC 2011


commit 538015eebbb38e9afe889019e53c86c1fa7f99c3
Author: Garrett Holmstrom <gholms at fedoraproject.org>
Date:   Fri Jul 1 10:56:19 2011 -0700

    Backport support for bundle upload location constraints

 euca2ools-1.3.1-uploadloc.patch |   70 +++++++++++++++++++++++++++++++++++++++
 euca2ools.spec                  |    7 ++++
 2 files changed, 77 insertions(+), 0 deletions(-)
---
diff --git a/euca2ools-1.3.1-uploadloc.patch b/euca2ools-1.3.1-uploadloc.patch
new file mode 100644
index 0000000..687f83e
--- /dev/null
+++ b/euca2ools-1.3.1-uploadloc.patch
@@ -0,0 +1,70 @@
+Index: euca2ools-1.3/bin/euca-upload-bundle
+===================================================================
+--- euca2ools-1.3.orig/bin/euca-upload-bundle
++++ euca2ools-1.3/bin/euca-upload-bundle
+@@ -68,6 +68,9 @@ OPTIONAL PARAMETERS
+ 
+ --skipmanifest			Do not upload the manifest file.
+ 
++--location                      The location of the destination S3 bucket
++                                Valid values: US|EU|us-west-1|ap-southeast-1|ap-northeast-1
++
+ """
+ 
+ 
+@@ -87,17 +90,26 @@ def create_bucket(connection, bucket, ca
+     return connection.create_bucket(bucket, policy=canned_acl)
+ 
+ 
+-def ensure_bucket(connection, bucket, canned_acl=None):
++def ensure_bucket(connection, bucket, canned_acl=None, location=None):
+     bucket_instance = None
+     try:
+         print 'Checking bucket:', bucket
+         bucket_instance = connection.get_bucket(bucket)
++        if location:
++            if location != bucket_instance.get_location():
++                print 'Supplied location does not match bucket location'
++                sys.exit(1)
+     except S3ResponseError, s3error:
+         s3error_string = '%s' % s3error
+         if s3error_string.find('404') >= 0:
+             try:
+-                bucket_instance = create_bucket(connection, bucket,
+-                        canned_acl)
++                if location:
++                    bucket_instance = create_bucket(connection, bucket,
++                                                    canned_acl,
++                                                    location=location)
++                else:
++                    bucket_instance = create_bucket(connection, bucket,
++                                                    canned_acl)
+             except S3CreateError:
+                 print 'Unable to create bucket %s' % bucket
+                 sys.exit()
+@@ -200,6 +212,7 @@ def main():
+     canned_acl = 'aws-exec-read'
+     skipmanifest = False
+     debug = False
++    location = None
+ 
+     for (name, value) in euca.opts:
+         if name in ('-h', '--help'):
+@@ -222,6 +235,8 @@ def main():
+             skipmanifest = True
+         elif name == '--version':
+             version()
++        elif name == '--location':
++            location = value
+ 
+     if bucket and manifest_path:
+         try:
+@@ -236,7 +251,7 @@ def main():
+             print e.message
+             sys.exit(1)
+ 
+-        bucket_instance = ensure_bucket(conn, bucket, canned_acl)
++        bucket_instance = ensure_bucket(conn, bucket, canned_acl, location)
+         parts = get_parts(manifest_path)
+         if not directory:
+             manifest_path_parts = manifest_path.split('/')
diff --git a/euca2ools.spec b/euca2ools.spec
index 21e0484..7909c68 100644
--- a/euca2ools.spec
+++ b/euca2ools.spec
@@ -62,6 +62,9 @@ Patch23:        euca2ools-1.3.1-mkfsopt.patch
 Patch24:        euca2ools-1.3.1-emptyblock.patch
 # https://bugs.launchpad.net/euca2ools/+bug/795395
 Patch25:        euca2ools-1.3.1-imageattr-ptr.patch
+# https://bugs.launchpad.net/euca2ools/+bug/704658
+# Patch is based on upstream bzr rev 443
+Patch26:        euca2ools-1.3.1-uploadloc.patch
 
 Requires:       m2crypto
 Requires:       python-boto
@@ -112,6 +115,7 @@ Eucalyptus.  These tools are also compatible with Amazon AWS.
 %patch23 -p1
 %patch24 -p1
 %patch25 -p1
+%patch26 -p1
 
 
 %build
@@ -147,6 +151,9 @@ rm -rf %{buildroot}
 %doc README
 
 %changelog
+* Fri Jul  1 2011 Garrett Holmstrom <gholms at fedoraproject.org> - 1.3.1-11
+- Backported support for bundle upload location constraints [LP:704658]
+
 * Fri Jun 10 2011 Garrett Holmstrom <gholms at fedoraproject.org> - 1.3.1-11
 - Fixed handling of empty block device sizes
 - Fixed euca-describe-image-attribute -B output [LP:795395]


More information about the scm-commits mailing list