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
ecbb0e84
Commit
ecbb0e84
authored
Mar 28, 2014
by
asatara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added ssh_address variable to vmware builders
parent
dc21bf01
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
0 deletions
+14
-0
builder/vmware/common/ssh.go
builder/vmware/common/ssh.go
+4
-0
builder/vmware/common/ssh_config.go
builder/vmware/common/ssh_config.go
+10
-0
No files found.
builder/vmware/common/ssh.go
View file @
ecbb0e84
...
...
@@ -17,6 +17,10 @@ func SSHAddressFunc(config *SSHConfig) func(multistep.StateBag) (string, error)
driver
:=
state
.
Get
(
"driver"
)
.
(
Driver
)
vmxPath
:=
state
.
Get
(
"vmx_path"
)
.
(
string
)
if
config
.
SSHHost
!=
""
{
return
fmt
.
Sprintf
(
"%s:%d"
,
config
.
SSHHost
,
config
.
SSHPort
),
nil
}
log
.
Println
(
"Lookup up IP information..."
)
f
,
err
:=
os
.
Open
(
vmxPath
)
if
err
!=
nil
{
...
...
builder/vmware/common/ssh_config.go
View file @
ecbb0e84
...
...
@@ -3,6 +3,7 @@ package common
import
(
"errors"
"fmt"
"net"
"os"
"time"
...
...
@@ -13,6 +14,7 @@ type SSHConfig struct {
SSHUser
string
`mapstructure:"ssh_username"`
SSHKeyPath
string
`mapstructure:"ssh_key_path"`
SSHPassword
string
`mapstructure:"ssh_password"`
SSHHost
string
`mapstructure:"ssh_host"`
SSHPort
uint
`mapstructure:"ssh_port"`
SSHSkipRequestPty
bool
`mapstructure:"ssh_skip_request_pty"`
RawSSHWaitTimeout
string
`mapstructure:"ssh_wait_timeout"`
...
...
@@ -53,6 +55,14 @@ func (c *SSHConfig) Prepare(t *packer.ConfigTemplate) []error {
}
}
if
c
.
SSHHost
!=
""
{
if
ip
:=
net
.
ParseIP
(
c
.
SSHHost
);
ip
==
nil
{
if
_
,
err
:=
net
.
LookupHost
(
c
.
SSHHost
);
err
!=
nil
{
errs
=
append
(
errs
,
errors
.
New
(
"ssh_host is an invalid IP or hostname"
))
}
}
}
if
c
.
SSHUser
==
""
{
errs
=
append
(
errs
,
errors
.
New
(
"An ssh_username must be specified."
))
}
...
...
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