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
c753946c
Commit
c753946c
authored
Aug 27, 2013
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
builder/vmware: ability to not request a PTY for SSH [GH-270]
parent
d0dce9e5
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
8 deletions
+25
-8
CHANGELOG.md
CHANGELOG.md
+2
-0
builder/vmware/builder.go
builder/vmware/builder.go
+2
-0
common/step_connect_ssh.go
common/step_connect_ssh.go
+4
-0
communicator/ssh/communicator.go
communicator/ssh/communicator.go
+13
-8
website/source/docs/builders/vmware.html.markdown
website/source/docs/builders/vmware.html.markdown
+4
-0
No files found.
CHANGELOG.md
View file @
c753946c
...
...
@@ -14,6 +14,8 @@ IMPROVEMENTS:
*
core: Output message when Ctrl-C received that we're cleaning up. [GH-338]
*
builder/amazon: Tagging now works with all amazon builder types.
*
builder/vmware: Option
`ssh_skip_request_pty`
for not requesting a PTY
for the SSH connection. [GH-270]
*
command/build: Machine-readable output now contains build errors, if any.
*
command/build: An "end" sentinel is outputted in machine-readable output
for artifact listing so it is easier to know when it is over.
...
...
builder/vmware/builder.go
View file @
c753946c
...
...
@@ -45,6 +45,7 @@ type config struct {
SSHUser
string
`mapstructure:"ssh_username"`
SSHPassword
string
`mapstructure:"ssh_password"`
SSHPort
uint
`mapstructure:"ssh_port"`
SSHSkipRequestPty
bool
`mapstructure:"ssh_skip_request_pty"`
ToolsUploadFlavor
string
`mapstructure:"tools_upload_flavor"`
ToolsUploadPath
string
`mapstructure:"tools_upload_path"`
VMXData
map
[
string
]
string
`mapstructure:"vmx_data"`
...
...
@@ -342,6 +343,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
SSHAddress
:
sshAddress
,
SSHConfig
:
sshConfig
,
SSHWaitTimeout
:
b
.
config
.
sshWaitTimeout
,
NoPty
:
b
.
config
.
SSHSkipRequestPty
,
},
&
stepUploadTools
{},
&
common
.
StepProvision
{},
...
...
common/step_connect_ssh.go
View file @
c753946c
...
...
@@ -34,6 +34,9 @@ type StepConnectSSH struct {
// SSHWaitTimeout is the total timeout to wait for SSH to become available.
SSHWaitTimeout
time
.
Duration
// NoPty, if true, will not request a Pty from the remote end.
NoPty
bool
comm
packer
.
Communicator
}
...
...
@@ -128,6 +131,7 @@ func (s *StepConnectSSH) waitForSSH(state map[string]interface{}, cancel <-chan
config
:=
&
ssh
.
Config
{
Connection
:
connFunc
,
SSHConfig
:
sshConfig
,
NoPty
:
s
.
NoPty
,
}
log
.
Println
(
"Attempting SSH connection..."
)
...
...
communicator/ssh/communicator.go
View file @
c753946c
...
...
@@ -29,6 +29,9 @@ type Config struct {
// in use will be closed as part of the Close method, or in the
// case an error occurs.
Connection
func
()
(
net
.
Conn
,
error
)
// NoPty, if true, will not request a pty from the remote end.
NoPty
bool
}
// Creates a new packer.Communicator implementation over SSH. This takes
...
...
@@ -58,15 +61,17 @@ func (c *comm) Start(cmd *packer.RemoteCmd) (err error) {
session
.
Stdout
=
cmd
.
Stdout
session
.
Stderr
=
cmd
.
Stderr
// Request a PTY
termModes
:=
ssh
.
TerminalModes
{
ssh
.
ECHO
:
0
,
// do not echo
ssh
.
TTY_OP_ISPEED
:
14400
,
// input speed = 14.4kbaud
ssh
.
TTY_OP_OSPEED
:
14400
,
// output speed = 14.4kbaud
}
if
!
c
.
config
.
NoPty
{
// Request a PTY
termModes
:=
ssh
.
TerminalModes
{
ssh
.
ECHO
:
0
,
// do not echo
ssh
.
TTY_OP_ISPEED
:
14400
,
// input speed = 14.4kbaud
ssh
.
TTY_OP_OSPEED
:
14400
,
// output speed = 14.4kbaud
}
if
err
=
session
.
RequestPty
(
"xterm"
,
80
,
40
,
termModes
);
err
!=
nil
{
return
if
err
=
session
.
RequestPty
(
"xterm"
,
80
,
40
,
termModes
);
err
!=
nil
{
return
}
}
log
.
Printf
(
"starting remote command: %s"
,
cmd
.
Command
)
...
...
website/source/docs/builders/vmware.html.markdown
View file @
c753946c
...
...
@@ -154,6 +154,10 @@ Optional:
*
`ssh_port`
(int) - The port that SSH will listen on within the virtual
machine. By default this is 22.
*
`ssh_skip_request_pty`
(bool) - If true, a pty will not be requested as
part of the SSH connection. By default, this is "false", so a pty
_will_ be requested.
*
`ssh_wait_timeout`
(string) - The duration to wait for SSH to become
available. By default this is "20m", or 20 minutes. Note that this should
be quite long since the timer begins as soon as the virtual machine is booted.
...
...
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