Merge remote-tracking branch 'upstream/master' into packer-builder-profitbricks

pull/3660/head
jasminSPC 10 years ago
commit 178748bb7c

@ -73,6 +73,7 @@ BUG FIXES:
* builder/amazon: Use `temporary_key_pair_name` when specified. [GH-3739]
* builder/amazon: Add 0.5 cents to discovered spot price. [GH-3662]
* builder/amazon: Fix packer crash when waiting for SSH. [GH-3865]
* builder/amazon: Honor ssh_private_ip flag in EC2-Classic. [GH-3752]
* builder/azure: check for empty resource group [GH-3606]
* builder/azure: fix token validity test [GH-3609]
* builder/docker: fix docker builder with ansible provisioner. [GH-3476]
@ -82,6 +83,7 @@ BUG FIXES:
* builder/vmware: Respect `ssh_host`/`winrm_host` on ESXi [GH-3738]
* builder/vmware: Do not add remotedisplay.vnc.ip to VMX data on ESXi
[GH-3740]
* builder/qemu: Don't fail on communicator set to `none`. [GH-3681]
* website: improved rendering on iPad [GH-3780]
## 0.10.1 (May 7, 2016)

@ -34,6 +34,8 @@ func SSHHost(e ec2Describer, private bool) func(multistep.StateBag) (string, err
} else if i.PrivateIpAddress != nil && *i.PrivateIpAddress != "" {
host = *i.PrivateIpAddress
}
} else if private {
host = *i.PrivateIpAddress
} else if i.PublicDnsName != nil && *i.PublicDnsName != "" {
host = *i.PublicDnsName
}

@ -375,19 +375,40 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
HTTPPortMin: b.config.HTTPPortMin,
HTTPPortMax: b.config.HTTPPortMax,
},
new(stepForwardSSH),
)
if b.config.Comm.Type != "none" {
steps = append(steps,
new(stepForwardSSH),
)
}
steps = append(steps,
new(stepConfigureVNC),
steprun,
&stepBootWait{},
&stepTypeBootCommand{},
&communicator.StepConnect{
Config: &b.config.Comm,
Host: commHost,
SSHConfig: sshConfig,
SSHPort: commPort,
},
)
if b.config.Comm.Type != "none" {
steps = append(steps,
&communicator.StepConnect{
Config: &b.config.Comm,
Host: commHost,
SSHConfig: sshConfig,
SSHPort: commPort,
},
)
}
steps = append(steps,
new(common.StepProvision),
)
steps = append(steps,
new(stepShutdown),
)
steps = append(steps,
new(stepConvertDisk),
)

@ -63,7 +63,6 @@ func getCommandArgs(bootDrive string, state multistep.StateBag) ([]string, error
isoPath := state.Get("iso_path").(string)
vncIP := state.Get("vnc_ip").(string)
vncPort := state.Get("vnc_port").(uint)
sshHostPort := state.Get("sshHostPort").(uint)
ui := state.Get("ui").(packer.Ui)
driver := state.Get("driver").(Driver)
@ -74,10 +73,16 @@ func getCommandArgs(bootDrive string, state multistep.StateBag) ([]string, error
defaultArgs := make(map[string]interface{})
var deviceArgs []string
var driveArgs []string
var sshHostPort uint
defaultArgs["-name"] = vmName
defaultArgs["-machine"] = fmt.Sprintf("type=%s", config.MachineType)
defaultArgs["-netdev"] = fmt.Sprintf("user,id=user.0,hostfwd=tcp::%v-:%d", sshHostPort, config.Comm.Port())
if config.Comm.Type != "none" {
sshHostPort = state.Get("sshHostPort").(uint)
defaultArgs["-netdev"] = fmt.Sprintf("user,id=user.0,hostfwd=tcp::%v-:%d", sshHostPort, config.Comm.Port())
} else {
defaultArgs["-netdev"] = fmt.Sprintf("user,id=user.0")
}
qemuVersion, err := driver.Version()
if err != nil {
@ -157,13 +162,23 @@ func getCommandArgs(bootDrive string, state multistep.StateBag) ([]string, error
httpPort := state.Get("http_port").(uint)
ctx := config.ctx
ctx.Data = qemuArgsTemplateData{
"10.0.2.2",
httpPort,
config.HTTPDir,
config.OutputDir,
config.VMName,
sshHostPort,
if config.Comm.Type != "none" {
ctx.Data = qemuArgsTemplateData{
"10.0.2.2",
httpPort,
config.HTTPDir,
config.OutputDir,
config.VMName,
sshHostPort,
}
} else {
ctx.Data = qemuArgsTemplateData{
HTTPIP: "10.0.2.2",
HTTPPort: httpPort,
HTTPDir: config.HTTPDir,
OutputDir: config.OutputDir,
Name: config.VMName,
}
}
newQemuArgs, err := processArgs(config.QemuArgs, &ctx)
if err != nil {

@ -3,10 +3,11 @@ package qemu
import (
"errors"
"fmt"
"github.com/mitchellh/multistep"
"github.com/mitchellh/packer/packer"
"log"
"time"
"github.com/mitchellh/multistep"
"github.com/mitchellh/packer/packer"
)
// This step shuts down the machine. It first attempts to do so gracefully,
@ -23,11 +24,29 @@ import (
type stepShutdown struct{}
func (s *stepShutdown) Run(state multistep.StateBag) multistep.StepAction {
comm := state.Get("communicator").(packer.Communicator)
config := state.Get("config").(*Config)
driver := state.Get("driver").(Driver)
ui := state.Get("ui").(packer.Ui)
if state.Get("communicator") == nil {
cancelCh := make(chan struct{}, 1)
go func() {
defer close(cancelCh)
<-time.After(config.shutdownTimeout)
}()
ui.Say("Waiting for shutdown...")
if ok := driver.WaitForShutdown(cancelCh); ok {
log.Println("VM shut down.")
return multistep.ActionContinue
} else {
err := fmt.Errorf("Failed to shutdown")
state.Put("error", err)
ui.Error(err.Error())
return multistep.ActionHalt
}
}
comm := state.Get("communicator").(packer.Communicator)
if config.ShutdownCommand != "" {
ui.Say("Gracefully halting virtual machine...")
log.Printf("Executing shutdown command: %s", config.ShutdownCommand)

@ -157,7 +157,8 @@ builder.
- `machine_type` (string) - The machine type. Defaults to `"n1-standard-1"`.
- `metadata` (object of key/value strings)
- `metadata` (object of key/value strings) - Metadata applied to the launched
instance.
- `network` (string) - The Google Compute network to use for the
launched instance. Defaults to `"default"`.

@ -47,6 +47,9 @@ Required Parameters:
Optional Parameters:
- `command` (string) - The command to invoke ansible.
Defaults to `ansible-playbook`.
- `groups` (array of strings) - The groups into which the Ansible host
should be placed. When unspecified, the host is not associated with any
groups.

Loading…
Cancel
Save