Default polling delay 5 sec

This commit is contained in:
Paul Meyer 2020-03-31 22:19:58 +00:00
parent 4ffe5611b8
commit 47107e6355
3 changed files with 11 additions and 4 deletions

View File

@ -5,6 +5,7 @@ import (
"fmt"
"log"
"strings"
"time"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute"
"github.com/Azure/go-autorest/autorest/azure"
@ -98,7 +99,9 @@ func (s *StepCreateNewDisk) Run(ctx context.Context, state multistep.StateBag) m
f, err := azcli.DisksClient().CreateOrUpdate(ctx, s.resourceGroup, s.diskName, disk)
if err == nil {
err = f.WaitForCompletionRef(ctx, azcli.PollClient())
cli := azcli.PollClient() // quick polling for quick operations
cli.PollingDelay = time.Second
err = f.WaitForCompletionRef(ctx, cli)
}
if err != nil {
log.Printf("StepCreateNewDisk.Run: error: %+v", err)

View File

@ -5,6 +5,7 @@ import (
"fmt"
"log"
"strings"
"time"
"github.com/hashicorp/packer/builder/azure/common/client"
"github.com/hashicorp/packer/helper/multistep"
@ -72,7 +73,9 @@ func (s *StepCreateSnapshot) Run(ctx context.Context, state multistep.StateBag)
f, err := azcli.SnapshotsClient().CreateOrUpdate(ctx, s.resourceGroup, s.snapshotName, snapshot)
if err == nil {
err = f.WaitForCompletionRef(ctx, azcli.PollClient())
cli := azcli.PollClient() // quick polling for quick operations
cli.PollingDelay = time.Second
err = f.WaitForCompletionRef(ctx, cli)
}
if err != nil {
log.Printf("StepCreateSnapshot.Run: error: %+v", err)

View File

@ -5,10 +5,11 @@ import (
"regexp"
"time"
"github.com/hashicorp/packer/helper/useragent"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-07-01/compute/computeapi"
"github.com/Azure/go-autorest/autorest"
"github.com/hashicorp/packer/helper/useragent"
)
type AzureClientSet interface {
@ -127,6 +128,6 @@ func (s azureClientSet) GalleryImageVersionsClient() computeapi.GalleryImageVers
func (s azureClientSet) PollClient() autorest.Client {
c := autorest.NewClientWithUserAgent("Packer-Azure-ClientSet")
s.configureAutorestClient(&c)
c.PollingDelay = time.Second / 3
c.PollingDelay = time.Second * 5
return c
}