diff -Nru ec2-ami-tools-1.3-34544/debian/changelog ec2-ami-tools-1.3-45758/debian/changelog --- ec2-ami-tools-1.3-34544/debian/changelog 2009-12-15 20:00:40.000000000 +0000 +++ ec2-ami-tools-1.3-45758/debian/changelog 2009-12-15 20:00:40.000000000 +0000 @@ -1,3 +1,9 @@ +ec2-ami-tools (1.3-45758-0ubuntu1~karmic1) karmic; urgency=low + + * New upstream version. Supports us-west-1. + + -- Scott Moser Mon, 07 Dec 2009 13:51:18 -0500 + ec2-ami-tools (1.3-34544-0ubuntu3) karmic; urgency=low * Fix FTBFS. diff -Nru /tmp/ZakGo1DFiL/ec2-ami-tools-1.3-34544/debian/control /tmp/DmyVKh0DTC/ec2-ami-tools-1.3-45758/debian/control --- ec2-ami-tools-1.3-34544/debian/control 2009-12-15 20:00:40.000000000 +0000 +++ ec2-ami-tools-1.3-45758/debian/control 2009-12-15 20:00:40.000000000 +0000 @@ -6,7 +6,7 @@ Standards-Version: 3.7.3 Package: ec2-ami-tools -Architecture: amd64 i386 +Architecture: all Depends: ${misc:Depends}, ruby, libopenssl-ruby, curl Description: Amazon EC2 AMI tools The Amazon EC2 AMI Tools are command-line utilities to help bundle an diff -Nru /tmp/ZakGo1DFiL/ec2-ami-tools-1.3-34544/lib/ec2/amitools/manifestv20071010.rb /tmp/DmyVKh0DTC/ec2-ami-tools-1.3-45758/lib/ec2/amitools/manifestv20071010.rb --- ec2-ami-tools-1.3-34544/lib/ec2/amitools/manifestv20071010.rb 2009-04-15 10:13:56.000000000 +0100 +++ ec2-ami-tools-1.3-45758/lib/ec2/amitools/manifestv20071010.rb 2009-12-02 23:06:56.000000000 +0000 @@ -375,7 +375,7 @@ end def image_type() - return get_element_text('image/type') + return get_element_text('image/type') end def version() diff -Nru /tmp/ZakGo1DFiL/ec2-ami-tools-1.3-34544/lib/ec2/amitools/mapids.rb /tmp/DmyVKh0DTC/ec2-ami-tools-1.3-45758/lib/ec2/amitools/mapids.rb --- ec2-ami-tools-1.3-34544/lib/ec2/amitools/mapids.rb 2009-04-15 08:43:02.000000000 +0100 +++ ec2-ami-tools-1.3-45758/lib/ec2/amitools/mapids.rb 2009-12-02 21:28:44.000000000 +0000 @@ -26,6 +26,20 @@ #----------------------------------------------------------------------------# + def add_endpoint_from_env(endpoints) + str = ENV['AMITOOLS_EC2_REGION_ENDPOINT'] + if not str + return + end + + components = str.split('@').collect{|s| s.strip()} + if components.size != 2 + return + end + + endpoints[components[0]] = components[1] + end + def get_endpoints(akid, secretkey, endpoint=nil) endpoint ||= ENDPOINT endpoints = {} @@ -37,6 +51,7 @@ region_url = 'https://'+region_url unless region_url =~ %r{^https?://} endpoints[region_name] = region_url end + add_endpoint_from_env(endpoints) endpoints end diff -Nru /tmp/ZakGo1DFiL/ec2-ami-tools-1.3-34544/lib/ec2/amitools/migratebundleparameters.rb /tmp/DmyVKh0DTC/ec2-ami-tools-1.3-45758/lib/ec2/amitools/migratebundleparameters.rb --- ec2-ami-tools-1.3-34544/lib/ec2/amitools/migratebundleparameters.rb 2009-04-15 08:43:02.000000000 +0100 +++ ec2-ami-tools-1.3-45758/lib/ec2/amitools/migratebundleparameters.rb 2009-12-02 21:28:44.000000000 +0000 @@ -33,7 +33,7 @@ "Defaults to \"aws-exec-read\"."] URL_DESCRIPTION = "The S3 service URL. Defaults to https://s3.amazonaws.com." RETRY_DESCRIPTION = "Automatically retry failed uploads. Use with caution." - LOCATION_DESCRIPTION = "The location of the bucket to upload to [EU,US]." + LOCATION_DESCRIPTION = "The location of the bucket to upload to [EU,US,us-west-1]." NO_MAPPING_DESCRIPTION = "Do not perform automatic mappings." REGION_DESCRIPTION = "Region to look up in the mapping file." @@ -114,12 +114,13 @@ on('--url URL', String, URL_DESCRIPTION) do |url| @s3_url = url end - + on('--retry', RETRY_DESCRIPTION) do @retry = true end on('--location LOCATION', LOCATION_DESCRIPTION) do |location| + assert_option_in(location, ['EU', 'US', 'us-west-1'], '--location') @location = location @location = :unconstrained if @location == "US" end diff -Nru /tmp/ZakGo1DFiL/ec2-ami-tools-1.3-34544/lib/ec2/amitools/migratebundle.rb /tmp/DmyVKh0DTC/ec2-ami-tools-1.3-45758/lib/ec2/amitools/migratebundle.rb --- ec2-ami-tools-1.3-34544/lib/ec2/amitools/migratebundle.rb 2009-04-15 08:43:02.000000000 +0100 +++ ec2-ami-tools-1.3-45758/lib/ec2/amitools/migratebundle.rb 2009-12-02 21:28:44.000000000 +0000 @@ -131,7 +131,7 @@ retry_stuff=nil, use_mapping=true, region=nil) - + src_s3_conn = make_s3_connection(s3_url, user, pass, bucket) dest_s3_conn = make_s3_connection(s3_url, user, pass, dest_bucket) @@ -145,6 +145,7 @@ if region.nil? location ||= bucket_location region = "us-east-1" + region = "us-west-1" if location == "us-west-1" region = "eu-west-1" if location == "EU" puts "Region not provided, guessing from S3 location: #{region}" end diff -Nru /tmp/ZakGo1DFiL/ec2-ami-tools-1.3-34544/lib/ec2/amitools/tool_base.rb /tmp/DmyVKh0DTC/ec2-ami-tools-1.3-45758/lib/ec2/amitools/tool_base.rb --- ec2-ami-tools-1.3-34544/lib/ec2/amitools/tool_base.rb 2009-04-15 08:43:02.000000000 +0100 +++ ec2-ami-tools-1.3-45758/lib/ec2/amitools/tool_base.rb 2009-12-02 21:28:44.000000000 +0000 @@ -209,8 +209,9 @@ $stderr.puts "ERROR: #{e.message}" puts e.backtrace if @debug exit e.code - rescue Interrupt + rescue Interrupt => e $stderr.puts "\n#{get_name} interrupted." + puts e.backtrace if @debug exit 255 rescue => e $stderr.puts "ERROR: #{e.message}" diff -Nru /tmp/ZakGo1DFiL/ec2-ami-tools-1.3-34544/lib/ec2/amitools/uploadbundleparameters.rb /tmp/DmyVKh0DTC/ec2-ami-tools-1.3-45758/lib/ec2/amitools/uploadbundleparameters.rb --- ec2-ami-tools-1.3-34544/lib/ec2/amitools/uploadbundleparameters.rb 2009-04-15 08:43:02.000000000 +0100 +++ ec2-ami-tools-1.3-45758/lib/ec2/amitools/uploadbundleparameters.rb 2009-12-02 21:28:44.000000000 +0000 @@ -22,7 +22,7 @@ PART_DESCRIPTION = "Upload the specified part and upload all subsequent parts." RETRY_DESCRIPTION = "Automatically retry failed uploads." SKIP_MANIFEST_DESCRIPTION = "Do not upload the manifest." - LOCATION_DESCRIPTION = "The location of the bucket to upload to [EU,US]." + LOCATION_DESCRIPTION = "The location of the bucket to upload to [EU,US,us-west-1]." attr_accessor :manifest, :acl, @@ -71,6 +71,7 @@ end on('--location LOCATION', LOCATION_DESCRIPTION) do |location| + assert_option_in(location, ['EU', 'US', 'us-west-1'], '--location') @location = location @location = :unconstrained if @location == "US" end diff -Nru /tmp/ZakGo1DFiL/ec2-ami-tools-1.3-34544/lib/ec2/amitools/uploadbundle.rb /tmp/DmyVKh0DTC/ec2-ami-tools-1.3-45758/lib/ec2/amitools/uploadbundle.rb --- ec2-ami-tools-1.3-34544/lib/ec2/amitools/uploadbundle.rb 2009-04-15 08:43:02.000000000 +0100 +++ ec2-ami-tools-1.3-45758/lib/ec2/amitools/uploadbundle.rb 2009-12-02 21:28:44.000000000 +0000 @@ -186,38 +186,44 @@ #------------------------------------------------------------------------------# - # Horrible hack. :-( + S3_LOCATION_CONSTRAINTS = { + 'us-east-1' => :unconstrained, + 'eu-west-1' => 'EU', + 'us-west-1' => 'us-west-1' + } + + def get_region() + zone = get_availability_zone() + if zone.nil? + return nil + end + # assume region names do not have a common naming scheme. Therefore we manually go through all known region names + ['us-east-1', 'eu-west-1', 'us-west-1'].each do |region| + match = zone.match(region) + if not match.nil? + return region + end + end + nil + end + # This is very much a best effort attempt. If in doubt, we don't warn. def cross_region?(location, bucket_location) + # If the bucket exists, its S3 location is canonical. s3_region = bucket_location - # Otherwise, get the location specified s3_region ||= location - # Here, nil means the bucket does not exist and no location was specified. - # Thus, the new bucket will be in the unconstrained location: s3_region ||= :unconstrained - - az = get_availability_zone() - if az.nil? - # If we can't get the availability zone, assume we're fine since there's + + region = get_region() + + if region.nil? + # If we can't get the region, assume we're fine since there's # nothing more we can do. return false end - # This check assumes the first part of the availability zone name matches the - # appropriate S3 location name. Special case 'us-...' and no location. - match = /^([^-]*)-/.match(az) - if match.nil? - # No idea where we are. Assume happiness. - return false - end - # Case doesn't matter here. - az_region = match[1].downcase - # Special case for S3 empty location: - if s3_region == :unconstrained - return az_region != "us" - end - # We should only have text regions now, so this is safe. - return az_region != s3_region.downcase + + return s3_region != S3_LOCATION_CONSTRAINTS[region] end #------------------------------------------------------------------------------# @@ -271,11 +277,11 @@ xml = File.open(manifest_file) { |f| f.read } manifest = ManifestV20071010.new(xml) - # If we are uploading cross-region and have a kernel bundled in our AMI, warn. - if cross_region?(location, bucket_location) and manifest.kernel_id + # If in interactive mode, warn when bundling a kernel into our AMI and we are uploading cross-region + if interactive? and manifest.kernel_id and cross_region?(location, bucket_location) warn_about_migrating() end - + # Create storage bucket if required. create_bucket(s3_conn, bucket, bucket_location, location, retry_stuff) diff -Nru /tmp/ZakGo1DFiL/ec2-ami-tools-1.3-34544/lib/ec2/amitools/version.rb /tmp/DmyVKh0DTC/ec2-ami-tools-1.3-45758/lib/ec2/amitools/version.rb --- ec2-ami-tools-1.3-34544/lib/ec2/amitools/version.rb 2009-04-15 10:13:56.000000000 +0100 +++ ec2-ami-tools-1.3-45758/lib/ec2/amitools/version.rb 2009-12-02 23:06:56.000000000 +0000 @@ -15,7 +15,7 @@ MANIFEST_VERSION = MANIFEST_CLASS.version PKG_NAME = 'ec2-ami-tools' PKG_VERSION = '1.3' - PKG_RELEASE = '34544' + PKG_RELEASE = '45758' COPYRIGHT_NOTICE = <