MCPcopy Create free account
hub / github.com/linuxkit/linuxkit / pollZoneOperationStatus

Method pollZoneOperationStatus

src/cmd/linuxkit/gcp.go:545–560  ·  view source on GitHub ↗
(operationName, zone string)

Source from the content-addressed store, hash-verified

543
544}
545func (g *GCPClient) pollZoneOperationStatus(operationName, zone string) error {
546 for i := 0; i < timeout; i++ {
547 operation, err := g.compute.ZoneOperations.Get(g.projectName, zone, operationName).Do()
548 if err != nil {
549 return fmt.Errorf("error fetching operation status: %v", err)
550 }
551 if operation.Error != nil {
552 return fmt.Errorf("error running operation: %v", operation.Error)
553 }
554 if operation.Status == "DONE" {
555 return nil
556 }
557 time.Sleep(pollingInterval)
558 }
559 return fmt.Errorf("timeout waiting for operation to finish")
560}

Callers 2

CreateInstanceMethod · 0.95
DeleteInstanceMethod · 0.95

Calls 2

DoMethod · 0.80
GetMethod · 0.45

Tested by

no test coverage detected