← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~gary/launchpad/bug660628 into lp:launchpad/devel

 

Gary Poster has proposed merging lp:~gary/launchpad/bug660628 into lp:launchpad/devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #660628 ec2 update-image breaks on Lucid by default
  https://bugs.launchpad.net/bugs/660628


As described in bug 660628, ec2 update-image couldn't find the necessary ec2 commands anymore to bundle an image on the instance, because of the change described in http://groups.google.com/group/ec2ubuntu/browse_thread/thread/dd7317f157eed834 .  This branch takes the easier change described in that thread.  We'll switch to the eucalyptus-based stuff soon, as part of bug 660631.

I also added a quick hint to people if they do not have ec2-register on their local system, to hopefully save them a bit of the time I spent.

I did not add tests of these changes.  

- The changes in regards to the installation of the ec2 packages on the remote machine did not seem to be conducive to valuable tests to me.  

- I could more easily be convinced of making a test of the local ec2-register test, but again, it did not seem valuable to me.  IMO test time would be better spent on testing the bigger picture, and I don't think working on that until I also tackle bug 660631 (switch to eucalyptus).  I intend to tackle that next.
-- 
https://code.launchpad.net/~gary/launchpad/bug660628/+merge/38467
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~gary/launchpad/bug660628 into lp:launchpad/devel.
=== modified file 'lib/devscripts/ec2test/instance.py'
--- lib/devscripts/ec2test/instance.py	2010-05-07 21:10:36 +0000
+++ lib/devscripts/ec2test/instance.py	2010-10-14 21:51:05 +0000
@@ -62,6 +62,9 @@
 # Commands to run to turn a blank image into one usable for the rest of the
 # ec2 functionality.  They come in two parts, one set that need to be run as
 # root and another that should be run as the 'ec2test' user.
+# Note that the sources from http://us.ec2.archive.ubuntu.com/ubuntu/ are per
+# instructions described in http://is.gd/g1MIT .  When we switch to
+# Eucalyptus, we can dump this.
 
 from_scratch_root = """
 # From 'help set':
@@ -77,6 +80,8 @@
 deb http://ppa.launchpad.net/launchpad/ubuntu $DISTRIB_CODENAME main
 deb http://ppa.launchpad.net/bzr/ubuntu $DISTRIB_CODENAME main
 deb http://ppa.launchpad.net/bzr-beta-ppa/ubuntu $DISTRIB_CODENAME main
+deb http://us.ec2.archive.ubuntu.com/ubuntu/ $DISTRIB_CODENAME multiverse
+deb-src http://us.ec2.archive.ubuntu.com/ubuntu/ $DISTRIB_CODENAME main
 EOF
 
 # This next part is cribbed from rocketfuel-setup
@@ -495,6 +500,10 @@
     def check_bundling_prerequisites(self):
         """Check, as best we can, that all the files we need to bundle exist.
         """
+        if subprocess.call(['which', 'ec2-register']):
+            raise BzrCommandError(
+                '`ec2-register` command not found.  '
+                'Try `sudo apt-get install ec2-api-tools`.')
         local_ec2_dir = os.path.expanduser('~/.ec2')
         if not os.path.exists(local_ec2_dir):
             raise BzrCommandError(
@@ -517,6 +526,11 @@
         :param credentials: An `EC2Credentials` object.
         """
         connection = self.connect()
+        # See http://is.gd/g1MIT .  When we switch to Eucalyptus, we can dump
+        # this installation of the ec2-ami-tools.
+        connection.perform(
+            'sudo env DEBIAN_FRONTEND=noninteractive '
+            'apt-get -y  install ec2-ami-tools')
         connection.perform('rm -f .ssh/authorized_keys')
         connection.perform('sudo mkdir /mnt/ec2')
         connection.perform('sudo chown $USER:$USER /mnt/ec2')


Follow ups