Add in a sanity check for valid vnc ports

Check to make sure that the max and min VNC ports be below 65535 in
config.
This commit is contained in:
Darwin Liu 2021-01-08 13:39:17 -07:00
parent 2b698478a6
commit 8ef4cfa070
1 changed files with 5 additions and 0 deletions

View File

@ -599,6 +599,11 @@ func (c *Config) Prepare(raws ...interface{}) ([]string, error) {
errs, fmt.Errorf("vnc_port_min cannot be below 5900"))
}
if c.VNCPortMin > 65535 || c.VNCPortMax > 65535 {
errs = packersdk.MultiErrorAppend(
errs, fmt.Errorf("vmc_port_min and vnc_port_max must both be below 65535 to be valid TCP ports"))
}
if c.VNCPortMin > c.VNCPortMax {
errs = packersdk.MultiErrorAppend(
errs, fmt.Errorf("vnc_port_min must be less than vnc_port_max"))