fix ssh agent authentication

treat key name to empty string if it's not been set
by prior step.
This commit is contained in:
Matthew Hooker 2017-02-26 17:17:49 -08:00
parent 9c0526c078
commit f95514c120
No known key found for this signature in database
GPG Key ID: 7B5F933D9CE8C6A1
1 changed files with 4 additions and 1 deletions

View File

@ -41,7 +41,10 @@ type StepRunSourceInstance struct {
func (s *StepRunSourceInstance) Run(state multistep.StateBag) multistep.StepAction {
ec2conn := state.Get("ec2").(*ec2.EC2)
keyName := state.Get("keyPair").(string)
var keyName string
if name, ok := state.GetOk("keyPair"); ok {
keyName = name.(string)
}
securityGroupIds := aws.StringSlice(state.Get("securityGroupIds").([]string))
ui := state.Get("ui").(packer.Ui)