Added support for the NONE option to be specified for parallel and serial ports in the vmware iso builder.

This commit is contained in:
Ali Rizvi-Santiago 2017-04-12 17:41:36 -05:00
parent 884af69da1
commit 898b27c16d
2 changed files with 16 additions and 2 deletions

View File

@ -196,6 +196,9 @@ func unformat_serial(config string) (*serialUnion, error) {
return &serialUnion{serialType: res, auto: res}, nil return &serialUnion{serialType: res, auto: res}, nil
case "NONE":
return &serialUnion{serialType: nil}, nil
default: default:
return nil, fmt.Errorf("Unknown serial type : %s : %s", strings.ToUpper(formatType), config) return nil, fmt.Errorf("Unknown serial type : %s : %s", strings.ToUpper(formatType), config)
} }
@ -270,7 +273,11 @@ func unformat_parallel(config string) (*parallelUnion, error) {
return nil, fmt.Errorf("Unknown parallel port direction : %s : %s", strings.ToUpper(formatOptions), config) return nil, fmt.Errorf("Unknown parallel port direction : %s : %s", strings.ToUpper(formatOptions), config)
} }
return &parallelUnion{parallelType: res, auto: res}, nil return &parallelUnion{parallelType: res, auto: res}, nil
case "NONE":
return &parallelUnion{parallelType: nil}, nil
} }
return nil, fmt.Errorf("Unexpected format for parallel port: %s", config) return nil, fmt.Errorf("Unexpected format for parallel port: %s", config)
} }
@ -431,6 +438,8 @@ func (s *stepCreateVMX) Run(_ context.Context, state multistep.StateBag) multist
templateData.Serial_Filename = filepath.FromSlash(serial.auto.devicename) templateData.Serial_Filename = filepath.FromSlash(serial.auto.devicename)
templateData.Serial_Yield = serial.auto.yield templateData.Serial_Yield = serial.auto.yield
templateData.Serial_Auto = "TRUE" templateData.Serial_Auto = "TRUE"
case nil:
break
default: default:
err := fmt.Errorf("Error procesing VMX template: %v", serial) err := fmt.Errorf("Error procesing VMX template: %v", serial)
@ -463,6 +472,9 @@ func (s *stepCreateVMX) Run(_ context.Context, state multistep.StateBag) multist
templateData.Parallel_Present = "TRUE" templateData.Parallel_Present = "TRUE"
templateData.Parallel_Auto = "TRUE" templateData.Parallel_Auto = "TRUE"
templateData.Parallel_Bidirectional = parallel.auto.bidirectional templateData.Parallel_Bidirectional = parallel.auto.bidirectional
case nil:
break
default: default:
err := fmt.Errorf("Error procesing VMX template: %v", parallel) err := fmt.Errorf("Error procesing VMX template: %v", parallel)
state.Put("error", err) state.Put("error", err)

View File

@ -207,7 +207,7 @@ builder.
- `parallel` (string) - This specifies a parallel port to add to the VM. It - `parallel` (string) - This specifies a parallel port to add to the VM. It
has the format of `Type:option1,option2,...`. Type can be one of the has the format of `Type:option1,option2,...`. Type can be one of the
following values: "FILE", "DEVICE", or "AUTO". following values: "FILE", "DEVICE", "AUTO", or "NONE".
* `FILE:path` - Specifies the path to the local file to be used for the * `FILE:path` - Specifies the path to the local file to be used for the
parallel port. parallel port.
@ -217,6 +217,7 @@ builder.
parallel port. Direction can be `BI` to specify parallel port. Direction can be `BI` to specify
bidirectional communication or `UNI` to specify bidirectional communication or `UNI` to specify
unidirectional communication. unidirectional communication.
* `NONE` - Specifies to not use a parallel port. (default)
- `remote_cache_datastore` (string) - The path to the datastore where - `remote_cache_datastore` (string) - The path to the datastore where
supporting files will be stored during the build on the remote machine. By supporting files will be stored during the build on the remote machine. By
@ -254,7 +255,7 @@ builder.
- `serial` (string) - This specifies a serial port to add to the VM. - `serial` (string) - This specifies a serial port to add to the VM.
It has a format of `Type:option1,option2,...`. The field `Type` can be one It has a format of `Type:option1,option2,...`. The field `Type` can be one
of the following values: `FILE`, `DEVICE`, `PIPE`, or `AUTO`. of the following values: `FILE`, `DEVICE`, `PIPE`, `AUTO`, or `NONE`.
* `FILE:path(,yield)` - Specifies the path to the local file to be used as the * `FILE:path(,yield)` - Specifies the path to the local file to be used as the
serial port. serial port.
@ -285,6 +286,7 @@ builder.
* `yield` (bool) - This is an optional boolean that specifies whether * `yield` (bool) - This is an optional boolean that specifies whether
the vm should yield the cpu when polling the port. the vm should yield the cpu when polling the port.
By default, the builder will assume this as `FALSE`. By default, the builder will assume this as `FALSE`.
* `NONE` - Specifies to not use a serial port. (default)
- `shutdown_command` (string) - The command to use to gracefully shut down the - `shutdown_command` (string) - The command to use to gracefully shut down the
machine once all the provisioning is done. By default this is an empty machine once all the provisioning is done. By default this is an empty