Commit 40dbe8de authored by Rickard von Essen's avatar Rickard von Essen

Merge pull request #1161 from rickard-von-essen/opt_if

builder/parallels: Select which interface to connect to.
parents fc10c1b1 bd25866e
......@@ -36,6 +36,7 @@ type config struct {
GuestOSType string `mapstructure:"guest_os_type"`
GuestOSDistribution string `mapstructure:"guest_os_distribution"`
HardDriveInterface string `mapstructure:"hard_drive_interface"`
HostInterfaces []string `mapstructure:"host_interfaces"`
HTTPDir string `mapstructure:"http_directory"`
HTTPPortMin uint `mapstructure:"http_port_min"`
HTTPPortMax uint `mapstructure:"http_port_max"`
......@@ -110,6 +111,11 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, error) {
b.config.HTTPPortMax = 9000
}
if len(b.config.HostInterfaces) == 0 {
b.config.HostInterfaces = []string{"en0", "en1", "en2", "en3", "en4", "en5", "en6", "en7",
"en8", "en9", "ppp0", "ppp1", "ppp2"}
}
if b.config.VMName == "" {
b.config.VMName = fmt.Sprintf("packer-%s", b.config.PackerBuildName)
}
......
......@@ -42,7 +42,7 @@ func (s *stepTypeBootCommand) Run(state multistep.StateBag) multistep.StepAction
driver := state.Get("driver").(parallelscommon.Driver)
// Determine the host IP
ipFinder := &IfconfigIPFinder{Devices: []string{"en0", "en1", "en2", "en3", "en4", "en5", "en6", "en7", "en8", "en9", "ppp0", "ppp1", "ppp2"}}
ipFinder := &IfconfigIPFinder{Devices: config.HostInterfaces}
hostIp, err := ipFinder.HostIP()
if err != nil {
......
......@@ -114,6 +114,12 @@ each category, the available options are alphabetized and described.
hard drives are attached to, defaults to "sata". Valid options are
"sata", "ide", and "scsi".
* `host_interfaces` (array of strings) - A list of which interfaces on the
host should be searched for a IP address. The first IP address found on
one of these will be used as `{{ .HTTPIP }}` in the `boot_command`.
Defaults to ["en0", "en1", "en2", "en3", "en4", "en5", "en6", "en7", "en8",
"en9", "ppp0", "ppp1", "ppp2"].
* `http_directory` (string) - Path to a directory to serve using an HTTP
server. The files in this directory will be available over HTTP that will
be requestable from the virtual machine. This is useful for hosting
......
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