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

Method pollOperationStatus

src/cmd/linuxkit/gcp.go:528–544  ·  view source on GitHub ↗
(operationName string)

Source from the content-addressed store, hash-verified

526}
527
528func (g *GCPClient) pollOperationStatus(operationName string) error {
529 for i := 0; i < timeout; i++ {
530 operation, err := g.compute.GlobalOperations.Get(g.projectName, operationName).Do()
531 if err != nil {
532 return fmt.Errorf("error fetching operation status: %v", err)
533 }
534 if operation.Error != nil {
535 return fmt.Errorf("error running operation: %v", operation.Error)
536 }
537 if operation.Status == "DONE" {
538 return nil
539 }
540 time.Sleep(pollingInterval)
541 }
542 return fmt.Errorf("timeout waiting for operation to finish")
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()

Callers 2

CreateImageMethod · 0.95
DeleteImageMethod · 0.95

Calls 2

DoMethod · 0.80
GetMethod · 0.45

Tested by

no test coverage detected