Merge pull request #2539 from fnoeding/amazon-ebs-fix-ec-user-data-encoding

amazon builder: always base64 encode ec2 user data
This commit is contained in:
Chris Bednarski 2016-02-03 16:47:01 -08:00
commit e6b6f0b020
1 changed files with 5 additions and 6 deletions

View File

@ -55,14 +55,13 @@ func (s *StepRunSourceInstance) Run(state multistep.StateBag) multistep.StepActi
return multistep.ActionHalt
}
// Test if it is encoded already, and if not, encode it
if _, err := base64.StdEncoding.DecodeString(string(contents)); err != nil {
log.Printf("[DEBUG] base64 encoding user data...")
contents = []byte(base64.StdEncoding.EncodeToString(contents))
}
userData = string(contents)
}
// Test if it is encoded already, and if not, encode it
if _, err := base64.StdEncoding.DecodeString(userData); err != nil {
log.Printf("[DEBUG] base64 encoding user data...")
userData = base64.StdEncoding.EncodeToString([]byte(userData))
}
ui.Say("Launching a source AWS instance...")