[pkg-eucalyptus-commits] [euca2ools] 37/41: Add eustore-install-image --pad-name to opt into name randomization

Charles Plessy plessy at alioth.debian.org
Sat Oct 12 03:24:24 UTC 2013


This is an automated email from the git hooks/post-receive script.

plessy pushed a commit to branch master
in repository euca2ools.

commit dd5d4d83706df04d4cae983bd4a96663d9626bdc
Author: Garrett Holmstrom <gholms at fedoraproject.org>
Date:   Wed Sep 25 15:30:22 2013 -0700

    Add eustore-install-image --pad-name to opt into name randomization
    
    Commit aad208a began adding several random hex characters to image names
    to make them unique since EC2 specs require them to be unique.  Since
    that is backwards-incompatible, though, this commit makes that
    functionality optional -- use eustore-install-image's new --pad-name
    option to enable it.
---
 euca2ools/commands/eustore/installimage.py |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/euca2ools/commands/eustore/installimage.py b/euca2ools/commands/eustore/installimage.py
index 328901e..85a1744 100644
--- a/euca2ools/commands/eustore/installimage.py
+++ b/euca2ools/commands/eustore/installimage.py
@@ -75,6 +75,8 @@ class InstallImage(EuStoreRequest, FileTransferProgressBarMixin):
                 help='''location to place the image and other artifacts
                 (default:  dir named by TMPDIR, TEMP, or TMP environment
                 variables, or otherwise /var/tmp)'''),
+            Arg('--pad-name', action='store_true', help='''add some random
+                characters to the image's name to ensure it is unique'''),
             Arg('--kernel', help='''ID of the kernel image to use instead of
                 the one bundled with the image'''),
             Arg('--ramdisk', help='''ID of the ramdisk image to use instead of
@@ -277,8 +279,12 @@ class InstallImage(EuStoreRequest, FileTransferProgressBarMixin):
     def bundle_and_register_all(self, workdir, tarball_filename):
         if self.args['show_progress']:
             print 'Preparing to extract image...'
-        image_name = 'eustore-{0:0>8x}-{1}'.format(
-            random.randrange(16**8),
+        if self.args.get('pad_name', False):
+            image_name_pad = '{0:0>8x}-'.format(random.randrange(16**8))
+        else:
+            image_name_pad = ''
+        image_name = 'eustore-{0}{1}'.format(
+            image_name_pad,
             os.path.splitext(os.path.basename(tarball_filename))[0]
             .replace('.', '_'))
         tarball = tarfile.open(tarball_filename, 'r:gz')

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-eucalyptus/euca2ools.git



More information about the pkg-eucalyptus-commits mailing list