From c88f75b234d7d1ab3b4ec7394c7ff23299f4d97c Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 12 Jul 2013 07:01:23 +0900 Subject: [PATCH] Update CHANGELOG --- CHANGELOG.md | 1 + builder/amazonebs/step_run_source_instance.go | 29 +++++++++---------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9570c03ee..d0f93e72b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ FEATURES: IMPROVEMENTS: +* amazon-ebs: Verify the source AMI is EBS-backed before launching. [GH-169] * vmware: error if shutdown command has non-zero exit status. BUG FIXES: diff --git a/builder/amazonebs/step_run_source_instance.go b/builder/amazonebs/step_run_source_instance.go index 98881b121..77c2c99e7 100644 --- a/builder/amazonebs/step_run_source_instance.go +++ b/builder/amazonebs/step_run_source_instance.go @@ -28,23 +28,20 @@ func (s *stepRunSourceInstance) Run(state map[string]interface{}) multistep.Step SecurityGroups: []ec2.SecurityGroup{ec2.SecurityGroup{Id: securityGroupId}}, } - ui.Say("Validating Source AMI...") - imageResp, err := ec2conn.Images([]string{config.SourceAmi}, ec2.NewFilter()) - if err != nil { - err := fmt.Errorf("There was a problem with the provided source AMI: %s", err) - state["error"] = err - ui.Error(err.Error()) - return multistep.ActionHalt - } - - if imageResp.Images[0].RootDeviceType != "ebs" { - err := fmt.Errorf("The provided source AMI is instance-store based. The amazon-ebs bundler can only work with EBS based AMIs.") - state["error"] = err - ui.Error(err.Error()) - return multistep.ActionHalt - } - ui.Say("Launching a source AWS instance...") + imageResp, err := ec2conn.Images([]string{config.SourceAmi}, ec2.NewFilter()) + if err != nil { + state["error"] = fmt.Errorf("There was a problem with the source AMI: %s", err) + return multistep.ActionHalt + } + + if imageResp.Images[0].RootDeviceType != "ebs" { + state["error"] = fmt.Errorf( + "The provided source AMI is instance-store based. The\n" + + "amazon-ebs bundler can only work with EBS based AMIs.") + return multistep.ActionHalt + } + runResp, err := ec2conn.RunInstances(runOpts) if err != nil { err := fmt.Errorf("Error launching source instance: %s", err)