builder/googlecompute: fix all sorts of zone issues
This commit is contained in:
parent
7f140cdf9c
commit
f72f7a37d1
|
@ -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) {
|
||||||
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) {
|
||||||
|
|
||||||
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
|
||||||
})
|
})
|
||||||
|
|
||||||
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):
|
||||||
|
|
Loading…
Reference in New Issue