aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go')
-rw-r--r--vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go b/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go
index c215cd3..d57a1af 100644
--- a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go
+++ b/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go
@@ -24,8 +24,9 @@ func (c *EC2Metadata) GetMetadata(p string) (string, error) {
24 24
25 output := &metadataOutput{} 25 output := &metadataOutput{}
26 req := c.NewRequest(op, nil, output) 26 req := c.NewRequest(op, nil, output)
27 err := req.Send()
27 28
28 return output.Content, req.Send() 29 return output.Content, err
29} 30}
30 31
31// GetUserData returns the userdata that was configured for the service. If 32// GetUserData returns the userdata that was configured for the service. If
@@ -45,8 +46,9 @@ func (c *EC2Metadata) GetUserData() (string, error) {
45 r.Error = awserr.New("NotFoundError", "user-data not found", r.Error) 46 r.Error = awserr.New("NotFoundError", "user-data not found", r.Error)
46 } 47 }
47 }) 48 })
49 err := req.Send()
48 50
49 return output.Content, req.Send() 51 return output.Content, err
50} 52}
51 53
52// GetDynamicData uses the path provided to request information from the EC2 54// GetDynamicData uses the path provided to request information from the EC2
@@ -61,8 +63,9 @@ func (c *EC2Metadata) GetDynamicData(p string) (string, error) {
61 63
62 output := &metadataOutput{} 64 output := &metadataOutput{}
63 req := c.NewRequest(op, nil, output) 65 req := c.NewRequest(op, nil, output)
66 err := req.Send()
64 67
65 return output.Content, req.Send() 68 return output.Content, err
66} 69}
67 70
68// GetInstanceIdentityDocument retrieves an identity document describing an 71// GetInstanceIdentityDocument retrieves an identity document describing an
@@ -118,6 +121,10 @@ func (c *EC2Metadata) Region() (string, error) {
118 return "", err 121 return "", err
119 } 122 }
120 123
124 if len(resp) == 0 {
125 return "", awserr.New("EC2MetadataError", "invalid Region response", nil)
126 }
127
121 // returns region without the suffix. Eg: us-west-2a becomes us-west-2 128 // returns region without the suffix. Eg: us-west-2a becomes us-west-2
122 return resp[:len(resp)-1], nil 129 return resp[:len(resp)-1], nil
123} 130}