builder/vmware: ability to not request a PTY for SSH [GH-270]
This commit is contained in:
parent
f626790edd
commit
20541a7eda
@ -14,6 +14,8 @@ IMPROVEMENTS:
|
|||||||
|
|
||||||
* core: Output message when Ctrl-C received that we're cleaning up. [GH-338]
|
* 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/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: Machine-readable output now contains build errors, if any.
|
||||||
* command/build: An "end" sentinel is outputted in machine-readable output
|
* command/build: An "end" sentinel is outputted in machine-readable output
|
||||||
for artifact listing so it is easier to know when it is over.
|
for artifact listing so it is easier to know when it is over.
|
||||||
|
@ -45,6 +45,7 @@ type config struct {
|
|||||||
SSHUser string `mapstructure:"ssh_username"`
|
SSHUser string `mapstructure:"ssh_username"`
|
||||||
SSHPassword string `mapstructure:"ssh_password"`
|
SSHPassword string `mapstructure:"ssh_password"`
|
||||||
SSHPort uint `mapstructure:"ssh_port"`
|
SSHPort uint `mapstructure:"ssh_port"`
|
||||||
|
SSHSkipRequestPty bool `mapstructure:"ssh_skip_request_pty"`
|
||||||
ToolsUploadFlavor string `mapstructure:"tools_upload_flavor"`
|
ToolsUploadFlavor string `mapstructure:"tools_upload_flavor"`
|
||||||
ToolsUploadPath string `mapstructure:"tools_upload_path"`
|
ToolsUploadPath string `mapstructure:"tools_upload_path"`
|
||||||
VMXData map[string]string `mapstructure:"vmx_data"`
|
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,
|
SSHAddress: sshAddress,
|
||||||
SSHConfig: sshConfig,
|
SSHConfig: sshConfig,
|
||||||
SSHWaitTimeout: b.config.sshWaitTimeout,
|
SSHWaitTimeout: b.config.sshWaitTimeout,
|
||||||
|
NoPty: b.config.SSHSkipRequestPty,
|
||||||
},
|
},
|
||||||
&stepUploadTools{},
|
&stepUploadTools{},
|
||||||
&common.StepProvision{},
|
&common.StepProvision{},
|
||||||
|
@ -34,6 +34,9 @@ type StepConnectSSH struct {
|
|||||||
// SSHWaitTimeout is the total timeout to wait for SSH to become available.
|
// SSHWaitTimeout is the total timeout to wait for SSH to become available.
|
||||||
SSHWaitTimeout time.Duration
|
SSHWaitTimeout time.Duration
|
||||||
|
|
||||||
|
// NoPty, if true, will not request a Pty from the remote end.
|
||||||
|
NoPty bool
|
||||||
|
|
||||||
comm packer.Communicator
|
comm packer.Communicator
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -128,6 +131,7 @@ func (s *StepConnectSSH) waitForSSH(state map[string]interface{}, cancel <-chan
|
|||||||
config := &ssh.Config{
|
config := &ssh.Config{
|
||||||
Connection: connFunc,
|
Connection: connFunc,
|
||||||
SSHConfig: sshConfig,
|
SSHConfig: sshConfig,
|
||||||
|
NoPty: s.NoPty,
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Println("Attempting SSH connection...")
|
log.Println("Attempting SSH connection...")
|
||||||
|
@ -29,6 +29,9 @@ type Config struct {
|
|||||||
// in use will be closed as part of the Close method, or in the
|
// in use will be closed as part of the Close method, or in the
|
||||||
// case an error occurs.
|
// case an error occurs.
|
||||||
Connection func() (net.Conn, error)
|
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
|
// 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.Stdout = cmd.Stdout
|
||||||
session.Stderr = cmd.Stderr
|
session.Stderr = cmd.Stderr
|
||||||
|
|
||||||
// Request a PTY
|
if !c.config.NoPty {
|
||||||
termModes := ssh.TerminalModes{
|
// Request a PTY
|
||||||
ssh.ECHO: 0, // do not echo
|
termModes := ssh.TerminalModes{
|
||||||
ssh.TTY_OP_ISPEED: 14400, // input speed = 14.4kbaud
|
ssh.ECHO: 0, // do not echo
|
||||||
ssh.TTY_OP_OSPEED: 14400, // output speed = 14.4kbaud
|
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 {
|
if err = session.RequestPty("xterm", 80, 40, termModes); err != nil {
|
||||||
return
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("starting remote command: %s", cmd.Command)
|
log.Printf("starting remote command: %s", cmd.Command)
|
||||||
|
@ -154,6 +154,10 @@ Optional:
|
|||||||
* `ssh_port` (int) - The port that SSH will listen on within the virtual
|
* `ssh_port` (int) - The port that SSH will listen on within the virtual
|
||||||
machine. By default this is 22.
|
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
|
* `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
|
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.
|
be quite long since the timer begins as soon as the virtual machine is booted.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user