summaryrefslogtreecommitdiff
path: root/vendor/github.com/mitchellh/packer/builder/amazon/common/step_security_group.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/mitchellh/packer/builder/amazon/common/step_security_group.go')
-rw-r--r--vendor/github.com/mitchellh/packer/builder/amazon/common/step_security_group.go42
1 files changed, 24 insertions, 18 deletions
diff --git a/vendor/github.com/mitchellh/packer/builder/amazon/common/step_security_group.go b/vendor/github.com/mitchellh/packer/builder/amazon/common/step_security_group.go
index a5032772..e7bc294b 100644
--- a/vendor/github.com/mitchellh/packer/builder/amazon/common/step_security_group.go
+++ b/vendor/github.com/mitchellh/packer/builder/amazon/common/step_security_group.go
@@ -6,7 +6,7 @@ import (
"time"
"github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/private/waiter"
+ "github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/ec2"
"github.com/hashicorp/packer/common/uuid"
"github.com/hashicorp/packer/helper/communicator"
@@ -153,36 +153,42 @@ func (s *StepSecurityGroup) Cleanup(state multistep.StateBag) {
}
func waitUntilSecurityGroupExists(c *ec2.EC2, input *ec2.DescribeSecurityGroupsInput) error {
- waiterCfg := waiter.Config{
- Operation: "DescribeSecurityGroups",
- Delay: 15,
+ ctx := aws.BackgroundContext()
+ w := request.Waiter{
+ Name: "DescribeSecurityGroups",
MaxAttempts: 40,
- Acceptors: []waiter.WaitAcceptor{
+ Acceptors: []request.WaiterAcceptor{
{
- State: "success",
- Matcher: "path",
+ State: request.SuccessWaiterState,
+ Matcher: request.PathWaiterMatch,
Argument: "length(SecurityGroups[]) > `0`",
Expected: true,
},
{
- State: "retry",
- Matcher: "error",
+ State: request.RetryWaiterState,
+ Matcher: request.ErrorWaiterMatch,
Argument: "",
Expected: "InvalidGroup.NotFound",
},
{
- State: "retry",
- Matcher: "error",
+ State: request.RetryWaiterState,
+ Matcher: request.ErrorWaiterMatch,
Argument: "",
Expected: "InvalidSecurityGroupID.NotFound",
},
},
+ Logger: c.Config.Logger,
+ NewRequest: func(opts []request.Option) (*request.Request, error) {
+ var inCpy *ec2.DescribeSecurityGroupsInput
+ if input != nil {
+ tmp := *input
+ inCpy = &tmp
+ }
+ req, _ := c.DescribeSecurityGroupsRequest(inCpy)
+ req.SetContext(ctx)
+ req.ApplyOptions(opts...)
+ return req, nil
+ },
}
-
- w := waiter.Waiter{
- Client: c,
- Input: input,
- Config: waiterCfg,
- }
- return w.Wait()
+ return w.WaitWithContext(ctx)
}