vagrant-s3auth 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -2
- data/CHANGELOG.md +14 -1
- data/Gemfile.lock +1 -1
- data/README.md +9 -10
- data/lib/vagrant-s3auth/{extensions → extension}/downloader.rb +9 -9
- data/lib/vagrant-s3auth/plugin.rb +4 -6
- data/lib/vagrant-s3auth/util.rb +3 -3
- data/lib/vagrant-s3auth/version.rb +1 -1
- data/test/run.bats +28 -5
- metadata +3 -4
- data/lib/vagrant-s3auth/extensions.rb +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 497d147d5fb4636bd0653dcc502062c8ee3ccbc1
|
4
|
+
data.tar.gz: e1c85dcd893e04a9a74e65c3c6b709620d31cfde
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f6a8b6450e73759490ff0ae77f365283f47fc591f2b3a45e9bde151495aed5e63ef780ec33a794f6e8d92d543f32f1e2327ad50f2f8f43a9dec370997c00e55
|
7
|
+
data.tar.gz: df4ba738e97b5eceec09d7e02654b4bf3b2c17e74ada47db61f6507bb9a22d84f2cd241e62deb1dfab548f821cc838709cf6e8f0ad95f1ec671a171333f2c020
|
data/.rubocop.yml
CHANGED
@@ -5,7 +5,7 @@ Metrics/AbcSize:
|
|
5
5
|
Max: 30
|
6
6
|
|
7
7
|
Metrics/CyclomaticComplexity:
|
8
|
-
Max:
|
8
|
+
Max: 12
|
9
9
|
|
10
10
|
Metrics/LineLength:
|
11
11
|
Max: 100
|
@@ -15,7 +15,7 @@ Metrics/MethodLength:
|
|
15
15
|
Max: 20
|
16
16
|
|
17
17
|
Metrics/PerceivedComplexity:
|
18
|
-
Max:
|
18
|
+
Max: 15
|
19
19
|
|
20
20
|
Style/AlignParameters:
|
21
21
|
EnforcedStyle: with_fixed_indentation
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,19 @@
|
|
1
|
+
## 1.0.1
|
2
|
+
|
3
|
+
**21 December 2014**
|
4
|
+
|
5
|
+
Enhancements:
|
6
|
+
|
7
|
+
* support bucket-in-host style S3 URLs to simplify usage instructions
|
8
|
+
|
9
|
+
Fixes:
|
10
|
+
|
11
|
+
* internal cleanup
|
12
|
+
* improved detection of incompatible Vagrant versions
|
13
|
+
|
1
14
|
## 1.0.0
|
2
15
|
|
3
|
-
**
|
16
|
+
**16 December 2014**
|
4
17
|
|
5
18
|
Enhancements:
|
6
19
|
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# vagrant-s3auth
|
2
2
|
|
3
3
|
<a href="https://travis-ci.org/WhoopInc/vagrant-s3auth">
|
4
|
-
<img src="https://travis-ci.org/WhoopInc/vagrant-s3auth.svg?branch=
|
4
|
+
<img src="https://travis-ci.org/WhoopInc/vagrant-s3auth.svg?branch=master"
|
5
5
|
align="right">
|
6
6
|
</a>
|
7
7
|
|
@@ -62,11 +62,16 @@ ENV['AWS_SECRET_ACCESS_KEY'] = creds[1].chomp
|
|
62
62
|
|
63
63
|
#### S3 URLs
|
64
64
|
|
65
|
-
|
65
|
+
You can use any valid HTTP(S) URL for your object:
|
66
66
|
|
67
|
-
```
|
67
|
+
```bash
|
68
|
+
# path style
|
68
69
|
http://s3.amazonaws.com/bucket/resource
|
69
70
|
https://s3.amazonaws.com/bucket/resource
|
71
|
+
|
72
|
+
# host style
|
73
|
+
http://bucket.s3.amazonaws.com/resource
|
74
|
+
https://bucket.s3.amazonaws.com/resource
|
70
75
|
```
|
71
76
|
|
72
77
|
Or the S3 protocol shorthand
|
@@ -77,13 +82,6 @@ s3://bucket/resource
|
|
77
82
|
|
78
83
|
which expands to the path-style HTTPS URL.
|
79
84
|
|
80
|
-
Virtual host-style S3 URLs, where the bucket is specified in the hostname, are
|
81
|
-
**not detected**!
|
82
|
-
|
83
|
-
```
|
84
|
-
https://bucket.s3-region.amazonaws.com/resource # ignored
|
85
|
-
```
|
86
|
-
|
87
85
|
##### Non-standard regions
|
88
86
|
|
89
87
|
If your bucket is not hosted in the US Standard region, you'll need to specify
|
@@ -91,6 +89,7 @@ the correct region endpoint as part of the URL:
|
|
91
89
|
|
92
90
|
```
|
93
91
|
https://s3-us-west-2.amazonaws.com/bucket/resource
|
92
|
+
https://bucket.s3-us-west-2.amazonaws.com/resource
|
94
93
|
```
|
95
94
|
|
96
95
|
Or just use the S3 protocol shorthand, which will automatically determine the
|
@@ -3,18 +3,19 @@ require 'uri'
|
|
3
3
|
require 'vagrant/util/downloader'
|
4
4
|
require 'vagrant-s3auth/util'
|
5
5
|
|
6
|
+
S3Auth = VagrantPlugins::S3Auth
|
7
|
+
|
6
8
|
module Vagrant
|
7
9
|
module Util
|
8
10
|
class Downloader
|
9
11
|
def execute_curl_with_s3(options, subprocess_options, &data_proc)
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
end
|
12
|
+
# The URL sent to curl is always the last argument. We have to rely
|
13
|
+
# on this implementation detail because we need to hook into both
|
14
|
+
# HEAD and GET requests.
|
15
|
+
url = options.last
|
15
16
|
|
16
|
-
if
|
17
|
-
@logger.info("s3auth: Discovered S3 URL: #{
|
17
|
+
if s3_object = S3Auth::Util.s3_object_for(url)
|
18
|
+
@logger.info("s3auth: Discovered S3 URL: #{@source}")
|
18
19
|
@logger.debug("s3auth: Bucket: #{s3_object.bucket.name.inspect}")
|
19
20
|
@logger.debug("s3auth: Key: #{s3_object.key.inspect}")
|
20
21
|
|
@@ -22,8 +23,7 @@ module Vagrant
|
|
22
23
|
|
23
24
|
@logger.info("s3auth: Generating signed URL for #{method.upcase}")
|
24
25
|
|
25
|
-
|
26
|
-
options << VagrantPlugins::S3Auth::Util.s3_url_for(method, s3_object).to_s
|
26
|
+
url.replace(S3Auth::Util.s3_url_for(method, s3_object).to_s)
|
27
27
|
end
|
28
28
|
|
29
29
|
execute_curl_without_s3(options, subprocess_options, &data_proc)
|
@@ -4,16 +4,14 @@ rescue LoadError
|
|
4
4
|
raise 'The Vagrant S3Auth plugin must be run within Vagrant.'
|
5
5
|
end
|
6
6
|
|
7
|
-
if Vagrant::VERSION < '1.5.0'
|
8
|
-
raise 'The Vagrant AWS plugin is only compatible with Vagrant 1.5+'
|
9
|
-
end
|
10
|
-
|
11
7
|
require_relative 'errors'
|
12
|
-
require_relative '
|
8
|
+
require_relative 'extension/downloader'
|
13
9
|
|
14
10
|
module VagrantPlugins
|
15
11
|
module S3Auth
|
16
|
-
class Plugin < Vagrant.plugin(2)
|
12
|
+
class Plugin < Vagrant.plugin('2')
|
13
|
+
Vagrant.require_version('>= 1.5.1')
|
14
|
+
|
17
15
|
name 's3auth'
|
18
16
|
|
19
17
|
description <<-DESC
|
data/lib/vagrant-s3auth/util.rb
CHANGED
@@ -6,7 +6,7 @@ require 'uri'
|
|
6
6
|
module VagrantPlugins
|
7
7
|
module S3Auth
|
8
8
|
module Util
|
9
|
-
S3_HOST_MATCHER = /^s3([[:alnum:]\-\.]+)?\.amazonaws\.com$/
|
9
|
+
S3_HOST_MATCHER = /^((?<bucket>[[:alnum:]\-\.]+).)?s3([[:alnum:]\-\.]+)?\.amazonaws\.com$/
|
10
10
|
|
11
11
|
LOCATION_TO_REGION = Hash.new { |_, key| key }.merge(
|
12
12
|
nil => 'us-east-1',
|
@@ -20,9 +20,9 @@ module VagrantPlugins
|
|
20
20
|
bucket = url.host
|
21
21
|
key = url.path[1..-1]
|
22
22
|
raise Errors::MalformedShorthandURLError, url: url unless bucket && key
|
23
|
-
elsif url.host
|
23
|
+
elsif match = S3_HOST_MATCHER.match(url.host)
|
24
24
|
components = url.path.split('/').delete_if(&:empty?)
|
25
|
-
bucket = components.shift
|
25
|
+
bucket = match['bucket'] || components.shift
|
26
26
|
key = components.join('/')
|
27
27
|
end
|
28
28
|
|
data/test/run.bats
CHANGED
@@ -31,48 +31,72 @@ teardown() {
|
|
31
31
|
bundle exec vagrant box add "$ATLAS_USERNAME/$VAGRANT_S3AUTH_ATLAS_BOX_NAME"
|
32
32
|
}
|
33
33
|
|
34
|
-
@test "simple box with full standard url" {
|
34
|
+
@test "simple box with full path standard url" {
|
35
35
|
bundle exec vagrant box add \
|
36
36
|
--name "$VAGRANT_S3AUTH_BOX_BASE" \
|
37
37
|
"https://s3.amazonaws.com/us-east-1.$VAGRANT_S3AUTH_BUCKET/$VAGRANT_S3AUTH_BOX_BASE.box"
|
38
38
|
}
|
39
39
|
|
40
|
+
@test "simple box with full host standard url" {
|
41
|
+
bundle exec vagrant box add \
|
42
|
+
--name "$VAGRANT_S3AUTH_BOX_BASE" \
|
43
|
+
"https://us-east-1.$VAGRANT_S3AUTH_BUCKET.s3.amazonaws.com/$VAGRANT_S3AUTH_BOX_BASE.box"
|
44
|
+
}
|
45
|
+
|
40
46
|
@test "simple box with shorthand standard url" {
|
41
47
|
bundle exec vagrant box add \
|
42
48
|
--name "$VAGRANT_S3AUTH_BOX_BASE" \
|
43
49
|
"s3://us-east-1.$VAGRANT_S3AUTH_BUCKET/$VAGRANT_S3AUTH_BOX_BASE.box"
|
44
50
|
}
|
45
51
|
|
46
|
-
@test "simple box with full nonstandard url" {
|
52
|
+
@test "simple box with full path nonstandard url" {
|
47
53
|
bundle exec vagrant box add \
|
48
54
|
--name "$VAGRANT_S3AUTH_BOX_BASE" \
|
49
55
|
"https://s3-$VAGRANT_S3AUTH_REGION_NONSTANDARD.amazonaws.com/$VAGRANT_S3AUTH_REGION_NONSTANDARD.$VAGRANT_S3AUTH_BUCKET/$VAGRANT_S3AUTH_BOX_BASE.box"
|
50
56
|
}
|
51
57
|
|
58
|
+
@test "simple box with full host nonstandard url" {
|
59
|
+
bundle exec vagrant box add \
|
60
|
+
--name "$VAGRANT_S3AUTH_BOX_BASE" \
|
61
|
+
"https://$VAGRANT_S3AUTH_REGION_NONSTANDARD.$VAGRANT_S3AUTH_BUCKET.s3-$VAGRANT_S3AUTH_REGION_NONSTANDARD.amazonaws.com/$VAGRANT_S3AUTH_BOX_BASE.box"
|
62
|
+
}
|
63
|
+
|
52
64
|
@test "simple box with shorthand nonstandard url" {
|
53
65
|
bundle exec vagrant box add \
|
54
66
|
--name "$VAGRANT_S3AUTH_BOX_BASE" \
|
55
67
|
"s3://$VAGRANT_S3AUTH_REGION_NONSTANDARD.$VAGRANT_S3AUTH_BUCKET/$VAGRANT_S3AUTH_BOX_BASE.box"
|
56
68
|
}
|
57
69
|
|
58
|
-
@test "metadata box with full standard url" {
|
70
|
+
@test "metadata box with full path standard url" {
|
59
71
|
bundle exec vagrant box add \
|
60
72
|
--name "vagrant-s3auth/$VAGRANT_S3AUTH_BOX_BASE" \
|
61
73
|
"https://s3.amazonaws.com/us-east-1.$VAGRANT_S3AUTH_BUCKET/$VAGRANT_S3AUTH_BOX_BASE"
|
62
74
|
}
|
63
75
|
|
76
|
+
@test "metadata box with full host standard url" {
|
77
|
+
bundle exec vagrant box add \
|
78
|
+
--name "vagrant-s3auth/$VAGRANT_S3AUTH_BOX_BASE" \
|
79
|
+
"https://us-east-1.$VAGRANT_S3AUTH_BUCKET.s3.amazonaws.com/$VAGRANT_S3AUTH_BOX_BASE"
|
80
|
+
}
|
81
|
+
|
64
82
|
@test "metadata box with shorthand standard url" {
|
65
83
|
bundle exec vagrant box add \
|
66
84
|
--name "vagrant-s3auth/$VAGRANT_S3AUTH_BOX_BASE" \
|
67
85
|
"s3://us-east-1.$VAGRANT_S3AUTH_BUCKET/$VAGRANT_S3AUTH_BOX_BASE"
|
68
86
|
}
|
69
87
|
|
70
|
-
@test "metadata box with full nonstandard url" {
|
88
|
+
@test "metadata box with full path nonstandard url" {
|
71
89
|
bundle exec vagrant box add \
|
72
90
|
--name "vagrant-s3auth/$VAGRANT_S3AUTH_BOX_BASE" \
|
73
91
|
"https://s3-$VAGRANT_S3AUTH_REGION_NONSTANDARD.amazonaws.com/$VAGRANT_S3AUTH_REGION_NONSTANDARD.$VAGRANT_S3AUTH_BUCKET/$VAGRANT_S3AUTH_BOX_BASE"
|
74
92
|
}
|
75
93
|
|
94
|
+
@test "metadata box with full host nonstandard url" {
|
95
|
+
bundle exec vagrant box add \
|
96
|
+
--name "vagrant-s3auth/$VAGRANT_S3AUTH_BOX_BASE" \
|
97
|
+
"https://$VAGRANT_S3AUTH_REGION_NONSTANDARD.$VAGRANT_S3AUTH_BUCKET.s3-$VAGRANT_S3AUTH_REGION_NONSTANDARD.amazonaws.com/$VAGRANT_S3AUTH_BOX_BASE"
|
98
|
+
}
|
99
|
+
|
76
100
|
@test "metadata box with shorthand nonstandard url" {
|
77
101
|
bundle exec vagrant box add \
|
78
102
|
--name "vagrant-s3auth/$VAGRANT_S3AUTH_BOX_BASE" \
|
@@ -88,6 +112,5 @@ teardown() {
|
|
88
112
|
@test "garbage full url" {
|
89
113
|
run bundle exec vagrant box add --name "$VAGRANT_S3AUTH_BOX_BASE" https://smoogedydoop
|
90
114
|
[[ "$status" -eq 1 ]]
|
91
|
-
echo "$output"
|
92
115
|
[[ "$output" == *"error occurred while downloading the remote file"* ]]
|
93
116
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-s3auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nikhil Benesch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|
@@ -101,8 +101,7 @@ files:
|
|
101
101
|
- TESTING.md
|
102
102
|
- lib/vagrant-s3auth.rb
|
103
103
|
- lib/vagrant-s3auth/errors.rb
|
104
|
-
- lib/vagrant-s3auth/
|
105
|
-
- lib/vagrant-s3auth/extensions/downloader.rb
|
104
|
+
- lib/vagrant-s3auth/extension/downloader.rb
|
106
105
|
- lib/vagrant-s3auth/plugin.rb
|
107
106
|
- lib/vagrant-s3auth/util.rb
|
108
107
|
- lib/vagrant-s3auth/version.rb
|
@@ -1 +0,0 @@
|
|
1
|
-
require_relative 'extensions/downloader'
|