Skip to content

Commit

Permalink
Merge pull request #168 from terraform-providers/b-customization-timeout
Browse files Browse the repository at this point in the history
r/virtual_machine: Increase customization timeout to 10 mins
  • Loading branch information
vancluever authored Sep 19, 2017
2 parents 6e439a5 + 1a23d59 commit 7c58690
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion vsphere/event_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
"time"

"github.com/vmware/govmomi"
"github.com/vmware/govmomi/event"
Expand All @@ -16,6 +17,10 @@ const (
eventTypeCustomizationSucceeded = "CustomizationSucceeded"
)

// virtualMachineCustomizationWaiterTimeout is the default time that
// virtualMachineCustomizationWaiter waits for a success or failure event.
const virtualMachineCustomizationWaiterTimeout = time.Minute * 10

// virtualMachineCustomizationWaiter is an object that waits for customization
// of a VirtualMachine to complete, by watching for success or failure events.
//
Expand Down Expand Up @@ -93,7 +98,7 @@ func (w *virtualMachineCustomizationWaiter) wait(client *govmomi.Client, vm *obj
// This is our waiter. We want to wait on all of these conditions. We also
// use a different context so that we can give a better error message on
// timeout without interfering with the subscriber's context.
ctx, cancel := context.WithTimeout(context.Background(), defaultAPITimeout)
ctx, cancel := context.WithTimeout(context.Background(), virtualMachineCustomizationWaiterTimeout)
defer cancel()
select {
case err := <-mgrErr:
Expand Down
2 changes: 1 addition & 1 deletion vsphere/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

// defaultAPITimeout is a default timeout value that is passed to functions
// requiring contexts, and other various waiters.
var defaultAPITimeout = time.Minute * 5
const defaultAPITimeout = time.Minute * 5

// Provider returns a terraform.ResourceProvider.
func Provider() terraform.ResourceProvider {
Expand Down

0 comments on commit 7c58690

Please sign in to comment.