Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
packer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kristopher Ruzic
packer
Commits
57f18545
Commit
57f18545
authored
Aug 30, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/amazon: drop private key if debug mode [GH-373]
parent
404ae53a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
2 deletions
+35
-2
CHANGELOG.md
CHANGELOG.md
+5
-0
builder/amazon/common/step_key_pair.go
builder/amazon/common/step_key_pair.go
+21
-0
builder/amazon/ebs/builder.go
builder/amazon/ebs/builder.go
+5
-1
builder/amazon/instance/builder.go
builder/amazon/instance/builder.go
+4
-1
No files found.
CHANGELOG.md
View file @
57f18545
## 0.3.6 (unreleased)
## 0.3.6 (unreleased)
IMPROVEMENTS:
*
builder/amazon: In
`-debug`
mode, the keypair used will be saved to
the current directory so you can access the machine. [GH-373]
BUG FIXES:
BUG FIXES:
*
core: Fix possible panic when ctrl-C during provisioner run.
*
core: Fix possible panic when ctrl-C during provisioner run.
...
...
builder/amazon/common/step_key_pair.go
View file @
57f18545
...
@@ -8,9 +8,13 @@ import (
...
@@ -8,9 +8,13 @@ import (
"github.com/mitchellh/multistep"
"github.com/mitchellh/multistep"
"github.com/mitchellh/packer/packer"
"github.com/mitchellh/packer/packer"
"log"
"log"
"os"
)
)
type
StepKeyPair
struct
{
type
StepKeyPair
struct
{
Debug
bool
DebugKeyPath
string
keyName
string
keyName
string
}
}
...
@@ -34,6 +38,23 @@ func (s *StepKeyPair) Run(state map[string]interface{}) multistep.StepAction {
...
@@ -34,6 +38,23 @@ func (s *StepKeyPair) Run(state map[string]interface{}) multistep.StepAction {
state
[
"keyPair"
]
=
keyName
state
[
"keyPair"
]
=
keyName
state
[
"privateKey"
]
=
keyResp
.
KeyMaterial
state
[
"privateKey"
]
=
keyResp
.
KeyMaterial
// If we're in debug mode, output the private key to the working
// directory.
if
s
.
Debug
{
ui
.
Message
(
fmt
.
Sprintf
(
"Saving key for debug purposes: %s"
,
s
.
DebugKeyPath
))
f
,
err
:=
os
.
Create
(
s
.
DebugKeyPath
)
if
err
!=
nil
{
state
[
"error"
]
=
fmt
.
Errorf
(
"Error saving debug key: %s"
,
err
)
return
multistep
.
ActionHalt
}
defer
f
.
Close
()
if
_
,
err
:=
f
.
Write
([]
byte
(
keyResp
.
KeyMaterial
));
err
!=
nil
{
state
[
"error"
]
=
fmt
.
Errorf
(
"Error saving debug key: %s"
,
err
)
return
multistep
.
ActionHalt
}
}
return
multistep
.
ActionContinue
return
multistep
.
ActionContinue
}
}
...
...
builder/amazon/ebs/builder.go
View file @
57f18545
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
package
ebs
package
ebs
import
(
import
(
"fmt"
"github.com/mitchellh/goamz/ec2"
"github.com/mitchellh/goamz/ec2"
"github.com/mitchellh/multistep"
"github.com/mitchellh/multistep"
awscommon
"github.com/mitchellh/packer/builder/amazon/common"
awscommon
"github.com/mitchellh/packer/builder/amazon/common"
...
@@ -80,7 +81,10 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
...
@@ -80,7 +81,10 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
// Build the steps
// Build the steps
steps
:=
[]
multistep
.
Step
{
steps
:=
[]
multistep
.
Step
{
&
awscommon
.
StepKeyPair
{},
&
awscommon
.
StepKeyPair
{
Debug
:
b
.
config
.
PackerDebug
,
DebugKeyPath
:
fmt
.
Sprintf
(
"ec2_%s.pem"
,
b
.
config
.
PackerBuildName
),
},
&
awscommon
.
StepSecurityGroup
{
&
awscommon
.
StepSecurityGroup
{
SecurityGroupId
:
b
.
config
.
SecurityGroupId
,
SecurityGroupId
:
b
.
config
.
SecurityGroupId
,
SSHPort
:
b
.
config
.
SSHPort
,
SSHPort
:
b
.
config
.
SSHPort
,
...
...
builder/amazon/instance/builder.go
View file @
57f18545
...
@@ -184,7 +184,10 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
...
@@ -184,7 +184,10 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
// Build the steps
// Build the steps
steps
:=
[]
multistep
.
Step
{
steps
:=
[]
multistep
.
Step
{
&
awscommon
.
StepKeyPair
{},
&
awscommon
.
StepKeyPair
{
Debug
:
b
.
config
.
PackerDebug
,
DebugKeyPath
:
fmt
.
Sprintf
(
"ec2_%s.pem"
,
b
.
config
.
PackerBuildName
),
},
&
awscommon
.
StepSecurityGroup
{
&
awscommon
.
StepSecurityGroup
{
SecurityGroupId
:
b
.
config
.
SecurityGroupId
,
SecurityGroupId
:
b
.
config
.
SecurityGroupId
,
SSHPort
:
b
.
config
.
SSHPort
,
SSHPort
:
b
.
config
.
SSHPort
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment