Default polling delay 5 sec
This commit is contained in:
parent
4ffe5611b8
commit
47107e6355
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue