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
dfc332f9
Commit
dfc332f9
authored
May 21, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/amazonebs: Add ssh_* settings
parent
4453fda2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
+7
-4
builder/amazonebs/builder.go
builder/amazonebs/builder.go
+2
-0
builder/amazonebs/step_connect_ssh.go
builder/amazonebs/step_connect_ssh.go
+5
-4
No files found.
builder/amazonebs/builder.go
View file @
dfc332f9
...
@@ -22,6 +22,8 @@ type config struct {
...
@@ -22,6 +22,8 @@ type config struct {
Region
string
Region
string
SourceAmi
string
`mapstructure:"source_ami"`
SourceAmi
string
`mapstructure:"source_ami"`
InstanceType
string
`mapstructure:"instance_type"`
InstanceType
string
`mapstructure:"instance_type"`
SSHUsername
string
`mapstructure:"ssh_username"`
SSHPort
int
`mapstructure:"ssh_port"`
// Configuration of the resulting AMI
// Configuration of the resulting AMI
AMIName
string
`mapstructure:"ami_name"`
AMIName
string
`mapstructure:"ami_name"`
...
...
builder/amazonebs/step_connect_ssh.go
View file @
dfc332f9
...
@@ -16,6 +16,7 @@ type stepConnectSSH struct {
...
@@ -16,6 +16,7 @@ type stepConnectSSH struct {
}
}
func
(
s
*
stepConnectSSH
)
Run
(
state
map
[
string
]
interface
{})
StepAction
{
func
(
s
*
stepConnectSSH
)
Run
(
state
map
[
string
]
interface
{})
StepAction
{
config
:=
state
[
"config"
]
.
(
config
)
instance
:=
state
[
"instance"
]
.
(
*
ec2
.
Instance
)
instance
:=
state
[
"instance"
]
.
(
*
ec2
.
Instance
)
privateKey
:=
state
[
"privateKey"
]
.
(
string
)
privateKey
:=
state
[
"privateKey"
]
.
(
string
)
ui
:=
state
[
"ui"
]
.
(
packer
.
Ui
)
ui
:=
state
[
"ui"
]
.
(
packer
.
Ui
)
...
@@ -31,7 +32,7 @@ func (s *stepConnectSSH) Run(state map[string]interface{}) StepAction {
...
@@ -31,7 +32,7 @@ func (s *stepConnectSSH) Run(state map[string]interface{}) StepAction {
// Build the actual SSH client configuration
// Build the actual SSH client configuration
sshConfig
:=
&
gossh
.
ClientConfig
{
sshConfig
:=
&
gossh
.
ClientConfig
{
User
:
"ubuntu"
,
User
:
config
.
SSHUsername
,
Auth
:
[]
gossh
.
ClientAuth
{
Auth
:
[]
gossh
.
ClientAuth
{
gossh
.
ClientAuthKeyring
(
keyring
),
gossh
.
ClientAuthKeyring
(
keyring
),
},
},
...
@@ -43,9 +44,9 @@ func (s *stepConnectSSH) Run(state map[string]interface{}) StepAction {
...
@@ -43,9 +44,9 @@ func (s *stepConnectSSH) Run(state map[string]interface{}) StepAction {
time
.
Sleep
(
time
.
Duration
(
i
)
*
time
.
Second
)
time
.
Sleep
(
time
.
Duration
(
i
)
*
time
.
Second
)
log
.
Printf
(
log
.
Printf
(
"Opening TCP conn for SSH to %s:
22
(attempt %d)"
,
"Opening TCP conn for SSH to %s:
%d
(attempt %d)"
,
instance
.
DNSName
,
i
+
1
)
instance
.
DNSName
,
config
.
SSHPort
,
i
+
1
)
s
.
conn
,
err
=
net
.
Dial
(
"tcp"
,
fmt
.
Sprintf
(
"%s:
22"
,
instance
.
DNSName
))
s
.
conn
,
err
=
net
.
Dial
(
"tcp"
,
fmt
.
Sprintf
(
"%s:
%d"
,
instance
.
DNSName
,
config
.
SSHPort
))
if
err
!=
nil
{
if
err
!=
nil
{
continue
continue
}
}
...
...
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