Uploaded image for project: 'BoxGrinder Build'
  1. BoxGrinder Build
  2. BGBUILD-313

boxgrinder build fails to build ec2 image if ec2-user already exists

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 0.9.7
    • Fix Version/s: 0.10.0
    • Component/s: Platform plugins
    • Labels:
      None
    • Environment:
      • Boxgrinder Meta Appliance 1.6 x86_64 ami-b4f9c8c0
      • Build CentOS 6.0
    • Steps to Reproduce:
      Hide

      add cloud-init rpm to a boxgrinder appliance and deliver to ec2

      Show
      add cloud-init rpm to a boxgrinder appliance and deliver to ec2
    • Workaround:
      Workaround Exists
    • Workaround Description:
      Hide

      patch -p0 /usr/lib/ruby/gems/1.8/gems/boxgrinder-build-0.9.7/lib/boxgrinder-build/plugins/platform/ec2/ec2-plugin.rb <<EOF
      --- /usr/lib/ruby/gems/1.8/gems/boxgrinder-build-0.9.7/lib/boxgrinder-build/plugins/platform/ec2/ec2-plugin.rb.orig     2011-09-10 05:38:42.000000000 -0400
      +++ /usr/lib/ruby/gems/1.8/gems/boxgrinder-build-0.9.7/lib/boxgrinder-build/plugins/platform/ec2/ec2-plugin.rb  2011-10-11 11:44:13.908946934 -0400
      @@ -151,7 +151,7 @@
           # https://issues.jboss.org/browse/BGBUILD-110
           def add_ec2_user(guestfs)
             @log.debug "Adding ec2-user user..."
      -      guestfs.sh("useradd ec2-user")
      +      guestfs.sh("getent passwd ec2-user >/dev/null || useradd ec2-user")
             guestfs.sh("echo -e 'ec2-user\tALL=(ALL)\tNOPASSWD: ALL' >> /etc/sudoers")
             @log.debug "User ec2-user added."
           end
      EOF
      

      Show
      patch -p0 /usr/lib/ruby/gems/1.8/gems/boxgrinder-build-0.9.7/lib/boxgrinder-build/plugins/platform/ec2/ec2-plugin.rb <<EOF --- /usr/lib/ruby/gems/1.8/gems/boxgrinder-build-0.9.7/lib/boxgrinder-build/plugins/platform/ec2/ec2-plugin.rb.orig 2011-09-10 05:38:42.000000000 -0400 +++ /usr/lib/ruby/gems/1.8/gems/boxgrinder-build-0.9.7/lib/boxgrinder-build/plugins/platform/ec2/ec2-plugin.rb 2011-10-11 11:44:13.908946934 -0400 @@ -151,7 +151,7 @@ # https://issues.jboss.org/browse/BGBUILD-110 def add_ec2_user(guestfs) @log.debug "Adding ec2-user user..." - guestfs.sh("useradd ec2-user") + guestfs.sh("getent passwd ec2-user >/dev/null || useradd ec2-user") guestfs.sh("echo -e 'ec2-user\tALL=(ALL)\tNOPASSWD: ALL' >> /etc/sudoers") @log.debug "User ec2-user added." end EOF
    • Estimated Difficulty:
      Low

      Description

      ec2-user is installed during postinstall of amazon "cloud-init" package, and boxgrinder ec2-delivery plugin does not check if the user already exists,
      but also tries to create an ec2-user. Therefore the installation fails if the ec2-user has already been created by some other mechanism.

      How to get the cloud-init source rpm from an amazon ami instance:

      get_reference_source -p cloud-init
      

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                goldmann Marek Goldmann
                Reporter:
                pada Daniel Parthey
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: