// Wait for a compute operation to finish.
//   op The operation
//   zone The zone for the operation
// Returns an error if one occurs, or nil
Wait for a compute operation to finish.
op The operation
zone The zone for the operation
Returns an error if one occurs, or nil
// Wait for a compute operation to finish . // op The operation // zone The zone for the operation // Returns an error if one occurs or nil
func (cloud GCECloud) waitForOp(op *compute.Operation, zone string) error {
	op, err := cloud.service.ZoneOperations.Get(cloud.projectId, zone, op.Name).Do()
	for op.Status != "DONE" {
		time.Sleep(5 * time.Second)
		op, err = cloud.service.ZoneOperations.Get(cloud.projectId, zone, op.Name).Do()
		if err != nil {
			log.Printf("Got compute.Operation, err: %#v, %v", op, err)
		}
		if op.Status != "PENDING" && op.Status != "RUNNING" && op.Status != "DONE" {
			log.Printf("Error waiting for operation: %s\n", op)
			return errors.New(fmt.Sprintf("Bad operation: %s", op))
		}
	}
	return err
}
func ( cloud GCECloud ) waitForOp ( op * compute . Operation , zone string ) error { op , err := cloud . service . ZoneOperations . Get ( cloud . projectId , zone , op . Name ) . Do ( ) for op . Status != " " { time . Sleep ( 5 * time . Second ) op , err = cloud . service . ZoneOperations . Get ( cloud . projectId , zone , op . Name ) . Do ( ) if err != nil { log . Printf ( " " , op , err ) } if op . Status != " " && op . Status != " " && op . Status != " " { log . Printf ( " \n " , op ) return errors . New ( fmt . Sprintf ( " " , op ) ) } } return err }
Wait for a compute operation to finish.
Wait for a compute operation to finish .