Add ssh_port config

This commit is contained in:
Cheng Sun 2015-01-02 18:19:00 +00:00
parent 1539688cb8
commit 2591ae8226
3 changed files with 9 additions and 10 deletions

View File

@ -39,9 +39,9 @@ type CommonConfig struct {
// SSHHostPortMin uint `mapstructure:"ssh_host_port_min"`
// SSHHostPortMax uint `mapstructure:"ssh_host_port_max"`
SSHKeyPath string `mapstructure:"ssh_key_path"`
SSHPassword string `mapstructure:"ssh_password"`
// SSHPort uint `mapstructure:"ssh_port"`
SSHKeyPath string `mapstructure:"ssh_key_path"`
SSHPassword string `mapstructure:"ssh_password"`
SSHPort uint `mapstructure:"ssh_port"`
SSHUser string `mapstructure:"ssh_username"`
RawSSHWaitTimeout string `mapstructure:"ssh_wait_timeout"`
SSHWaitTimeout time.Duration
@ -96,12 +96,12 @@ func (c *CommonConfig) Prepare(t *packer.ConfigTemplate, pc *common.PackerConfig
if c.SSHHostPortMax == 0 {
c.SSHHostPortMax = 4444
}
if c.SSHPort == 0 {
c.SSHPort = 22
}
*/
if c.SSHPort == 0 {
c.SSHPort = 22
}
if c.RawSSHWaitTimeout == "" {
c.RawSSHWaitTimeout = "20m"
}

View File

@ -131,5 +131,6 @@ func HimnSSHIP(state multistep.StateBag) (string, error) {
}
func HimnSSHPort(state multistep.StateBag) (uint, error) {
return 22, nil
config := state.Get("commonconfig").(CommonConfig)
return config.SSHPort, nil
}

View File

@ -186,10 +186,8 @@ each category, the available options are alphabetized and described.
* `ssh_password` (string) - The password for `ssh_username` to use to
authenticate with SSH. By default this is the empty string.
<!--
* `ssh_port` (integer) - The port that SSH will be listening on in the guest
virtual machine. By default this is 22.
-->
* `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