go fmt all the things
This commit is contained in:
parent
62e054c404
commit
43f08b2664
@ -87,7 +87,7 @@ func (c *RunConfig) Prepare(t *packer.ConfigTemplate) []error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if we are not given an explicit keypairname, create a temporary one
|
// if we are not given an explicit keypairname, create a temporary one
|
||||||
if c.SSHKeyPairName == "" {
|
if c.SSHKeyPairName == "" {
|
||||||
c.TemporaryKeyPairName = fmt.Sprintf(
|
c.TemporaryKeyPairName = fmt.Sprintf(
|
||||||
"packer %s", uuid.TimeOrderedUUID())
|
"packer %s", uuid.TimeOrderedUUID())
|
||||||
}
|
}
|
||||||
|
@ -11,20 +11,20 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type StepKeyPair struct {
|
type StepKeyPair struct {
|
||||||
Debug bool
|
Debug bool
|
||||||
DebugKeyPath string
|
DebugKeyPath string
|
||||||
TemporaryKeyPairName string
|
TemporaryKeyPairName string
|
||||||
KeyPairName string
|
KeyPairName string
|
||||||
PrivateKeyFile string
|
PrivateKeyFile string
|
||||||
|
|
||||||
keyName string
|
keyName string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StepKeyPair) Run(state multistep.StateBag) multistep.StepAction {
|
func (s *StepKeyPair) Run(state multistep.StateBag) multistep.StepAction {
|
||||||
if s.PrivateKeyFile != "" {
|
if s.PrivateKeyFile != "" {
|
||||||
if s.KeyPairName != "" {
|
if s.KeyPairName != "" {
|
||||||
s.keyName = s.KeyPairName // need to get from config
|
s.keyName = s.KeyPairName // need to get from config
|
||||||
}
|
}
|
||||||
|
|
||||||
privateKeyBytes, err := ioutil.ReadFile(s.PrivateKeyFile)
|
privateKeyBytes, err := ioutil.ReadFile(s.PrivateKeyFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -86,8 +86,8 @@ func (s *StepKeyPair) Run(state multistep.StateBag) multistep.StepAction {
|
|||||||
|
|
||||||
func (s *StepKeyPair) Cleanup(state multistep.StateBag) {
|
func (s *StepKeyPair) Cleanup(state multistep.StateBag) {
|
||||||
// If no key name is set, then we never created it, so just return
|
// If no key name is set, then we never created it, so just return
|
||||||
// If we used an SSH private key file, do not go about deleting
|
// If we used an SSH private key file, do not go about deleting
|
||||||
// keypairs
|
// keypairs
|
||||||
if s.PrivateKeyFile != "" {
|
if s.PrivateKeyFile != "" {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -98,7 +98,7 @@ func (s *StepKeyPair) Cleanup(state multistep.StateBag) {
|
|||||||
ui.Say("Deleting temporary keypair...")
|
ui.Say("Deleting temporary keypair...")
|
||||||
_, err := ec2conn.DeleteKeyPair(s.keyName)
|
_, err := ec2conn.DeleteKeyPair(s.keyName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ui.Error(fmt.Sprintf(
|
ui.Error(fmt.Sprintf(
|
||||||
"Error cleaning up keypair. Please delete the key manually: %s", s.keyName))
|
"Error cleaning up keypair. Please delete the key manually: %s", s.keyName))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
|||||||
&awscommon.StepKeyPair{
|
&awscommon.StepKeyPair{
|
||||||
Debug: b.config.PackerDebug,
|
Debug: b.config.PackerDebug,
|
||||||
DebugKeyPath: fmt.Sprintf("ec2_%s.pem", b.config.PackerBuildName),
|
DebugKeyPath: fmt.Sprintf("ec2_%s.pem", b.config.PackerBuildName),
|
||||||
TemporaryKeyPairName: b.config.TemporaryKeyPairName,
|
TemporaryKeyPairName: b.config.TemporaryKeyPairName,
|
||||||
KeyPairName: b.config.SSHKeyPairName,
|
KeyPairName: b.config.SSHKeyPairName,
|
||||||
PrivateKeyFile: b.config.SSHPrivateKeyFile,
|
PrivateKeyFile: b.config.SSHPrivateKeyFile,
|
||||||
},
|
},
|
||||||
|
@ -196,7 +196,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
|||||||
&awscommon.StepKeyPair{
|
&awscommon.StepKeyPair{
|
||||||
Debug: b.config.PackerDebug,
|
Debug: b.config.PackerDebug,
|
||||||
DebugKeyPath: fmt.Sprintf("ec2_%s.pem", b.config.PackerBuildName),
|
DebugKeyPath: fmt.Sprintf("ec2_%s.pem", b.config.PackerBuildName),
|
||||||
TemporaryKeyPairName: b.config.TemporaryKeyPairName,
|
TemporaryKeyPairName: b.config.TemporaryKeyPairName,
|
||||||
KeyPairName: b.config.SSHKeyPairName,
|
KeyPairName: b.config.SSHKeyPairName,
|
||||||
PrivateKeyFile: b.config.SSHPrivateKeyFile,
|
PrivateKeyFile: b.config.SSHPrivateKeyFile,
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user