Commit 2184892f authored by Billie H. Cleek's avatar Billie H. Cleek

do not request a pty

Change the default behavior from requesting a PTY when executing a
command with the ssh communicator to requesting a PTY only when
configured to do so.

Update the vmware builders to be fully backward compatible with the new
behavior.
parent e7bb074a
......@@ -349,7 +349,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
SSHAddress: driver.SSHAddress,
SSHConfig: vmwcommon.SSHConfigFunc(&b.config.SSHConfig),
SSHWaitTimeout: b.config.SSHWaitTimeout,
NoPty: b.config.SSHSkipRequestPty,
Pty: !b.config.SSHSkipRequestPty,
},
&vmwcommon.StepUploadTools{
RemoteType: b.config.RemoteType,
......
......@@ -334,7 +334,6 @@ func (d *ESX5Driver) connect() error {
User: d.Username,
Auth: auth,
},
NoPty: true,
}
comm, err := ssh.New(address, sshConfig)
......
......@@ -94,7 +94,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
SSHAddress: driver.SSHAddress,
SSHConfig: vmwcommon.SSHConfigFunc(&b.config.SSHConfig),
SSHWaitTimeout: b.config.SSHWaitTimeout,
NoPty: b.config.SSHSkipRequestPty,
Pty: !b.config.SSHSkipRequestPty,
},
&vmwcommon.StepUploadTools{
RemoteType: b.config.RemoteType,
......
......@@ -34,8 +34,8 @@ 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
// Pty, if true, will request a Pty from the remote end.
Pty bool
comm packer.Communicator
}
......@@ -138,7 +138,7 @@ func (s *StepConnectSSH) waitForSSH(state multistep.StateBag, cancel <-chan stru
config := &ssh.Config{
Connection: connFunc,
SSHConfig: sshConfig,
NoPty: s.NoPty,
Pty: s.Pty,
}
log.Println("Attempting SSH connection...")
......
......@@ -33,8 +33,8 @@ type Config struct {
// case an error occurs.
Connection func() (net.Conn, error)
// NoPty, if true, will not request a pty from the remote end.
NoPty bool
// Pty, if true, will request a pty from the remote end.
Pty bool
}
// Creates a new packer.Communicator implementation over SSH. This takes
......@@ -65,7 +65,7 @@ func (c *comm) Start(cmd *packer.RemoteCmd) (err error) {
session.Stdout = cmd.Stdout
session.Stderr = cmd.Stderr
if !c.config.NoPty {
if c.config.Pty {
// Request a PTY
termModes := ssh.TerminalModes{
ssh.ECHO: 0, // do not echo
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment