Commit f72f7a37 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

builder/googlecompute: fix all sorts of zone issues

parent 7f140cdf
...@@ -141,7 +141,7 @@ func (d *driverGCE) RunInstance(c *InstanceConfig) (<-chan error, error) { ...@@ -141,7 +141,7 @@ func (d *driverGCE) RunInstance(c *InstanceConfig) (<-chan error, error) {
} }
errCh := make(chan error, 1) errCh := make(chan error, 1)
go waitForState(errCh, "DONE", d.refreshZoneOp(op)) go waitForState(errCh, "DONE", d.refreshZoneOp(zone.Name, op))
return errCh, nil return errCh, nil
} }
...@@ -162,9 +162,9 @@ func (d *driverGCE) getImage(name string) (image *compute.Image, err error) { ...@@ -162,9 +162,9 @@ func (d *driverGCE) getImage(name string) (image *compute.Image, err error) {
return return
} }
func (d *driverGCE) refreshZoneOp(op *compute.Operation) stateRefreshFunc { func (d *driverGCE) refreshZoneOp(zone string, op *compute.Operation) stateRefreshFunc {
return func() (string, error) { return func() (string, error) {
newOp, err := d.service.ZoneOperations.Get(d.projectId, op.Zone, op.Name).Do() newOp, err := d.service.ZoneOperations.Get(d.projectId, zone, op.Name).Do()
if err != nil { if err != nil {
return "", err return "", err
} }
......
...@@ -18,7 +18,8 @@ func processPrivateKeyFile(privateKeyFile, passphrase string) ([]byte, error) { ...@@ -18,7 +18,8 @@ func processPrivateKeyFile(privateKeyFile, passphrase string) ([]byte, error) {
PEMBlock, _ := pem.Decode(rawPrivateKeyBytes) PEMBlock, _ := pem.Decode(rawPrivateKeyBytes)
if PEMBlock == nil { if PEMBlock == nil {
return nil, fmt.Errorf("%s does not contain a vaild private key", privateKeyFile) return nil, fmt.Errorf(
"%s does not contain a vaild private key", privateKeyFile)
} }
if x509.IsEncryptedPEMBlock(PEMBlock) { if x509.IsEncryptedPEMBlock(PEMBlock) {
......
...@@ -39,6 +39,7 @@ func (s *StepCreateInstance) Run(state multistep.StateBag) multistep.StepAction ...@@ -39,6 +39,7 @@ func (s *StepCreateInstance) Run(state multistep.StateBag) multistep.StepAction
}) })
if err == nil { if err == nil {
ui.Message("Waiting for creation operation to complete...")
select { select {
case err = <-errCh: case err = <-errCh:
case <-time.After(config.stateTimeout): case <-time.After(config.stateTimeout):
......
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