vagrant-s3auth-mfa 1.4.3 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -2
- data/lib/vagrant-s3auth-mfa/util.rb +1 -1
- data/lib/vagrant-s3auth-mfa/version.rb +1 -1
- data/vagrant-s3auth-mfa.gemspec +2 -2
- metadata +7 -17
- data/Rakefile +0 -15
- data/TESTING.md +0 -70
- data/test/box/minimal +0 -13
- data/test/box/minimal.box +0 -0
- data/test/box/public-minimal +0 -13
- data/test/box/public-minimal.box +0 -1
- data/test/cleanup.rb +0 -23
- data/test/run.bats +0 -147
- data/test/setup.rb +0 -34
- data/test/support.rb +0 -82
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 385cfd66de798618110817e177bfcb948d4169489f7e633ce13ed0efb70f6e46
|
4
|
+
data.tar.gz: 5314ea54b96109d51c63d4de07a8dd302555e84d2b3650c48a7aa6cd0e2dce0f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86f059873423512aecb5db98680b77af9306b166709b1488bb82896a53d806fe3e25d834b4a24a3a6bfc963e44716c13ac00a517f6112c550ac1546545e71b1b
|
7
|
+
data.tar.gz: 7e9e6605219a684a3ad93f241c783260dd76ee9334cf1dd07b62fa697051a04731adf2a4c0ac71281e47453559e9d6baeea96f12a42314880170ee8a450cdea7
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,15 @@
|
|
1
|
+
## 1.5.0
|
2
|
+
|
3
|
+
**29 January 2019**
|
4
|
+
|
5
|
+
Features:
|
6
|
+
|
7
|
+
* Removed tests untill fixed
|
8
|
+
* Removed unused dependencies
|
9
|
+
|
1
10
|
## 1.4.1
|
2
11
|
|
3
|
-
**15 January
|
12
|
+
**15 January 2019**
|
4
13
|
|
5
14
|
Features:
|
6
15
|
|
@@ -8,7 +17,7 @@ Features:
|
|
8
17
|
|
9
18
|
## 1.4.0
|
10
19
|
|
11
|
-
**14 January
|
20
|
+
**14 January 2019**
|
12
21
|
|
13
22
|
Features:
|
14
23
|
|
data/vagrant-s3auth-mfa.gemspec
CHANGED
@@ -8,14 +8,14 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.authors = ['Nikhil Benesch']
|
9
9
|
spec.email = ['benesch@whoop.com']
|
10
10
|
spec.summary = '[VRTDev Fork]Private, versioned Vagrant boxes hosted on Amazon S3.'
|
11
|
-
spec.homepage = 'https://github.com/vrtdev/vagrant-s3auth
|
11
|
+
spec.homepage = 'https://github.com/vrtdev/vagrant-s3auth'
|
12
12
|
spec.license = 'MIT'
|
13
13
|
|
14
14
|
spec.files = `git ls-files -z`.split("\x0")
|
15
15
|
spec.test_files = spec.files.grep(/spec/)
|
16
16
|
spec.require_paths = ['lib']
|
17
17
|
|
18
|
-
spec.add_dependency 'aws-sdk', '>=
|
18
|
+
spec.add_dependency 'aws-sdk-s3', '>= 1.30.0', '< 2'
|
19
19
|
spec.add_dependency 'aws_config', '~> 0.1.0'
|
20
20
|
|
21
21
|
spec.add_development_dependency 'bundler', '~> 1.5'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-s3auth-mfa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nikhil Benesch
|
@@ -11,25 +11,25 @@ cert_chain: []
|
|
11
11
|
date: 2019-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name: aws-sdk
|
14
|
+
name: aws-sdk-s3
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.30.0
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '
|
22
|
+
version: '2'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: 1.30.0
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '
|
32
|
+
version: '2'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: aws_config
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -116,8 +116,6 @@ files:
|
|
116
116
|
- Gemfile
|
117
117
|
- LICENSE
|
118
118
|
- README.md
|
119
|
-
- Rakefile
|
120
|
-
- TESTING.md
|
121
119
|
- lib/vagrant-s3auth-mfa.rb
|
122
120
|
- lib/vagrant-s3auth-mfa/errors.rb
|
123
121
|
- lib/vagrant-s3auth-mfa/extension/downloader.rb
|
@@ -126,16 +124,8 @@ files:
|
|
126
124
|
- lib/vagrant-s3auth-mfa/util.rb
|
127
125
|
- lib/vagrant-s3auth-mfa/version.rb
|
128
126
|
- locales/en.yml
|
129
|
-
- test/box/minimal
|
130
|
-
- test/box/minimal.box
|
131
|
-
- test/box/public-minimal
|
132
|
-
- test/box/public-minimal.box
|
133
|
-
- test/cleanup.rb
|
134
|
-
- test/run.bats
|
135
|
-
- test/setup.rb
|
136
|
-
- test/support.rb
|
137
127
|
- vagrant-s3auth-mfa.gemspec
|
138
|
-
homepage: https://github.com/vrtdev/vagrant-s3auth
|
128
|
+
homepage: https://github.com/vrtdev/vagrant-s3auth
|
139
129
|
licenses:
|
140
130
|
- MIT
|
141
131
|
metadata: {}
|
data/Rakefile
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'bundler/setup'
|
3
|
-
require 'rubocop/rake_task'
|
4
|
-
|
5
|
-
Dir.chdir(File.expand_path('../', __FILE__))
|
6
|
-
|
7
|
-
Bundler::GemHelper.install_tasks
|
8
|
-
|
9
|
-
RuboCop::RakeTask.new(:lint)
|
10
|
-
|
11
|
-
task :test do
|
12
|
-
sh 'bats test/run.bats'
|
13
|
-
end
|
14
|
-
|
15
|
-
task default: %w[lint test]
|
data/TESTING.md
DELETED
@@ -1,70 +0,0 @@
|
|
1
|
-
# Testing
|
2
|
-
|
3
|
-
No unit testing, since the project is so small. But a full suite of acceptance
|
4
|
-
tests that run using [Bats: Bash Automated Testing System][bats]! Basically, the
|
5
|
-
acceptance tests run `vagrant box add S3_URL` with a bunch of S3 URLs and box
|
6
|
-
types, and assert that everything works!
|
7
|
-
|
8
|
-
See [the .travis.yml CI configuration](.travis.yml) for a working example.
|
9
|
-
|
10
|
-
## Environment variables
|
11
|
-
|
12
|
-
You'll need to export the below. Recommended values included when not sensitive.
|
13
|
-
|
14
|
-
```bash
|
15
|
-
# AWS credentials with permissions to create S3 buckets
|
16
|
-
export AWS_ACCESS_KEY_ID=
|
17
|
-
export AWS_SECRET_ACCESS_KEY=
|
18
|
-
|
19
|
-
# Atlas (Vagrant Cloud) API credentials
|
20
|
-
export ATLAS_USERNAME="vagrant-s3auth"
|
21
|
-
export ATLAS_TOKEN
|
22
|
-
|
23
|
-
# Base name of bucket. Must be unique.
|
24
|
-
export VAGRANT_S3AUTH_BUCKET="testing.vagrant-s3auth.com"
|
25
|
-
|
26
|
-
# If specified as 'metadata', will upload 'box/metadata' and 'box/metadata.box'
|
27
|
-
# to each S3 bucket
|
28
|
-
export VAGRANT_S3AUTH_BOX_BASE="minimal"
|
29
|
-
|
30
|
-
# Base name of Atlas (Vagrant Cloud) box. Atlas boxes can never re-use a once
|
31
|
-
# existing name, so include a timestamp or random string in the name.
|
32
|
-
export VAGRANT_S3AUTH_ATLAS_BOX_NAME="vagrant-s3auth-192458"
|
33
|
-
|
34
|
-
# Additional S3 region to use in testing. US Standard is always used.
|
35
|
-
export VAGRANT_S3AUTH_REGION_NONSTANDARD="eu-west-1"
|
36
|
-
```
|
37
|
-
|
38
|
-
[bats]: https://github.com/sstephenson/bats
|
39
|
-
|
40
|
-
## Running tests
|
41
|
-
|
42
|
-
You'll need [Bats][bats] installed! Then:
|
43
|
-
|
44
|
-
```bash
|
45
|
-
# export env vars as described
|
46
|
-
$ test/setup.rb
|
47
|
-
$ rake test
|
48
|
-
# hack hack hack
|
49
|
-
$ rake test
|
50
|
-
$ test/cleanup.rb
|
51
|
-
```
|
52
|
-
|
53
|
-
## Scripts
|
54
|
-
|
55
|
-
### test/setup.rb
|
56
|
-
|
57
|
-
Creates two S3 buckets—one in US Standard (`us-east-1`) and one in
|
58
|
-
`$VAGRANT_S3AUTH_REGION_NONSTANDARD`, both with the contents of the box
|
59
|
-
directory.
|
60
|
-
|
61
|
-
Then creates an Atlas (Vagrant Cloud) box with one version with one VirtualBox
|
62
|
-
provider that points to one of the S3 boxes at random.
|
63
|
-
|
64
|
-
### test/cleanup.rb
|
65
|
-
|
66
|
-
Destroys S3 buckets and Atlas box.
|
67
|
-
|
68
|
-
## run.bats
|
69
|
-
|
70
|
-
Attempts to `vagrant box add` the boxes on S3 in every way possible.
|
data/test/box/minimal
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "vagrant-s3auth-mfa/minimal",
|
3
|
-
"description": "This box contains company secrets.",
|
4
|
-
"versions": [{
|
5
|
-
"version": "1.0.1",
|
6
|
-
"providers": [{
|
7
|
-
"name": "virtualbox",
|
8
|
-
"url": "%{box_url}",
|
9
|
-
"checksum_type": "sha1",
|
10
|
-
"checksum": "8ea536dd3092cf159f02405edd44ded5b62ba4e6"
|
11
|
-
}]
|
12
|
-
}]
|
13
|
-
}
|
data/test/box/minimal.box
DELETED
Binary file
|
data/test/box/public-minimal
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"name": "vagrant-s3auth-mfa/public-minimal",
|
3
|
-
"description": "This box contains no company secrets.",
|
4
|
-
"versions": [{
|
5
|
-
"version": "1.0.1",
|
6
|
-
"providers": [{
|
7
|
-
"name": "virtualbox",
|
8
|
-
"url": "%{box_url}",
|
9
|
-
"checksum_type": "sha1",
|
10
|
-
"checksum": "8ea536dd3092cf159f02405edd44ded5b62ba4e6"
|
11
|
-
}]
|
12
|
-
}]
|
13
|
-
}
|
data/test/box/public-minimal.box
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
test/box/minimal.box
|
data/test/cleanup.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'bundler/setup'
|
4
|
-
require 'aws-sdk'
|
5
|
-
|
6
|
-
require_relative 'support'
|
7
|
-
|
8
|
-
[REGION_STANDARD, REGION_NONSTANDARD].each do |region|
|
9
|
-
s3 = Aws::S3::Resource.new(region: region)
|
10
|
-
|
11
|
-
buckets = if ARGV.include?('--all')
|
12
|
-
s3.buckets.select do |b|
|
13
|
-
b.name.include?('vagrant-s3auth-mfa.com') && b.name.include?(region)
|
14
|
-
end
|
15
|
-
else
|
16
|
-
[s3.bucket("#{region}.#{BUCKET}")]
|
17
|
-
end
|
18
|
-
|
19
|
-
buckets.each { |b| b.delete! if b.exists? }
|
20
|
-
end
|
21
|
-
|
22
|
-
atlas = Atlas.new(ATLAS_TOKEN, ATLAS_USERNAME)
|
23
|
-
atlas.delete_box(ATLAS_BOX_NAME)
|
data/test/run.bats
DELETED
@@ -1,147 +0,0 @@
|
|
1
|
-
#!/usr/bin/env bats
|
2
|
-
|
3
|
-
missing_vars=()
|
4
|
-
|
5
|
-
require_var() {
|
6
|
-
[[ "${!1}" ]] || missing_vars+=("$1")
|
7
|
-
}
|
8
|
-
|
9
|
-
require_var AWS_ACCESS_KEY_ID
|
10
|
-
require_var AWS_SECRET_ACCESS_KEY
|
11
|
-
require_var ATLAS_TOKEN
|
12
|
-
require_var ATLAS_USERNAME
|
13
|
-
require_var VAGRANT_S3AUTH_BUCKET
|
14
|
-
require_var VAGRANT_S3AUTH_BOX_BASE
|
15
|
-
require_var VAGRANT_S3AUTH_ATLAS_BOX_NAME
|
16
|
-
require_var VAGRANT_S3AUTH_REGION_NONSTANDARD
|
17
|
-
|
18
|
-
if [[ ${#missing_vars[*]} -gt 0 ]]; then
|
19
|
-
echo "Missing required environment variables:"
|
20
|
-
printf ' %s\n' "${missing_vars[@]}"
|
21
|
-
exit 1
|
22
|
-
fi
|
23
|
-
|
24
|
-
teardown() {
|
25
|
-
bundle exec vagrant box remove "$VAGRANT_S3AUTH_BOX_BASE" > /dev/null 2>&1 || true
|
26
|
-
bundle exec vagrant box remove "public-$VAGRANT_S3AUTH_BOX_BASE" > /dev/null 2>&1 || true
|
27
|
-
bundle exec vagrant box remove "vagrant-s3auth-mfa/$VAGRANT_S3AUTH_BOX_BASE" > /dev/null 2>&1 || true
|
28
|
-
bundle exec vagrant box remove "vagrant-s3auth-mfa/public-$VAGRANT_S3AUTH_BOX_BASE" > /dev/null 2>&1 || true
|
29
|
-
bundle exec vagrant box remove "$ATLAS_USERNAME/$VAGRANT_S3AUTH_ATLAS_BOX_NAME" > /dev/null 2>&1 || true
|
30
|
-
}
|
31
|
-
|
32
|
-
@test "vagrant cloud" {
|
33
|
-
bundle exec vagrant box add "$ATLAS_USERNAME/$VAGRANT_S3AUTH_ATLAS_BOX_NAME"
|
34
|
-
}
|
35
|
-
|
36
|
-
@test "simple box with full path standard url" {
|
37
|
-
bundle exec vagrant box add \
|
38
|
-
--name "$VAGRANT_S3AUTH_BOX_BASE" \
|
39
|
-
"https://s3.amazonaws.com/us-east-1.$VAGRANT_S3AUTH_BUCKET/$VAGRANT_S3AUTH_BOX_BASE.box"
|
40
|
-
}
|
41
|
-
|
42
|
-
@test "public simple box with full path standard url without credentials" {
|
43
|
-
AWS_ACCESS_KEY_ID= \
|
44
|
-
bundle exec vagrant box add \
|
45
|
-
--name "$VAGRANT_S3AUTH_BOX_BASE" \
|
46
|
-
"https://s3.amazonaws.com/us-east-1.$VAGRANT_S3AUTH_BUCKET/public-$VAGRANT_S3AUTH_BOX_BASE.box"
|
47
|
-
}
|
48
|
-
|
49
|
-
@test "simple box with full host standard url" {
|
50
|
-
bundle exec vagrant box add \
|
51
|
-
--name "$VAGRANT_S3AUTH_BOX_BASE" \
|
52
|
-
"https://us-east-1.$VAGRANT_S3AUTH_BUCKET.s3.amazonaws.com/$VAGRANT_S3AUTH_BOX_BASE.box"
|
53
|
-
}
|
54
|
-
|
55
|
-
@test "simple box with shorthand standard url" {
|
56
|
-
bundle exec vagrant box add \
|
57
|
-
--name "$VAGRANT_S3AUTH_BOX_BASE" \
|
58
|
-
"s3://us-east-1.$VAGRANT_S3AUTH_BUCKET/$VAGRANT_S3AUTH_BOX_BASE.box"
|
59
|
-
}
|
60
|
-
|
61
|
-
@test "simple box with full path nonstandard url" {
|
62
|
-
bundle exec vagrant box add \
|
63
|
-
--name "$VAGRANT_S3AUTH_BOX_BASE" \
|
64
|
-
"https://s3-$VAGRANT_S3AUTH_REGION_NONSTANDARD.amazonaws.com/$VAGRANT_S3AUTH_REGION_NONSTANDARD.$VAGRANT_S3AUTH_BUCKET/$VAGRANT_S3AUTH_BOX_BASE.box"
|
65
|
-
}
|
66
|
-
|
67
|
-
@test "public simple box with full path nonstandard url without credentials" {
|
68
|
-
AWS_ACCESS_KEY_ID= \
|
69
|
-
bundle exec vagrant box add \
|
70
|
-
--name "$VAGRANT_S3AUTH_BOX_BASE" \
|
71
|
-
"https://s3-$VAGRANT_S3AUTH_REGION_NONSTANDARD.amazonaws.com/$VAGRANT_S3AUTH_REGION_NONSTANDARD.$VAGRANT_S3AUTH_BUCKET/public-$VAGRANT_S3AUTH_BOX_BASE.box"
|
72
|
-
}
|
73
|
-
|
74
|
-
@test "simple box with full host nonstandard url" {
|
75
|
-
bundle exec vagrant box add \
|
76
|
-
--name "$VAGRANT_S3AUTH_BOX_BASE" \
|
77
|
-
"https://$VAGRANT_S3AUTH_REGION_NONSTANDARD.$VAGRANT_S3AUTH_BUCKET.s3-$VAGRANT_S3AUTH_REGION_NONSTANDARD.amazonaws.com/$VAGRANT_S3AUTH_BOX_BASE.box"
|
78
|
-
}
|
79
|
-
|
80
|
-
@test "simple box with shorthand nonstandard url" {
|
81
|
-
bundle exec vagrant box add \
|
82
|
-
--name "$VAGRANT_S3AUTH_BOX_BASE" \
|
83
|
-
"s3://$VAGRANT_S3AUTH_REGION_NONSTANDARD.$VAGRANT_S3AUTH_BUCKET/$VAGRANT_S3AUTH_BOX_BASE.box"
|
84
|
-
}
|
85
|
-
|
86
|
-
@test "metadata box with full path standard url" {
|
87
|
-
bundle exec vagrant box add \
|
88
|
-
--name "vagrant-s3auth-mfa/$VAGRANT_S3AUTH_BOX_BASE" \
|
89
|
-
"https://s3.amazonaws.com/us-east-1.$VAGRANT_S3AUTH_BUCKET/$VAGRANT_S3AUTH_BOX_BASE"
|
90
|
-
}
|
91
|
-
|
92
|
-
@test "public metadata box with full path standard url without credentials" {
|
93
|
-
AWS_ACCESS_KEY_ID= \
|
94
|
-
bundle exec vagrant box add \
|
95
|
-
--name "vagrant-s3auth-mfa/public-$VAGRANT_S3AUTH_BOX_BASE" \
|
96
|
-
"https://s3.amazonaws.com/us-east-1.$VAGRANT_S3AUTH_BUCKET/public-$VAGRANT_S3AUTH_BOX_BASE"
|
97
|
-
}
|
98
|
-
|
99
|
-
@test "metadata box with full host standard url" {
|
100
|
-
bundle exec vagrant box add \
|
101
|
-
--name "vagrant-s3auth-mfa/$VAGRANT_S3AUTH_BOX_BASE" \
|
102
|
-
"https://us-east-1.$VAGRANT_S3AUTH_BUCKET.s3.amazonaws.com/$VAGRANT_S3AUTH_BOX_BASE"
|
103
|
-
}
|
104
|
-
|
105
|
-
@test "metadata box with shorthand standard url" {
|
106
|
-
bundle exec vagrant box add \
|
107
|
-
--name "vagrant-s3auth-mfa/$VAGRANT_S3AUTH_BOX_BASE" \
|
108
|
-
"s3://us-east-1.$VAGRANT_S3AUTH_BUCKET/$VAGRANT_S3AUTH_BOX_BASE"
|
109
|
-
}
|
110
|
-
|
111
|
-
@test "metadata box with full path nonstandard url" {
|
112
|
-
bundle exec vagrant box add \
|
113
|
-
--name "vagrant-s3auth-mfa/$VAGRANT_S3AUTH_BOX_BASE" \
|
114
|
-
"https://s3-$VAGRANT_S3AUTH_REGION_NONSTANDARD.amazonaws.com/$VAGRANT_S3AUTH_REGION_NONSTANDARD.$VAGRANT_S3AUTH_BUCKET/$VAGRANT_S3AUTH_BOX_BASE"
|
115
|
-
}
|
116
|
-
|
117
|
-
@test "public metadata box with full path nonstandard url without credentials" {
|
118
|
-
AWS_ACCESS_KEY_ID= \
|
119
|
-
bundle exec vagrant box add \
|
120
|
-
--name "vagrant-s3auth-mfa/public-$VAGRANT_S3AUTH_BOX_BASE" \
|
121
|
-
"https://s3-$VAGRANT_S3AUTH_REGION_NONSTANDARD.amazonaws.com/$VAGRANT_S3AUTH_REGION_NONSTANDARD.$VAGRANT_S3AUTH_BUCKET/public-$VAGRANT_S3AUTH_BOX_BASE"
|
122
|
-
}
|
123
|
-
|
124
|
-
|
125
|
-
@test "metadata box with full host nonstandard url" {
|
126
|
-
bundle exec vagrant box add \
|
127
|
-
--name "vagrant-s3auth-mfa/$VAGRANT_S3AUTH_BOX_BASE" \
|
128
|
-
"https://$VAGRANT_S3AUTH_REGION_NONSTANDARD.$VAGRANT_S3AUTH_BUCKET.s3-$VAGRANT_S3AUTH_REGION_NONSTANDARD.amazonaws.com/$VAGRANT_S3AUTH_BOX_BASE"
|
129
|
-
}
|
130
|
-
|
131
|
-
@test "metadata box with shorthand nonstandard url" {
|
132
|
-
bundle exec vagrant box add \
|
133
|
-
--name "vagrant-s3auth-mfa/$VAGRANT_S3AUTH_BOX_BASE" \
|
134
|
-
"s3://$VAGRANT_S3AUTH_REGION_NONSTANDARD.$VAGRANT_S3AUTH_BUCKET/$VAGRANT_S3AUTH_BOX_BASE"
|
135
|
-
}
|
136
|
-
|
137
|
-
@test "garbage shorthand url" {
|
138
|
-
run bundle exec vagrant box add --name "$VAGRANT_S3AUTH_BOX_BASE" s3://smoogedydoop
|
139
|
-
[[ "$status" -eq 1 ]]
|
140
|
-
[[ "$output" == *"Malformed shorthand S3 box URL"* ]]
|
141
|
-
}
|
142
|
-
|
143
|
-
@test "garbage full url" {
|
144
|
-
run bundle exec vagrant box add --name "$VAGRANT_S3AUTH_BOX_BASE" https://smoogedydoop
|
145
|
-
[[ "$status" -eq 1 ]]
|
146
|
-
[[ "$output" == *"error occurred while downloading the remote file"* ]]
|
147
|
-
}
|
data/test/setup.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'bundler/setup'
|
4
|
-
require 'aws-sdk'
|
5
|
-
|
6
|
-
require_relative 'support'
|
7
|
-
|
8
|
-
ROOT = Pathname.new(File.dirname(__FILE__))
|
9
|
-
|
10
|
-
box_urls = [REGION_STANDARD, REGION_NONSTANDARD].flat_map do |region|
|
11
|
-
s3 = Aws::S3::Resource.new(region: region)
|
12
|
-
bucket = s3.create_bucket(bucket: "#{region}.#{BUCKET}")
|
13
|
-
|
14
|
-
[BOX_BASE, 'public-' + BOX_BASE].flat_map do |box_name|
|
15
|
-
box = bucket.object("#{box_name}.box")
|
16
|
-
box.upload_file(ROOT + Pathname.new("box/#{box_name}.box"))
|
17
|
-
box.acl.put(acl: 'public-read') if box_name.start_with?('public')
|
18
|
-
|
19
|
-
metadata_string = format(File.read(ROOT + Pathname.new("box/#{box_name}")),
|
20
|
-
box_url: box.public_url)
|
21
|
-
|
22
|
-
metadata = bucket.object(box_name)
|
23
|
-
metadata.put(body: metadata_string, content_type: 'application/json')
|
24
|
-
metadata.acl.put(acl: 'public-read') if box_name.start_with?('public')
|
25
|
-
|
26
|
-
box.public_url
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
atlas = Atlas.new(ATLAS_TOKEN, ATLAS_USERNAME)
|
31
|
-
atlas.create_box(ATLAS_BOX_NAME)
|
32
|
-
atlas.create_version(ATLAS_BOX_NAME, '1.0.1')
|
33
|
-
atlas.create_provider(ATLAS_BOX_NAME, '1.0.1', box_urls.sample)
|
34
|
-
atlas.release_version(ATLAS_BOX_NAME, '1.0.1')
|
data/test/support.rb
DELETED
@@ -1,82 +0,0 @@
|
|
1
|
-
require 'http'
|
2
|
-
|
3
|
-
BOX_BASE = ENV['VAGRANT_S3AUTH_BOX_BASE'].freeze
|
4
|
-
BUCKET = ENV['VAGRANT_S3AUTH_BUCKET'].freeze
|
5
|
-
REGION_STANDARD = 'us-east-1'.freeze
|
6
|
-
REGION_NONSTANDARD = ENV['VAGRANT_S3AUTH_REGION_NONSTANDARD'].freeze
|
7
|
-
|
8
|
-
ATLAS_TOKEN = ENV['ATLAS_TOKEN'].freeze
|
9
|
-
ATLAS_USERNAME = ENV['ATLAS_USERNAME'].freeze
|
10
|
-
ATLAS_BOX_NAME = ENV['VAGRANT_S3AUTH_ATLAS_BOX_NAME'].freeze
|
11
|
-
|
12
|
-
class Atlas
|
13
|
-
BASE_URL = 'https://app.vagrantup.com/api/v1'.freeze
|
14
|
-
|
15
|
-
BOX_CREATE_URL = "#{BASE_URL}/boxes".freeze
|
16
|
-
BOX_RESOURCE_URL = "#{BASE_URL}/box/%<username>s/%<box_name>s".freeze
|
17
|
-
|
18
|
-
VERSION_CREATE_URL = "#{BOX_RESOURCE_URL}/versions".freeze
|
19
|
-
VERSION_RESOURCE_URL = "#{BOX_RESOURCE_URL}/version/%<version>s".freeze
|
20
|
-
VERSION_RELEASE_URL = "#{VERSION_RESOURCE_URL}/release".freeze
|
21
|
-
|
22
|
-
PROVIDER_CREATE_URL = "#{VERSION_RESOURCE_URL}/providers".freeze
|
23
|
-
PROVIDER_RESOURCE_URL = "#{VERSION_RESOURCE_URL}/provider/%<provider_name>s".freeze
|
24
|
-
|
25
|
-
attr_accessor :provider
|
26
|
-
|
27
|
-
def initialize(token, username)
|
28
|
-
raise if !token || token.empty?
|
29
|
-
raise if !username || username.empty?
|
30
|
-
|
31
|
-
@token = token
|
32
|
-
@username = username
|
33
|
-
@provider = 'virtualbox'
|
34
|
-
end
|
35
|
-
|
36
|
-
def create_box(box_name)
|
37
|
-
post(BOX_CREATE_URL, data: { box: { name: box_name, is_private: false } })
|
38
|
-
end
|
39
|
-
|
40
|
-
def delete_box(box_name)
|
41
|
-
url_params = { box_name: box_name }
|
42
|
-
delete(BOX_RESOURCE_URL, url_params: url_params)
|
43
|
-
end
|
44
|
-
|
45
|
-
def create_version(box_name, version)
|
46
|
-
post(VERSION_CREATE_URL,
|
47
|
-
data: { version: { version: version } },
|
48
|
-
url_params: { box_name: box_name })
|
49
|
-
end
|
50
|
-
|
51
|
-
def release_version(box_name, version)
|
52
|
-
put(VERSION_RELEASE_URL,
|
53
|
-
url_params: { box_name: box_name, version: version })
|
54
|
-
end
|
55
|
-
|
56
|
-
def create_provider(box_name, version, url)
|
57
|
-
post(PROVIDER_CREATE_URL,
|
58
|
-
data: { provider: { name: @provider, url: url } },
|
59
|
-
url_params: { box_name: box_name, version: version })
|
60
|
-
end
|
61
|
-
|
62
|
-
def request(method, url, options)
|
63
|
-
url_params = (options[:url_params] || {}).merge(username: @username)
|
64
|
-
data = (options[:data] || {})
|
65
|
-
|
66
|
-
url = (url % url_params) + "?access_token=#{@token}"
|
67
|
-
response = HTTP.request(method, url, json: data)
|
68
|
-
raise response unless response.code >= 200 && response.code < 400
|
69
|
-
end
|
70
|
-
|
71
|
-
def post(url, options)
|
72
|
-
request(:post, url, options)
|
73
|
-
end
|
74
|
-
|
75
|
-
def put(url, options)
|
76
|
-
request(:put, url, options)
|
77
|
-
end
|
78
|
-
|
79
|
-
def delete(url, options)
|
80
|
-
request(:delete, url, options)
|
81
|
-
end
|
82
|
-
end
|