Commit 9186a7f2 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

builder/amazon: output DNS name if debug mode

parent 57f18545
...@@ -4,6 +4,7 @@ IMPROVEMENTS: ...@@ -4,6 +4,7 @@ IMPROVEMENTS:
* builder/amazon: In `-debug` mode, the keypair used will be saved to * builder/amazon: In `-debug` mode, the keypair used will be saved to
the current directory so you can access the machine. [GH-373] the current directory so you can access the machine. [GH-373]
* builder/amazon: In `-debug` mode, the DNS is outputted.
BUG FIXES: BUG FIXES:
......
...@@ -10,6 +10,7 @@ import ( ...@@ -10,6 +10,7 @@ import (
) )
type StepRunSourceInstance struct { type StepRunSourceInstance struct {
Debug bool
ExpectedRootDevice string ExpectedRootDevice string
InstanceType string InstanceType string
UserData string UserData string
...@@ -100,6 +101,17 @@ func (s *StepRunSourceInstance) Run(state map[string]interface{}) multistep.Step ...@@ -100,6 +101,17 @@ func (s *StepRunSourceInstance) Run(state map[string]interface{}) multistep.Step
} }
s.instance = latestInstance.(*ec2.Instance) s.instance = latestInstance.(*ec2.Instance)
if s.Debug {
if s.instance.DNSName != "" {
ui.Message(fmt.Sprintf("Public DNS: %s", s.instance.DNSName))
}
if s.instance.PrivateIpAddress != "" {
ui.Message(fmt.Sprintf("Private IP: %s", s.instance.PrivateIpAddress))
}
}
state["instance"] = s.instance state["instance"] = s.instance
return multistep.ActionContinue return multistep.ActionContinue
......
...@@ -91,6 +91,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe ...@@ -91,6 +91,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
VpcId: b.config.VpcId, VpcId: b.config.VpcId,
}, },
&awscommon.StepRunSourceInstance{ &awscommon.StepRunSourceInstance{
Debug: b.config.PackerDebug,
ExpectedRootDevice: "ebs", ExpectedRootDevice: "ebs",
InstanceType: b.config.InstanceType, InstanceType: b.config.InstanceType,
UserData: b.config.UserData, UserData: b.config.UserData,
......
...@@ -194,6 +194,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe ...@@ -194,6 +194,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
VpcId: b.config.VpcId, VpcId: b.config.VpcId,
}, },
&awscommon.StepRunSourceInstance{ &awscommon.StepRunSourceInstance{
Debug: b.config.PackerDebug,
ExpectedRootDevice: "instance-store", ExpectedRootDevice: "instance-store",
InstanceType: b.config.InstanceType, InstanceType: b.config.InstanceType,
IamInstanceProfile: b.config.IamInstanceProfile, IamInstanceProfile: b.config.IamInstanceProfile,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment