ec2-bundle-image gives error 'can't convert Fixnum into String' with ruby 1.9

Bug #1088540 reported by Scott Moser on 2012-12-10
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
ec2-ami-tools (Ubuntu)
Medium
Unassigned

Bug Description

$ ec2-bundle-image --cert cert.pem --privatekey pk.pem --user 123456789012 --image my.img --arch i386 --debug
Bundling image file...
ERROR: can't convert Fixnum into String
#<TypeError: can't convert Fixnum into String>
/usr/lib/ec2-ami-tools/lib/ec2/amitools/util.rb:19:in `+'
/usr/lib/ec2-ami-tools/lib/ec2/amitools/util.rb:19:in `block in gen_ident'
/usr/lib/ec2-ami-tools/lib/ec2/amitools/util.rb:19:in `each'
/usr/lib/ec2-ami-tools/lib/ec2/amitools/util.rb:19:in `inject'
/usr/lib/ec2-ami-tools/lib/ec2/amitools/util.rb:19:in `gen_ident'
/usr/lib/ec2-ami-tools/lib/ec2/amitools/fileutil.rb:227:in `block in tempfifo'
/usr/lib/ec2-ami-tools/lib/ec2/amitools/fileutil.rb:226:in `each'
/usr/lib/ec2-ami-tools/lib/ec2/amitools/fileutil.rb:226:in `tempfifo'
/usr/lib/ec2-ami-tools/lib/ec2/amitools/bundle.rb:48:in `bundle_image'
/usr/lib/ec2-ami-tools/lib/ec2/amitools/bundleimage.rb:56:in `bundle_image'
/usr/lib/ec2-ami-tools/lib/ec2/amitools/bundleimage.rb:85:in `main'
/usr/lib/ec2-ami-tools/lib/ec2/amitools/tool_base.rb:201:in `run'
/usr/lib/ec2-ami-tools/lib/ec2/amitools/bundleimage.rb:93:in `<main>'

I found this when trying with real cert.pem and pk.pem and user, but the error occurs before those things are actually tested, so you can do:

mkdir foo; cd foo
img=my.img; cert=cert.pem; pk=pk.pem; user=123456789012
truncate --size 1M $img
mke2fs -F $img
touch $cert $pk
ec2-bundle-image --cert $cert --privatekey $pk --user $user --image $img --arch i386 --debug

ProblemType: Bug
DistroRelease: Ubuntu 12.10
Package: ec2-ami-tools 1.4.0.2-0ubuntu1
ProcVersionSignature: Ubuntu 3.5.0-19.30-generic 3.5.7
Uname: Linux 3.5.0-19-generic x86_64
ApportVersion: 2.6.1-0ubuntu6
Architecture: amd64
Date: Mon Dec 10 11:07:25 2012
EcryptfsInUse: Yes
InstallationDate: Installed on 2011-10-19 (418 days ago)
InstallationMedia: Ubuntu 11.10 "Oneiric Ocelot" - Release amd64 (20111012)
MarkForUpload: True
PackageArchitecture: all
ProcEnviron:
 TERM=xterm
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: ec2-ami-tools
UpgradeStatus: Upgraded to quantal on 2011-11-07 (399 days ago)

Revision history for this message
Scott Moser (smoser) wrote :
Revision history for this message
Scott Moser (smoser) wrote :

This seems to be a change from ruby 1.8 to 1.9, that caused 'gen_ident' to be valid.
basically, before it had:
##
# generate a unique identifier used for filenames
#
def gen_ident()
  (0..19).inject("") {|ident, n| ident+(?A + Kernel.rand(26)).chr}
end

That needs updating to:
   (0..19).inject("") {|ident, n| ident+(?A.ord + Kernel.rand(26)).chr}

Changed in ec2-ami-tools (Ubuntu):
importance: Undecided → Medium
status: New → Triaged
Scott Moser (smoser) on 2012-12-10
summary: - ec2-bundle-image gives error 'can't convert Fixnum into String'
+ ec2-bundle-image gives error 'can't convert Fixnum into String' with
+ ruby 1.9
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ec2-ami-tools - 1.4.0.9-0ubuntu1

---------------
ec2-ami-tools (1.4.0.9-0ubuntu1) raring; urgency=low

  * New upstream release 1.4.0.9 (2012-11-12)
    * add knowledge of 'ap-southeast-2'
    * add flag '--delegation-token' to tools, to allow use of the iam
      credentials inside an ec2 instance.
  * New upstream release 1.4.0.7 (2012-03-26)
    * centralize the list of regions and locations ec2/amitools/region.rb
    * add govcloud support, with
      * public certificate to /ec2/amitools/cert-ec2-gov.pem
      * knowledge of us-gov-west-1 region
    * use pid in fifo name, which improves upstream for the same code
      path that use-mktemp-like-mkfifo-name.patch affects. But the
      patch here still does a better job.
    * debian/patches/remove-explicit-regions.patch:
      rework to build upon existing functionality in upstream code.
      upstream consolidated the lists to a single place.
  * New upstream release 1.4.0.5 (2011-12-14)
    * image bundle is now created with '--user 0' and '--group 0'.
      This just avoids the local username getting into the tarball.
    * ec2-bundle-vol: add --filter flag, with description
      'Do not use the default filtered files list.'
    * add knowledge of regions us-west-2 and sa-east-1
  * debian/patches/use-mktemp-like-mkfifo-name.patch
    update to work with ruby 1.9 (LP: #1088540)
  * add debian/watch and update debian/rules to support uscan.
  * debian/patches/ruby-1.9-cleanup.patch
    fix some errors when running with ruby 1.9
 -- Scott Moser <email address hidden> Mon, 10 Dec 2012 18:46:35 -0500

Changed in ec2-ami-tools (Ubuntu):
status: Triaged → Fix Released
Revision history for this message
Mike McClurg (mike-mcclurg) wrote :

I'm having this problem on quantal as well, and had to install the raring version of ec2-ami-tools. Any chance for a backport to quantal?

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers