berkshelf 6.2.0 → 6.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +38 -6
- data/Gemfile +0 -5
- data/Gemfile.lock +13 -83
- data/berkshelf.gemspec +1 -2
- data/features/commands/contingent.feature +0 -1
- data/features/commands/install.feature +8 -19
- data/features/commands/outdated.feature +0 -3
- data/features/commands/vendor.feature +0 -2
- data/features/json_formatter.feature +5 -8
- data/features/support/env.rb +7 -5
- data/lib/berkshelf/api-client.rb +1 -0
- data/lib/berkshelf/api_client.rb +24 -0
- data/lib/berkshelf/api_client/chef_server_connection.rb +28 -0
- data/lib/berkshelf/api_client/connection.rb +55 -0
- data/lib/berkshelf/api_client/errors.rb +10 -0
- data/lib/berkshelf/api_client/remote_cookbook.rb +54 -0
- data/lib/berkshelf/api_client/version.rb +5 -0
- data/lib/berkshelf/ridley_compat.rb +78 -0
- data/lib/berkshelf/version.rb +1 -1
- data/spec/spec_helper.rb +1 -5
- data/spec/unit/berkshelf/berkshelf/api_client/connection_spec.rb +100 -0
- data/spec/unit/berkshelf/berkshelf/api_client/remote_cookbook_spec.rb +23 -0
- data/spec/unit/berkshelf/berkshelf/api_client_spec.rb +9 -0
- data/spec/unit/berkshelf/resolver/graph_spec.rb +8 -7
- metadata +30 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25a14291bb2c9d50f4cb89888e7c71e4d06a4bef
|
4
|
+
data.tar.gz: 1fae554e27d90927e4568a808a4694d520306d77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91918e3d292165f595c98a4209eb9e88ad55305eb8e799b7b0af1e33512503332dd7bd2fc15e43b5abb1eb57221d46b2e8737814c9cf33e0f302a6eec86871f3
|
7
|
+
data.tar.gz: 6c0bcf5fa299bfd5722432252aa91a5cde776674b13698f0c12335ec956a478ba59aca6bc08081e0c5223672f3c48fcc6dfaafc475942e7e47eb662217b0953d
|
data/CHANGELOG.md
CHANGED
@@ -1,12 +1,44 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
-
## [
|
4
|
-
[Full Changelog](https://github.com/berkshelf/berkshelf/compare/v6.
|
3
|
+
## [v6.2.0](https://github.com/berkshelf/berkshelf/tree/v6.2.0) (2017-06-22)
|
4
|
+
[Full Changelog](https://github.com/berkshelf/berkshelf/compare/v6.1.1...v6.2.0)
|
5
5
|
|
6
|
-
|
6
|
+
**Merged pull requests:**
|
7
|
+
|
8
|
+
- pull in berkshelf-api-client and bump deps [\#1707](https://github.com/berkshelf/berkshelf/pull/1707) ([lamont-granquist](https://github.com/lamont-granquist))
|
9
|
+
|
10
|
+
## [v6.1.1](https://github.com/berkshelf/berkshelf/tree/v6.1.1) (2017-06-20)
|
11
|
+
[Full Changelog](https://github.com/berkshelf/berkshelf/compare/v6.1.0...v6.1.1)
|
12
|
+
|
13
|
+
**Merged pull requests:**
|
14
|
+
|
15
|
+
- bumping cookstyle deps and others [\#1708](https://github.com/berkshelf/berkshelf/pull/1708) ([lamont-granquist](https://github.com/lamont-granquist))
|
16
|
+
|
17
|
+
## [v6.1.0](https://github.com/berkshelf/berkshelf/tree/v6.1.0) (2017-05-31)
|
18
|
+
[Full Changelog](https://github.com/berkshelf/berkshelf/compare/v6.0.1...v6.1.0)
|
19
|
+
|
20
|
+
**Merged pull requests:**
|
21
|
+
|
22
|
+
- Release 6.1.0 [\#1704](https://github.com/berkshelf/berkshelf/pull/1704) ([thommay](https://github.com/thommay))
|
23
|
+
- remove TK dep and undocumented 'berks test' command [\#1702](https://github.com/berkshelf/berkshelf/pull/1702) ([lamont-granquist](https://github.com/lamont-granquist))
|
24
|
+
- remove direct use of buff-shell\_out [\#1701](https://github.com/berkshelf/berkshelf/pull/1701) ([lamont-granquist](https://github.com/lamont-granquist))
|
25
|
+
- guard seems to be a lot more trouble than its worth [\#1700](https://github.com/berkshelf/berkshelf/pull/1700) ([lamont-granquist](https://github.com/lamont-granquist))
|
26
|
+
- bump deps \(faraday+ridley\) [\#1699](https://github.com/berkshelf/berkshelf/pull/1699) ([lamont-granquist](https://github.com/lamont-granquist))
|
27
|
+
- replace celluloid with concurrent-ruby futures [\#1698](https://github.com/berkshelf/berkshelf/pull/1698) ([lamont-granquist](https://github.com/lamont-granquist))
|
28
|
+
- Switch off open-uri for community site downloads [\#1697](https://github.com/berkshelf/berkshelf/pull/1697) ([coderanger](https://github.com/coderanger))
|
29
|
+
- Add chef\_repo source [\#1696](https://github.com/berkshelf/berkshelf/pull/1696) ([coderanger](https://github.com/coderanger))
|
30
|
+
- Pass along an artifactory\_api\_key attribute from a Chef config [\#1693](https://github.com/berkshelf/berkshelf/pull/1693) ([RoboticCheese](https://github.com/RoboticCheese))
|
31
|
+
- add chefstyle enforcement [\#1663](https://github.com/berkshelf/berkshelf/pull/1663) ([lamont-granquist](https://github.com/lamont-granquist))
|
32
|
+
|
33
|
+
## [v6.0.1](https://github.com/berkshelf/berkshelf/tree/v6.0.1) (2017-05-17)
|
34
|
+
[Full Changelog](https://github.com/berkshelf/berkshelf/compare/v6.0.0...v6.0.1)
|
35
|
+
|
36
|
+
**Merged pull requests:**
|
37
|
+
|
38
|
+
- update travis rvm versions [\#1692](https://github.com/berkshelf/berkshelf/pull/1692) ([thommay](https://github.com/thommay))
|
7
39
|
|
8
|
-
## [
|
9
|
-
[Full Changelog](https://github.com/berkshelf/berkshelf/compare/v5.6.5...
|
40
|
+
## [v6.0.0](https://github.com/berkshelf/berkshelf/tree/v6.0.0) (2017-05-17)
|
41
|
+
[Full Changelog](https://github.com/berkshelf/berkshelf/compare/v5.6.5...v6.0.0)
|
10
42
|
|
11
43
|
**Merged pull requests:**
|
12
44
|
|
@@ -1439,4 +1471,4 @@
|
|
1439
1471
|
|
1440
1472
|
|
1441
1473
|
|
1442
|
-
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
1474
|
+
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
data/Gemfile
CHANGED
@@ -22,10 +22,5 @@ group :development do
|
|
22
22
|
gem "webmock", ">= 1.11"
|
23
23
|
gem "yard", ">= 0.8"
|
24
24
|
gem "http", ">= 0.9.8"
|
25
|
-
gem "activesupport", "~> 4.0" # pinning for ruby 2.1.x
|
26
25
|
gem "chefstyle"
|
27
26
|
end
|
28
|
-
|
29
|
-
group :test do
|
30
|
-
gem "berkshelf-api", git: "https://github.com/berkshelf/berkshelf-api.git", ref: "9fb3d95779c4ff72b0074072105caaf70b978bf0"
|
31
|
-
end
|
data/Gemfile.lock
CHANGED
@@ -1,30 +1,10 @@
|
|
1
|
-
GIT
|
2
|
-
remote: https://github.com/berkshelf/berkshelf-api.git
|
3
|
-
revision: 9fb3d95779c4ff72b0074072105caaf70b978bf0
|
4
|
-
ref: 9fb3d95779c4ff72b0074072105caaf70b978bf0
|
5
|
-
specs:
|
6
|
-
berkshelf-api (3.0.0)
|
7
|
-
archive (= 0.0.6)
|
8
|
-
buff-config (>= 1.0, < 3.0)
|
9
|
-
celluloid (~> 0.16)
|
10
|
-
celluloid-io (~> 0.16)
|
11
|
-
grape (~> 0.14)
|
12
|
-
grape-msgpack (~> 0.1)
|
13
|
-
hashie (>= 2.0.4, < 4.0.0)
|
14
|
-
octokit (>= 3.0.0, < 5.0.0)
|
15
|
-
reel (~> 0.6.0)
|
16
|
-
ridley (>= 4.0, < 6.0)
|
17
|
-
semverse (>= 1.0, < 3.0)
|
18
|
-
varia_model (~> 0.4)
|
19
|
-
|
20
1
|
PATH
|
21
2
|
remote: .
|
22
3
|
specs:
|
23
|
-
berkshelf (6.2.
|
24
|
-
addressable (~> 2.3, >= 2.3.4)
|
25
|
-
berkshelf-api-client (>= 4.0.0)
|
4
|
+
berkshelf (6.2.1)
|
26
5
|
buff-config (~> 2.0)
|
27
6
|
buff-extensions (~> 2.0)
|
7
|
+
chef (>= 12.7.2)
|
28
8
|
cleanroom (~> 1.0)
|
29
9
|
concurrent-ruby (~> 1.0)
|
30
10
|
faraday (~> 0.9)
|
@@ -41,15 +21,13 @@ PATH
|
|
41
21
|
GEM
|
42
22
|
remote: https://rubygems.org/
|
43
23
|
specs:
|
44
|
-
activesupport (
|
24
|
+
activesupport (5.1.2)
|
25
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
45
26
|
i18n (~> 0.7)
|
46
27
|
minitest (~> 5.1)
|
47
|
-
thread_safe (~> 0.3, >= 0.3.4)
|
48
28
|
tzinfo (~> 1.1)
|
49
29
|
addressable (2.5.1)
|
50
30
|
public_suffix (~> 2.0, >= 2.0.2)
|
51
|
-
archive (0.0.6)
|
52
|
-
ffi (~> 1.9.3)
|
53
31
|
aruba (0.14.2)
|
54
32
|
childprocess (~> 0.5.6)
|
55
33
|
contracts (~> 0.9)
|
@@ -58,12 +36,6 @@ GEM
|
|
58
36
|
rspec-expectations (>= 2.99)
|
59
37
|
thor (~> 0.19)
|
60
38
|
ast (2.3.0)
|
61
|
-
axiom-types (0.1.1)
|
62
|
-
descendants_tracker (~> 0.0.4)
|
63
|
-
ice_nine (~> 0.11.0)
|
64
|
-
thread_safe (~> 0.3, >= 0.3.1)
|
65
|
-
berkshelf-api-client (4.0.0)
|
66
|
-
chef (>= 12.0)
|
67
39
|
buff-config (2.0.0)
|
68
40
|
buff-extensions (~> 2.0)
|
69
41
|
varia_model (~> 0.6)
|
@@ -78,10 +50,10 @@ GEM
|
|
78
50
|
celluloid-io (0.16.2)
|
79
51
|
celluloid (>= 0.16.0)
|
80
52
|
nio4r (>= 1.1.0)
|
81
|
-
chef (13.
|
53
|
+
chef (13.2.20)
|
82
54
|
addressable
|
83
55
|
bundler (>= 1.10)
|
84
|
-
chef-config (= 13.
|
56
|
+
chef-config (= 13.2.20)
|
85
57
|
chef-zero (>= 13.0)
|
86
58
|
diff-lcs (~> 1.2, >= 1.2.4)
|
87
59
|
erubis (~> 2.7)
|
@@ -108,12 +80,12 @@ GEM
|
|
108
80
|
specinfra (~> 2.10)
|
109
81
|
syslog-logger (~> 1.6)
|
110
82
|
uuidtools (~> 2.1.5)
|
111
|
-
chef-config (13.
|
83
|
+
chef-config (13.2.20)
|
112
84
|
addressable
|
113
85
|
fuzzyurl
|
114
86
|
mixlib-config (~> 2.0)
|
115
87
|
mixlib-shellout (~> 2.0)
|
116
|
-
chef-zero (13.
|
88
|
+
chef-zero (13.1.0)
|
117
89
|
ffi-yajl (~> 2.2)
|
118
90
|
hashie (>= 2.0, < 4.0)
|
119
91
|
mixlib-log (~> 1.3)
|
@@ -124,8 +96,6 @@ GEM
|
|
124
96
|
childprocess (0.5.9)
|
125
97
|
ffi (~> 1.0, >= 1.0.11)
|
126
98
|
cleanroom (1.0.0)
|
127
|
-
coercible (1.0.0)
|
128
|
-
descendants_tracker (~> 0.0.1)
|
129
99
|
concurrent-ruby (1.0.5)
|
130
100
|
contracts (0.16.0)
|
131
101
|
crack (0.4.3)
|
@@ -145,12 +115,9 @@ GEM
|
|
145
115
|
dep_selector (1.0.5)
|
146
116
|
dep-selector-libgecode (~> 1.0)
|
147
117
|
ffi (~> 1.9)
|
148
|
-
descendants_tracker (0.0.4)
|
149
|
-
thread_safe (~> 0.3, >= 0.3.1)
|
150
118
|
diff-lcs (1.3)
|
151
119
|
domain_name (0.5.20170404)
|
152
120
|
unf (>= 0.0.5, < 1.0.0)
|
153
|
-
equalizer (0.0.11)
|
154
121
|
erubis (2.7.0)
|
155
122
|
faraday (0.12.1)
|
156
123
|
multipart-post (>= 1.2, < 3)
|
@@ -172,21 +139,8 @@ GEM
|
|
172
139
|
rainbow (>= 2.1)
|
173
140
|
rake (>= 10.0)
|
174
141
|
retriable (~> 2.1)
|
175
|
-
grape (0.19.2)
|
176
|
-
activesupport
|
177
|
-
builder
|
178
|
-
hashie (>= 2.1.0)
|
179
|
-
multi_json (>= 1.3.2)
|
180
|
-
multi_xml (>= 0.5.2)
|
181
|
-
mustermann-grape (~> 1.0.0)
|
182
|
-
rack (>= 1.3.0)
|
183
|
-
rack-accept
|
184
|
-
virtus (>= 1.0.0)
|
185
|
-
grape-msgpack (0.2.0)
|
186
|
-
grape (>= 0.16.1)
|
187
|
-
msgpack (>= 0.7.4)
|
188
142
|
hashdiff (0.3.4)
|
189
|
-
hashie (3.5.
|
143
|
+
hashie (3.5.6)
|
190
144
|
highline (1.7.8)
|
191
145
|
hitimes (1.2.5)
|
192
146
|
http (2.2.2)
|
@@ -199,9 +153,8 @@ GEM
|
|
199
153
|
http-form_data (1.0.3)
|
200
154
|
http_parser.rb (0.6.0)
|
201
155
|
httpclient (2.8.3)
|
202
|
-
i18n (0.8.
|
203
|
-
|
204
|
-
iniparse (1.4.3)
|
156
|
+
i18n (0.8.6)
|
157
|
+
iniparse (1.4.4)
|
205
158
|
ipaddress (0.8.3)
|
206
159
|
iso8601 (0.9.1)
|
207
160
|
json (2.1.0)
|
@@ -217,14 +170,9 @@ GEM
|
|
217
170
|
mixlib-log (1.7.1)
|
218
171
|
mixlib-shellout (2.2.7)
|
219
172
|
molinillo (0.5.7)
|
220
|
-
msgpack (1.1.0)
|
221
173
|
multi_json (1.12.1)
|
222
174
|
multi_test (0.1.2)
|
223
|
-
multi_xml (0.6.0)
|
224
175
|
multipart-post (2.0.0)
|
225
|
-
mustermann (1.0.0)
|
226
|
-
mustermann-grape (1.0.0)
|
227
|
-
mustermann (~> 1.0.0)
|
228
176
|
net-scp (1.2.1)
|
229
177
|
net-ssh (>= 2.6.5)
|
230
178
|
net-sftp (2.1.2)
|
@@ -239,7 +187,7 @@ GEM
|
|
239
187
|
nio4r (2.1.0)
|
240
188
|
octokit (4.7.0)
|
241
189
|
sawyer (~> 0.8.0, >= 0.5.3)
|
242
|
-
ohai (13.
|
190
|
+
ohai (13.2.0)
|
243
191
|
chef-config (>= 12.5.0.alpha.1, < 14)
|
244
192
|
ffi (~> 1.9)
|
245
193
|
ffi-yajl (~> 2.2)
|
@@ -259,17 +207,9 @@ GEM
|
|
259
207
|
proxifier (1.0.3)
|
260
208
|
public_suffix (2.0.5)
|
261
209
|
rack (2.0.3)
|
262
|
-
rack-accept (0.4.5)
|
263
|
-
rack (>= 0.4)
|
264
210
|
rainbow (2.2.2)
|
265
211
|
rake
|
266
212
|
rake (12.0.0)
|
267
|
-
reel (0.6.1)
|
268
|
-
celluloid (>= 0.15.1)
|
269
|
-
celluloid-io (>= 0.15.0)
|
270
|
-
http (>= 0.6.0.pre)
|
271
|
-
http_parser.rb (>= 0.6.0)
|
272
|
-
websocket-driver (>= 0.5.1)
|
273
213
|
retriable (2.1.0)
|
274
214
|
retryable (2.0.4)
|
275
215
|
ridley (5.1.1)
|
@@ -331,7 +271,7 @@ GEM
|
|
331
271
|
solve (3.1.0)
|
332
272
|
molinillo (>= 0.5)
|
333
273
|
semverse (>= 1.1, < 3.0)
|
334
|
-
specinfra (2.
|
274
|
+
specinfra (2.69.0)
|
335
275
|
net-scp
|
336
276
|
net-ssh (>= 2.7, < 5.0)
|
337
277
|
net-telnet
|
@@ -352,18 +292,10 @@ GEM
|
|
352
292
|
varia_model (0.6.0)
|
353
293
|
buff-extensions (~> 2.0)
|
354
294
|
hashie (>= 2.0.2, < 4.0.0)
|
355
|
-
virtus (1.0.5)
|
356
|
-
axiom-types (~> 0.1)
|
357
|
-
coercible (~> 1.0)
|
358
|
-
descendants_tracker (~> 0.0, >= 0.0.3)
|
359
|
-
equalizer (~> 0.0, >= 0.0.9)
|
360
295
|
webmock (3.0.1)
|
361
296
|
addressable (>= 2.3.6)
|
362
297
|
crack (>= 0.3.2)
|
363
298
|
hashdiff
|
364
|
-
websocket-driver (0.6.5)
|
365
|
-
websocket-extensions (>= 0.1.0)
|
366
|
-
websocket-extensions (0.1.2)
|
367
299
|
wmi-lite (1.0.0)
|
368
300
|
yard (0.9.9)
|
369
301
|
|
@@ -371,10 +303,8 @@ PLATFORMS
|
|
371
303
|
ruby
|
372
304
|
|
373
305
|
DEPENDENCIES
|
374
|
-
activesupport (~> 4.0)
|
375
306
|
aruba (>= 0.10.0)
|
376
307
|
berkshelf!
|
377
|
-
berkshelf-api!
|
378
308
|
chef-zero (>= 4.0)
|
379
309
|
chefstyle
|
380
310
|
dep_selector (>= 1.0)
|
data/berkshelf.gemspec
CHANGED
@@ -30,8 +30,6 @@ Gem::Specification.new do |s|
|
|
30
30
|
s.required_ruby_version = ">= 2.3.1"
|
31
31
|
s.required_rubygems_version = ">= 2.0.0"
|
32
32
|
|
33
|
-
s.add_dependency "addressable", "~> 2.3", ">= 2.3.4"
|
34
|
-
s.add_dependency "berkshelf-api-client", ">= 4.0.0"
|
35
33
|
s.add_dependency "buff-config", "~> 2.0"
|
36
34
|
s.add_dependency "buff-extensions", "~> 2.0"
|
37
35
|
s.add_dependency "mixlib-shellout", "~> 2.0"
|
@@ -46,4 +44,5 @@ Gem::Specification.new do |s|
|
|
46
44
|
s.add_dependency "octokit", "~> 4.0"
|
47
45
|
s.add_dependency "mixlib-archive", "~> 0.4"
|
48
46
|
s.add_dependency "concurrent-ruby", "~> 1.0"
|
47
|
+
s.add_dependency "chef", ">= 12.7.2"
|
49
48
|
end
|
@@ -1,6 +1,5 @@
|
|
1
1
|
Feature: berks install
|
2
2
|
Background:
|
3
|
-
* the Berkshelf API server's cache is empty
|
4
3
|
* the Chef Server is empty
|
5
4
|
* the cookbook store is empty
|
6
5
|
|
@@ -12,7 +11,6 @@ Feature: berks install
|
|
12
11
|
And the Chef Server has cookbooks:
|
13
12
|
| berkshelf | 1.0.0 |
|
14
13
|
| berkshelf | 2.0.0 |
|
15
|
-
And the Berkshelf API server's cache is up to date
|
16
14
|
When I successfully run `berks install`
|
17
15
|
Then the output should contain:
|
18
16
|
"""
|
@@ -29,7 +27,6 @@ Feature: berks install
|
|
29
27
|
And the Chef Server has cookbooks:
|
30
28
|
| berkshelf | 1.0.0 |
|
31
29
|
| berkshelf | 2.0.0 |
|
32
|
-
And the Berkshelf API server's cache is up to date
|
33
30
|
When I successfully run `berks install`
|
34
31
|
Then the output should contain:
|
35
32
|
"""
|
@@ -52,7 +49,6 @@ Feature: berks install
|
|
52
49
|
And the Chef Server has cookbooks:
|
53
50
|
| ruby | 1.0.0 |
|
54
51
|
| elixir | 1.0.0 |
|
55
|
-
And the Berkshelf API server's cache is up to date
|
56
52
|
When I successfully run `berks install`
|
57
53
|
Then the output should contain "Installing elixir (1.0.0)"
|
58
54
|
And the output should contain "Installing ruby (1.0.0)"
|
@@ -71,7 +67,6 @@ Feature: berks install
|
|
71
67
|
| hostsfile | = 1.0.1 |
|
72
68
|
And the cookbook store has the cookbooks:
|
73
69
|
| hostsfile | 1.0.1 |
|
74
|
-
And the Berkshelf API server's cache is up to date
|
75
70
|
When I successfully run `berks install`
|
76
71
|
Then the output should contain:
|
77
72
|
"""
|
@@ -135,7 +130,6 @@ Feature: berks install
|
|
135
130
|
"""
|
136
131
|
cookbook 'example_cookbook', path: '../../spec/fixtures/cookbooks/example_cookbook-0.5.0'
|
137
132
|
"""
|
138
|
-
And the Berkshelf API server's cache is up to date
|
139
133
|
When I successfully run `berks install`
|
140
134
|
Then the output should contain:
|
141
135
|
"""
|
@@ -160,7 +154,6 @@ Feature: berks install
|
|
160
154
|
"""
|
161
155
|
cookbook 'example_cookbook', path: '../../spec/fixtures/cookbooks/example_cookbook-0.5.0'
|
162
156
|
"""
|
163
|
-
And the Berkshelf API server's cache is up to date
|
164
157
|
When I successfully run `berks install`
|
165
158
|
Then the output should contain:
|
166
159
|
"""
|
@@ -175,7 +168,6 @@ Feature: berks install
|
|
175
168
|
cookbook 'example_cookbook', path: '../../spec/fixtures/cookbooks/example_cookbook-0.5.0'
|
176
169
|
cookbook 'other_cookbook'
|
177
170
|
"""
|
178
|
-
And the Berkshelf API server's cache is up to date
|
179
171
|
When I run `berks install`
|
180
172
|
Then the output should contain:
|
181
173
|
"""
|
@@ -204,7 +196,7 @@ Feature: berks install
|
|
204
196
|
And the output should contain:
|
205
197
|
"""
|
206
198
|
Fetching 'berkshelf-cookbook-fixture' from git://github.com/RiotGames/berkshelf-cookbook-fixture.git (at master)
|
207
|
-
Fetching cookbook index from http://127.0.0.1:
|
199
|
+
Fetching cookbook index from http://127.0.0.1:26310...
|
208
200
|
Using berkshelf-cookbook-fixture (1.0.0) from git://github.com/RiotGames/berkshelf-cookbook-fixture.git (at master)
|
209
201
|
"""
|
210
202
|
|
@@ -235,7 +227,7 @@ Feature: berks install
|
|
235
227
|
And the output should contain:
|
236
228
|
"""
|
237
229
|
Fetching 'berkshelf-cookbook-fixture' from https://github.com/RiotGames/berkshelf-cookbook-fixture.git (at rel/cookbooks/berkshelf-cookbook-fixture)
|
238
|
-
Fetching cookbook index from http://127.0.0.1:
|
230
|
+
Fetching cookbook index from http://127.0.0.1:26310...
|
239
231
|
Using berkshelf-cookbook-fixture (1.0.0) from https://github.com/RiotGames/berkshelf-cookbook-fixture.git (at rel/cookbooks/berkshelf-cookbook-fixture)
|
240
232
|
"""
|
241
233
|
|
@@ -263,7 +255,7 @@ Feature: berks install
|
|
263
255
|
And the output should contain:
|
264
256
|
"""
|
265
257
|
Fetching 'berkshelf-cookbook-fixture' from git://github.com/RiotGames/berkshelf-cookbook-fixture.git (at v0.2.0)
|
266
|
-
Fetching cookbook index from http://127.0.0.1:
|
258
|
+
Fetching cookbook index from http://127.0.0.1:26310...
|
267
259
|
Using berkshelf-cookbook-fixture (0.2.0) from git://github.com/RiotGames/berkshelf-cookbook-fixture.git (at v0.2.0)
|
268
260
|
"""
|
269
261
|
|
@@ -278,7 +270,7 @@ Feature: berks install
|
|
278
270
|
And the output should contain:
|
279
271
|
"""
|
280
272
|
Fetching 'berkshelf-cookbook-fixture' from git://github.com/RiotGames/berkshelf-cookbook-fixture.git (at 70a527e)
|
281
|
-
Fetching cookbook index from http://127.0.0.1:
|
273
|
+
Fetching cookbook index from http://127.0.0.1:26310...
|
282
274
|
Using berkshelf-cookbook-fixture (0.2.0) from git://github.com/RiotGames/berkshelf-cookbook-fixture.git (at 70a527e)
|
283
275
|
"""
|
284
276
|
|
@@ -293,7 +285,7 @@ Feature: berks install
|
|
293
285
|
And the output should contain:
|
294
286
|
"""
|
295
287
|
Fetching 'berkshelf-cookbook-fixture' from git://github.com/RiotGames/berkshelf-cookbook-fixture.git (at 70a527e)
|
296
|
-
Fetching cookbook index from http://127.0.0.1:
|
288
|
+
Fetching cookbook index from http://127.0.0.1:26310...
|
297
289
|
Using berkshelf-cookbook-fixture (0.2.0) from git://github.com/RiotGames/berkshelf-cookbook-fixture.git (at 70a527e)
|
298
290
|
"""
|
299
291
|
|
@@ -308,7 +300,7 @@ Feature: berks install
|
|
308
300
|
And the output should contain:
|
309
301
|
"""
|
310
302
|
Fetching 'berkshelf-cookbook-fixture' from https://github.com/RiotGames/berkshelf-cookbook-fixture.git (at v0.2.0)
|
311
|
-
Fetching cookbook index from http://127.0.0.1:
|
303
|
+
Fetching cookbook index from http://127.0.0.1:26310...
|
312
304
|
Using berkshelf-cookbook-fixture (0.2.0) from https://github.com/RiotGames/berkshelf-cookbook-fixture.git (at v0.2.0)
|
313
305
|
"""
|
314
306
|
|
@@ -323,7 +315,7 @@ Feature: berks install
|
|
323
315
|
And the output should contain:
|
324
316
|
"""
|
325
317
|
Fetching 'berkshelf-cookbook-fixture' from https://github.com/RiotGames/berkshelf-cookbook-fixture.git (at v0.2.0)
|
326
|
-
Fetching cookbook index from http://127.0.0.1:
|
318
|
+
Fetching cookbook index from http://127.0.0.1:26310...
|
327
319
|
Using berkshelf-cookbook-fixture (0.2.0) from https://github.com/RiotGames/berkshelf-cookbook-fixture.git (at v0.2.0)
|
328
320
|
"""
|
329
321
|
|
@@ -357,7 +349,6 @@ Feature: berks install
|
|
357
349
|
| bacon | 0.1.0 |
|
358
350
|
| bacon | 0.2.0 |
|
359
351
|
| bacon | 1.0.0 |
|
360
|
-
And the Berkshelf API server's cache is up to date
|
361
352
|
And I have a Berksfile pointing at the local Berkshelf API with:
|
362
353
|
"""
|
363
354
|
cookbook 'bacon', '~> 0.1'
|
@@ -420,7 +411,6 @@ Feature: berks install
|
|
420
411
|
Given the Chef Server has cookbooks:
|
421
412
|
| foo | 0.3.0 |
|
422
413
|
| foo | 0.2.0 |
|
423
|
-
And the Berkshelf API server's cache is up to date
|
424
414
|
And I have a Berksfile pointing at the local Berkshelf API with:
|
425
415
|
"""
|
426
416
|
cookbook 'foo'
|
@@ -476,7 +466,7 @@ Feature: berks install
|
|
476
466
|
Then the output should contain:
|
477
467
|
"""
|
478
468
|
Fetching 'berkshelf-cookbook-fixture' from git://github.com/RiotGames/berkshelf-cookbook-fixture.git (at v1.0.0)
|
479
|
-
Fetching cookbook index from http://127.0.0.1:
|
469
|
+
Fetching cookbook index from http://127.0.0.1:26310...
|
480
470
|
Using berkshelf-cookbook-fixture (1.0.0) from git://github.com/RiotGames/berkshelf-cookbook-fixture.git (at v1.0.0)
|
481
471
|
"""
|
482
472
|
|
@@ -506,7 +496,6 @@ Feature: berks install
|
|
506
496
|
| bacon | 0.1.0 |
|
507
497
|
| bacon | 0.2.0 |
|
508
498
|
| bacon | 1.0.0 |
|
509
|
-
And the Berkshelf API server's cache is up to date
|
510
499
|
When I successfully run `berks install`
|
511
500
|
Then the cookbook store should have the cookbooks:
|
512
501
|
| bacon | 0.2.0 |
|
@@ -3,7 +3,6 @@ Feature: berks outdated
|
|
3
3
|
Given the Chef Server has cookbooks:
|
4
4
|
| bacon | 1.0.0 |
|
5
5
|
| bacon | 1.1.0 |
|
6
|
-
And the Berkshelf API server's cache is up to date
|
7
6
|
And the cookbook store has the cookbooks:
|
8
7
|
| bacon | 1.1.0 |
|
9
8
|
And I have a Berksfile pointing at the local Berkshelf API with:
|
@@ -29,7 +28,6 @@ Feature: berks outdated
|
|
29
28
|
Given the Chef Server has cookbooks:
|
30
29
|
| bacon | 1.0.0 |
|
31
30
|
| bacon | 1.1.0 |
|
32
|
-
And the Berkshelf API server's cache is up to date
|
33
31
|
And the cookbook store has the cookbooks:
|
34
32
|
| bacon | 1.0.0 |
|
35
33
|
And I have a Berksfile pointing at the local Berkshelf API with:
|
@@ -56,7 +54,6 @@ Feature: berks outdated
|
|
56
54
|
| bacon | 1.1.0 |
|
57
55
|
| bacon | 1.2.1 |
|
58
56
|
| bacon | 1.5.8 |
|
59
|
-
And the Berkshelf API server's cache is up to date
|
60
57
|
And the cookbook store has the cookbooks:
|
61
58
|
| bacon | 1.0.0 |
|
62
59
|
And I have a Berksfile pointing at the local Berkshelf API with:
|
@@ -1,10 +1,8 @@
|
|
1
1
|
Feature: Vendoring cookbooks to a directory
|
2
2
|
Background:
|
3
|
-
* the Berkshelf API server's cache is empty
|
4
3
|
* the Chef Server has cookbooks:
|
5
4
|
| fake | 1.0.0 |
|
6
5
|
| ekaf | 2.0.0 |
|
7
|
-
* the Berkshelf API server's cache is up to date
|
8
6
|
|
9
7
|
Scenario: successfully vendoring a Berksfile with multiple cookbook demands
|
10
8
|
Given I have a Berksfile pointing at the local Berkshelf API with:
|
@@ -1,6 +1,5 @@
|
|
1
1
|
Feature: --format json
|
2
2
|
Background:
|
3
|
-
* the Berkshelf API server's cache is empty
|
4
3
|
* the Chef Server is empty
|
5
4
|
* the cookbook store is empty
|
6
5
|
|
@@ -11,15 +10,14 @@ Feature: --format json
|
|
11
10
|
"""
|
12
11
|
And the Chef Server has cookbooks:
|
13
12
|
| berkshelf | 1.0.0 |
|
14
|
-
And the Berkshelf API server's cache is up to date
|
15
13
|
When I successfully run `berks install --format json`
|
16
14
|
Then the output should contain JSON:
|
17
15
|
"""
|
18
16
|
{
|
19
17
|
"cookbooks": [
|
20
18
|
{
|
21
|
-
"api_source": "http://127.0.0.1:
|
22
|
-
"location_path": "http://
|
19
|
+
"api_source": "http://127.0.0.1:26310",
|
20
|
+
"location_path": "http://127.0.0.1:26310/cookbooks/berkshelf/1.0.0",
|
23
21
|
"version": "1.0.0",
|
24
22
|
"name": "berkshelf"
|
25
23
|
}
|
@@ -27,7 +25,7 @@ Feature: --format json
|
|
27
25
|
"errors": [],
|
28
26
|
"messages": [
|
29
27
|
"Resolving cookbook dependencies...",
|
30
|
-
"Fetching cookbook index from http://127.0.0.1:
|
28
|
+
"Fetching cookbook index from http://127.0.0.1:26310..."
|
31
29
|
],
|
32
30
|
"warnings": []
|
33
31
|
}
|
@@ -53,7 +51,7 @@ Feature: --format json
|
|
53
51
|
"errors": [],
|
54
52
|
"messages": [
|
55
53
|
"Resolving cookbook dependencies...",
|
56
|
-
"Fetching cookbook index from http://127.0.0.1:
|
54
|
+
"Fetching cookbook index from http://127.0.0.1:26310..."
|
57
55
|
],
|
58
56
|
"warnings": []
|
59
57
|
}
|
@@ -128,7 +126,6 @@ Feature: --format json
|
|
128
126
|
| seth | 0.1.0 |
|
129
127
|
| seth | 0.2.9 |
|
130
128
|
| seth | 1.0.0 |
|
131
|
-
And the Berkshelf API server's cache is up to date
|
132
129
|
And I have a Berksfile pointing at the local Berkshelf API with:
|
133
130
|
"""
|
134
131
|
cookbook 'seth', '~> 0.1'
|
@@ -149,7 +146,7 @@ Feature: --format json
|
|
149
146
|
{
|
150
147
|
"local": "0.1.0",
|
151
148
|
"remote": {
|
152
|
-
"http://127.0.0.1:
|
149
|
+
"http://127.0.0.1:26310": "0.2.9"
|
153
150
|
},
|
154
151
|
"name": "seth"
|
155
152
|
}
|
data/features/support/env.rb
CHANGED
@@ -6,19 +6,22 @@ require "aruba/cucumber"
|
|
6
6
|
require "aruba/in_process"
|
7
7
|
require "aruba/spawn_process"
|
8
8
|
require "cucumber/rspec/doubles"
|
9
|
-
require "berkshelf/api/rspec" unless windows?
|
10
|
-
require "berkshelf/api/cucumber" unless windows?
|
11
9
|
|
12
10
|
Dir["spec/support/**/*.rb"].each { |f| require File.expand_path(f) }
|
13
11
|
|
14
12
|
World(Berkshelf::RSpec::PathHelpers)
|
15
13
|
|
14
|
+
# these tests used to start a chef-zero server on one port, and a berks-api server on another port
|
15
|
+
# they now start a chef-zero server that supports the universe endpoint on one port.
|
16
|
+
#
|
17
|
+
# if there becomes a need to integration test talking to a supermarket/universe endpoint and then
|
18
|
+
# talking to a separate chef-server, then these features could be split back up again, but the
|
19
|
+
# Berkshelf::RSpec::ChefServer helper class would need to support managing multiple chef-zero servers.
|
16
20
|
CHEF_SERVER_PORT = 26310
|
17
|
-
BERKS_API_PORT =
|
21
|
+
BERKS_API_PORT = 26310
|
18
22
|
|
19
23
|
at_exit do
|
20
24
|
Berkshelf::RSpec::ChefServer.stop
|
21
|
-
Berkshelf::API::RSpec::Server.stop unless windows?
|
22
25
|
end
|
23
26
|
|
24
27
|
Before do
|
@@ -51,7 +54,6 @@ Before do
|
|
51
54
|
]
|
52
55
|
|
53
56
|
Berkshelf::RSpec::ChefServer.start(port: CHEF_SERVER_PORT)
|
54
|
-
Berkshelf::API::RSpec::Server.start(port: BERKS_API_PORT, endpoints: endpoints) unless windows?
|
55
57
|
|
56
58
|
aruba.config.io_wait_timeout = Cucumber::JRUBY ? 7 : 5
|
57
59
|
@aruba_timeout_seconds = Cucumber::JRUBY ? 35 : 15
|
@@ -0,0 +1 @@
|
|
1
|
+
require_relative "api_client"
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Berkshelf
|
2
|
+
# Used to communicate with a remotely hosted [Berkshelf API Server](https://github.com/berkshelf/berkshelf-api).
|
3
|
+
#
|
4
|
+
# @example
|
5
|
+
# client = Berkshelf::APIClient.new("https://api.berkshelf.com")
|
6
|
+
# client.universe #=> [...]
|
7
|
+
module APIClient
|
8
|
+
require_relative "api_client/version"
|
9
|
+
require_relative "api_client/errors"
|
10
|
+
require_relative "api_client/remote_cookbook"
|
11
|
+
require_relative "api_client/connection"
|
12
|
+
require_relative "api_client/chef_server_connection"
|
13
|
+
|
14
|
+
class << self
|
15
|
+
def new(*args)
|
16
|
+
Connection.new(*args)
|
17
|
+
end
|
18
|
+
|
19
|
+
def chef_server(*args)
|
20
|
+
ChefServerConnection.new(*args)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require "berkshelf/ridley_compat"
|
2
|
+
|
3
|
+
module Berkshelf::APIClient
|
4
|
+
require_relative "errors"
|
5
|
+
|
6
|
+
class ChefServerConnection
|
7
|
+
attr_reader :client
|
8
|
+
|
9
|
+
def initialize(*args)
|
10
|
+
@client = Berkshelf::RidleyCompat.new(*args)
|
11
|
+
@url = args[0][:server_url]
|
12
|
+
end
|
13
|
+
|
14
|
+
def universe
|
15
|
+
response = client.get("universe")
|
16
|
+
|
17
|
+
[].tap do |cookbooks|
|
18
|
+
response.each do |name, versions|
|
19
|
+
versions.each do |version, attributes|
|
20
|
+
attributes[:location_path] = @url
|
21
|
+
cookbooks << RemoteCookbook.new(name, version, attributes) end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
rescue Ridley::Errors::HTTPNotFound
|
25
|
+
raise ServiceNotFound, "service not found at: #{@url}"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require "berkshelf/ridley_compat"
|
2
|
+
|
3
|
+
module Berkshelf::APIClient
|
4
|
+
require_relative "errors"
|
5
|
+
|
6
|
+
class Connection
|
7
|
+
# @return [String]
|
8
|
+
attr_reader :url
|
9
|
+
|
10
|
+
# @return [Integer]
|
11
|
+
# how many retries to attempt on HTTP requests
|
12
|
+
attr_reader :retries
|
13
|
+
|
14
|
+
# @return [Float]
|
15
|
+
# time to wait between retries
|
16
|
+
attr_reader :retry_interval
|
17
|
+
|
18
|
+
# @param [String, Addressable::URI] url
|
19
|
+
#
|
20
|
+
# @option options [Integer] :open_timeout (3)
|
21
|
+
# how long to wait (in seconds) for connection open to the API server
|
22
|
+
# @option options [Integer] :timeout (30)
|
23
|
+
# how long to wait (in seconds) before getting a response from the API server
|
24
|
+
# @option options [Integer] :retries (3)
|
25
|
+
# how many retries to perform before giving up
|
26
|
+
# @option options [Float] :retry_interval (0.5)
|
27
|
+
# how long to wait (in seconds) between each retry
|
28
|
+
def initialize(url, options = {})
|
29
|
+
# it looks like Faraday mutates the URI argument it is given, when we ripped Faraday out of this
|
30
|
+
# API it stopped doing that. this may or may not be a breaking change (it broke some fairly
|
31
|
+
# brittle berkshelf tests). if it causes too much berkshelf chaos we could revert by uncommenting
|
32
|
+
# the next line. as it is removing this behavior feels more like fixing a bug.
|
33
|
+
#@url = url.normalize! if url.is_a?(Addressable::URI)
|
34
|
+
options = { retries: 3, retry_interval: 0.5, open_timeout: 30, timeout: 30 }.merge(options)
|
35
|
+
options[:server_url] = url
|
36
|
+
|
37
|
+
@client = Berkshelf::RidleyCompatJSON.new(**options)
|
38
|
+
end
|
39
|
+
|
40
|
+
# Retrieves the entire universe of known cookbooks from the API source
|
41
|
+
#
|
42
|
+
# @raise [APIClient::TimeoutError]
|
43
|
+
#
|
44
|
+
# @return [Array<APIClient::RemoteCookbook>]
|
45
|
+
def universe
|
46
|
+
response = @client.get("universe")
|
47
|
+
|
48
|
+
[].tap do |cookbooks|
|
49
|
+
response.each do |name, versions|
|
50
|
+
versions.each { |version, attributes| cookbooks << RemoteCookbook.new(name, version, attributes) }
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
module Berkshelf
|
2
|
+
class APIClientError < StandardError; end
|
3
|
+
|
4
|
+
module APIClient
|
5
|
+
class TimeoutError < APIClientError; end
|
6
|
+
class BadResponse < APIClientError; end
|
7
|
+
class ServiceUnavailable < APIClientError; end
|
8
|
+
class ServiceNotFound < APIClientError; end
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require "json"
|
2
|
+
require "chef/mash"
|
3
|
+
|
4
|
+
module Berkshelf::APIClient
|
5
|
+
# A representation of cookbook metadata indexed by a Berkshelf API Server. Returned
|
6
|
+
# by sending messages to a {Berkshelf::APIClient} and used to download cookbooks
|
7
|
+
# indexed by the Berkshelf API Server.
|
8
|
+
class RemoteCookbook
|
9
|
+
# @return [String]
|
10
|
+
attr_reader :name
|
11
|
+
# @return [String]
|
12
|
+
attr_reader :version
|
13
|
+
|
14
|
+
# @param [String] name
|
15
|
+
# @param [String] version
|
16
|
+
# @param [Hash] attributes
|
17
|
+
def initialize(name, version, attributes = {})
|
18
|
+
@name = name
|
19
|
+
@version = version
|
20
|
+
@attributes = ::Mash.new(attributes)
|
21
|
+
end
|
22
|
+
|
23
|
+
# @return [Hash]
|
24
|
+
def dependencies
|
25
|
+
@attributes[:dependencies]
|
26
|
+
end
|
27
|
+
|
28
|
+
# @return [Hash]
|
29
|
+
def platforms
|
30
|
+
@attributes[:platforms]
|
31
|
+
end
|
32
|
+
|
33
|
+
# @return [Symbol]
|
34
|
+
def location_type
|
35
|
+
@attributes[:location_type].to_sym
|
36
|
+
end
|
37
|
+
|
38
|
+
# @return [String]
|
39
|
+
def location_path
|
40
|
+
@attributes[:location_path]
|
41
|
+
end
|
42
|
+
|
43
|
+
def to_hash
|
44
|
+
{
|
45
|
+
name: name,
|
46
|
+
version: version,
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
def to_json(options = {})
|
51
|
+
::JSON.pretty_generate(to_hash, options)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
require "chef/server_api"
|
2
|
+
require "chef/http/simple_json"
|
3
|
+
require "chef/http/simple"
|
4
|
+
require "berkshelf/api_client/errors"
|
5
|
+
|
6
|
+
module Berkshelf
|
7
|
+
module RidleyCompatAPI
|
8
|
+
def initialize(**opts)
|
9
|
+
opts = opts.dup
|
10
|
+
opts[:ssl] ||= {}
|
11
|
+
chef_opts = {
|
12
|
+
rest_timeout: opts[:timeout], # opts[:open_timeout] is ignored on purpose
|
13
|
+
headers: opts[:headers],
|
14
|
+
client_name: opts[:client_name],
|
15
|
+
signing_key_filename: opts[:client_key],
|
16
|
+
ssl_verify_mode: opts[:verify] ? :verify_none : :verify_peer,
|
17
|
+
ssl_ca_path: opts[:ssl][:ca_path],
|
18
|
+
ssl_ca_file: opts[:ssl][:ca_file],
|
19
|
+
ssl_client_cert: opts[:ssl][:client_cert],
|
20
|
+
ssl_client_key: opts[:ssl][:client_key],
|
21
|
+
}
|
22
|
+
super(opts[:server_url].to_s, **chef_opts)
|
23
|
+
end
|
24
|
+
|
25
|
+
def get(url)
|
26
|
+
super(url)
|
27
|
+
rescue Net::HTTPExceptions => e
|
28
|
+
case e.response.code
|
29
|
+
when "404"
|
30
|
+
raise Berkshelf::APIClient::ServiceNotFound, "service not found at: #{url}"
|
31
|
+
when /^5/
|
32
|
+
raise Berkshelf::APIClient::ServiceUnavailable, "service unavailable at: #{url}"
|
33
|
+
else
|
34
|
+
raise Berkshelf::APIClient::BadResponse, "bad response #{e.response}"
|
35
|
+
end
|
36
|
+
rescue Errno::ETIMEDOUT, Timeout::Error
|
37
|
+
raise Berkshelf::APIClient::TimeoutError, "Unable to connect to: #{url}"
|
38
|
+
rescue Errno::EHOSTUNREACH, Errno::ECONNREFUSED => e
|
39
|
+
raise Berkshelf::APIClient::ServiceUnavailable, e
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
# This is for simple HTTP
|
44
|
+
class RidleyCompatSimple < Chef::ServerAPI
|
45
|
+
use Chef::HTTP::Decompressor
|
46
|
+
use Chef::HTTP::CookieManager
|
47
|
+
use Chef::HTTP::ValidateContentLength
|
48
|
+
|
49
|
+
include RidleyCompatAPI
|
50
|
+
end
|
51
|
+
|
52
|
+
# This is for JSON-REST
|
53
|
+
class RidleyCompatJSON < Chef::HTTP::SimpleJSON
|
54
|
+
use Chef::HTTP::JSONInput
|
55
|
+
use Chef::HTTP::JSONOutput
|
56
|
+
use Chef::HTTP::CookieManager
|
57
|
+
use Chef::HTTP::Decompressor
|
58
|
+
use Chef::HTTP::RemoteRequestID
|
59
|
+
use Chef::HTTP::ValidateContentLength
|
60
|
+
|
61
|
+
include RidleyCompatAPI
|
62
|
+
end
|
63
|
+
|
64
|
+
# RidleyCompat is the ServerAPI, but we inherit from Chef::HTTP::Simple and then include all our middlewares
|
65
|
+
# and then need to include our own CompatAPI. The end result is a ridley-esque way of talking to a chef server.
|
66
|
+
class RidleyCompat < Chef::HTTP::Simple
|
67
|
+
use Chef::HTTP::JSONInput
|
68
|
+
use Chef::HTTP::JSONOutput
|
69
|
+
use Chef::HTTP::CookieManager
|
70
|
+
use Chef::HTTP::Decompressor
|
71
|
+
use Chef::HTTP::Authenticator
|
72
|
+
use Chef::HTTP::RemoteRequestID
|
73
|
+
use Chef::HTTP::APIVersions if defined?(Chef::HTTP::APIVersions)
|
74
|
+
use Chef::HTTP::ValidateContentLength
|
75
|
+
|
76
|
+
include RidleyCompatAPI
|
77
|
+
end
|
78
|
+
end
|
data/lib/berkshelf/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -8,7 +8,6 @@ require "rspec"
|
|
8
8
|
require "cleanroom/rspec"
|
9
9
|
require "webmock/rspec"
|
10
10
|
require "rspec/its"
|
11
|
-
require "berkshelf/api/rspec" unless windows?
|
12
11
|
|
13
12
|
Dir["spec/support/**/*.rb"].each { |f| require File.expand_path(f) }
|
14
13
|
|
@@ -18,7 +17,6 @@ RSpec.configure do |config|
|
|
18
17
|
config.include Berkshelf::RSpec::ChefServer
|
19
18
|
config.include Berkshelf::RSpec::Git
|
20
19
|
config.include Berkshelf::RSpec::PathHelpers
|
21
|
-
config.include Berkshelf::API::RSpec unless windows?
|
22
20
|
|
23
21
|
config.expect_with :rspec do |c|
|
24
22
|
c.syntax = :expect
|
@@ -36,9 +34,8 @@ RSpec.configure do |config|
|
|
36
34
|
end
|
37
35
|
|
38
36
|
config.before(:suite) do
|
39
|
-
WebMock.disable_net_connect!(allow_localhost:
|
37
|
+
WebMock.disable_net_connect!(allow_localhost: false, net_http_connect_on_start: true)
|
40
38
|
Berkshelf::RSpec::ChefServer.start
|
41
|
-
Berkshelf::API::RSpec::Server.start unless windows?
|
42
39
|
end
|
43
40
|
|
44
41
|
config.before(:all) do
|
@@ -46,7 +43,6 @@ RSpec.configure do |config|
|
|
46
43
|
end
|
47
44
|
|
48
45
|
config.before(:each) do
|
49
|
-
Berkshelf::API::RSpec::Server.clear_cache unless windows?
|
50
46
|
clean_tmp_path
|
51
47
|
Berkshelf.initialize_filesystem
|
52
48
|
Berkshelf::CookbookStore.instance.initialize_filesystem
|
@@ -0,0 +1,100 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Berkshelf::APIClient::Connection do
|
4
|
+
let(:instance) { described_class.new("http://supermarket.getchef.com") }
|
5
|
+
|
6
|
+
describe "#universe" do
|
7
|
+
before do
|
8
|
+
body_response = %q{{"ruby":{"1.2.3":{"endpoint_priority":0,"platforms":{},"dependencies":{"build-essential":">= 1.2.2"},"location_type":"supermarket","location_path":"https://supermarket.getchef.com/"},"2.0.0":{"endpoint_priority":0,"platforms":{},"dependencies":{"build-essential":">= 1.2.2"},"location_type":"supermarket","location_path":"https://supermarket.getchef.com/"}},"elixir":{"1.0.0":{"endpoint_priority":0,"platforms":{"CentOS":"= 6.0.0"},"dependencies":{},"location_type":"supermarket","location_path":"https://supermarket.getchef.com/"}}}}
|
9
|
+
|
10
|
+
stub_request(:get, "http://supermarket.getchef.com/universe")
|
11
|
+
.to_return(status: 200, body: body_response, headers: { "Content-Type" => "application/json; charset=utf-8" })
|
12
|
+
end
|
13
|
+
|
14
|
+
subject { instance.universe }
|
15
|
+
|
16
|
+
it "returns an array of APIClient::RemoteCookbook" do
|
17
|
+
expect(subject).to be_a(Array)
|
18
|
+
|
19
|
+
subject.each do |remote|
|
20
|
+
expect(remote).to be_a(Berkshelf::APIClient::RemoteCookbook)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
it "contains a item for each dependency" do
|
25
|
+
expect(subject.size).to eq(3)
|
26
|
+
expect(subject[0].name).to eql("ruby")
|
27
|
+
expect(subject[0].version).to eql("1.2.3")
|
28
|
+
expect(subject[1].name).to eql("ruby")
|
29
|
+
expect(subject[1].version).to eql("2.0.0")
|
30
|
+
expect(subject[2].name).to eql("elixir")
|
31
|
+
expect(subject[2].version).to eql("1.0.0")
|
32
|
+
end
|
33
|
+
|
34
|
+
it "has the dependencies for each" do
|
35
|
+
expect(subject[0].dependencies).to include("build-essential" => ">= 1.2.2")
|
36
|
+
expect(subject[1].dependencies).to include("build-essential" => ">= 1.2.2")
|
37
|
+
expect(subject[2].dependencies).to be_empty
|
38
|
+
end
|
39
|
+
|
40
|
+
it "has the platforms for each" do
|
41
|
+
expect(subject[0].platforms).to be_empty
|
42
|
+
expect(subject[1].platforms).to be_empty
|
43
|
+
expect(subject[2].platforms).to include("CentOS" => "= 6.0.0")
|
44
|
+
end
|
45
|
+
|
46
|
+
it "has a location_path for each" do
|
47
|
+
subject.each do |remote|
|
48
|
+
expect(remote.location_path).to_not be_nil
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
it "has a location_type for each" do
|
53
|
+
subject.each do |remote|
|
54
|
+
expect(remote.location_type).to_not be_nil
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe "non-200s" do
|
60
|
+
before do
|
61
|
+
Chef::Config[:http_retry_delay] = 0.001
|
62
|
+
Chef::Config[:http_retry_count] = 0
|
63
|
+
end
|
64
|
+
|
65
|
+
subject { instance.universe }
|
66
|
+
|
67
|
+
it "follows 301 redirects correctly" do
|
68
|
+
stub_request(:get, "http://supermarket.getchef.com/universe").to_return(:status => 301, :headers => { "Location" => "http://arglebargle.com/universe" })
|
69
|
+
body_response = %q{{"ruby":{"1.2.3":{"endpoint_priority":0,"platforms":{},"dependencies":{"build-essential":">= 1.2.2"},"location_type":"supermarket","location_path":"https://supermarket.getchef.com/"},"2.0.0":{"endpoint_priority":0,"platforms":{},"dependencies":{"build-essential":">= 1.2.2"},"location_type":"supermarket","location_path":"https://supermarket.getchef.com/"}},"elixir":{"1.0.0":{"endpoint_priority":0,"platforms":{"CentOS":"= 6.0.0"},"dependencies":{},"location_type":"supermarket","location_path":"https://supermarket.getchef.com/"}}}}
|
70
|
+
stub_request(:get, "http://arglebargle.com/universe")
|
71
|
+
.to_return(status: 200, body: body_response, headers: { "Content-Type" => "application/json; charset=utf-8" })
|
72
|
+
expect(subject.size).to eq(3)
|
73
|
+
end
|
74
|
+
|
75
|
+
it "raises Berkshelf::APIClient::ServiceUnavailable for 500s" do
|
76
|
+
stub_request(:get, "http://supermarket.getchef.com/universe").to_return(:status => [500, "Internal Server Error"])
|
77
|
+
expect { subject }.to raise_error(Berkshelf::APIClient::ServiceUnavailable)
|
78
|
+
end
|
79
|
+
|
80
|
+
it "raises Berkshelf::APIClient::ServiceNotFound for 404s" do
|
81
|
+
stub_request(:get, "http://supermarket.getchef.com/universe").to_return(:status => [404, "Not Found"])
|
82
|
+
expect { subject }.to raise_error(Berkshelf::APIClient::ServiceNotFound)
|
83
|
+
end
|
84
|
+
|
85
|
+
it "raises Net::HTTPBadRequest for 400s" do
|
86
|
+
stub_request(:get, "http://supermarket.getchef.com/universe").to_return(:status => [400, "Bad Request"])
|
87
|
+
expect { subject }.to raise_error(Berkshelf::APIClient::BadResponse)
|
88
|
+
end
|
89
|
+
|
90
|
+
it "raises Berkshelf::APIClient::TimeoutError for timeouts" do
|
91
|
+
stub_request(:get, "http://supermarket.getchef.com/universe").to_timeout
|
92
|
+
expect { subject }.to raise_error(Berkshelf::APIClient::TimeoutError)
|
93
|
+
end
|
94
|
+
|
95
|
+
it "raises Berkshelf::APIClient::TimeoutError for timeouts" do
|
96
|
+
stub_request(:get, "http://supermarket.getchef.com/universe").to_raise(Errno::ECONNREFUSED)
|
97
|
+
expect { subject }.to raise_error(Berkshelf::APIClient::ServiceUnavailable)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Berkshelf::APIClient::RemoteCookbook do
|
4
|
+
let(:name) { "ruby" }
|
5
|
+
let(:version) { "1.2.3" }
|
6
|
+
let(:dependencies) { double("dependencies") }
|
7
|
+
let(:platforms) { double("platforms") }
|
8
|
+
let(:location_type) { "chef_server" }
|
9
|
+
let(:location_path) { "http://localhost:8080" }
|
10
|
+
|
11
|
+
let(:attributes) do
|
12
|
+
{ dependencies: dependencies, platforms: platforms, location_path: location_path, location_type: location_type }
|
13
|
+
end
|
14
|
+
|
15
|
+
subject { described_class.new(name, version, attributes) }
|
16
|
+
|
17
|
+
its(:name) { should eql(name) }
|
18
|
+
its(:version) { should eql(version) }
|
19
|
+
its(:dependencies) { should eql(dependencies) }
|
20
|
+
its(:platforms) { should eql(platforms) }
|
21
|
+
its(:location_type) { should eql(:chef_server) }
|
22
|
+
its(:location_path) { should eql(location_path) }
|
23
|
+
end
|
@@ -5,12 +5,12 @@ describe Berkshelf::Resolver::Graph, :not_supported_on_windows do
|
|
5
5
|
subject { described_class.new }
|
6
6
|
|
7
7
|
describe "#populate" do
|
8
|
-
let(:sources) { Berkshelf::Source.new(berksfile, "http://
|
8
|
+
let(:sources) { Berkshelf::Source.new(berksfile, "http://supermarket.getchef.com") }
|
9
9
|
|
10
10
|
before do
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
body_response = %q{{"ruby":{"1.0.0":{"endpoint_priority":0,"platforms":{},"dependencies":{"elixir":">= 0.1.0"},"location_type":"supermarket","location_path":"https://supermarket.getchef.com/"},"2.0.0":{"endpoint_priority":0,"platforms":{},"dependencies":{},"location_type":"supermarket","location_path":"https://supermarket.getchef.com/"}},"elixir":{"1.0.0":{"endpoint_priority":0,"platforms":{},"dependencies":{},"location_type":"supermarket","location_path":"https://supermarket.getchef.com/"}}}}
|
12
|
+
stub_request(:get, "http://supermarket.getchef.com/universe")
|
13
|
+
.to_return(status: 200, body: body_response, headers: { "Content-Type" => "application/json; charset=utf-8" })
|
14
14
|
end
|
15
15
|
|
16
16
|
it "adds each dependency to the graph" do
|
@@ -25,11 +25,12 @@ describe Berkshelf::Resolver::Graph, :not_supported_on_windows do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
describe "#universe" do
|
28
|
-
let(:sources) { Berkshelf::Source.new(berksfile, "http://
|
28
|
+
let(:sources) { Berkshelf::Source.new(berksfile, "http://supermarket.getchef.com") }
|
29
29
|
|
30
30
|
before do
|
31
|
-
|
32
|
-
|
31
|
+
body_response = %q{{"ruby":{"1.0.0":{"endpoint_priority":0,"platforms":{},"dependencies":{},"location_type":"supermarket","location_path":"https://supermarket.getchef.com/"}},"elixir":{"1.0.0":{"endpoint_priority":0,"platforms":{},"dependencies":{},"location_type":"supermarket","location_path":"https://supermarket.getchef.com/"}}}}
|
32
|
+
stub_request(:get, "http://supermarket.getchef.com/universe")
|
33
|
+
.to_return(status: 200, body: body_response, headers: { "Content-Type" => "application/json; charset=utf-8" })
|
33
34
|
end
|
34
35
|
|
35
36
|
it "returns an array of APIClient::RemoteCookbook" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: berkshelf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.2.
|
4
|
+
version: 6.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamie Winsor
|
@@ -12,42 +12,8 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2017-
|
15
|
+
date: 2017-07-18 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
|
-
- !ruby/object:Gem::Dependency
|
18
|
-
name: addressable
|
19
|
-
requirement: !ruby/object:Gem::Requirement
|
20
|
-
requirements:
|
21
|
-
- - "~>"
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: '2.3'
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 2.3.4
|
27
|
-
type: :runtime
|
28
|
-
prerelease: false
|
29
|
-
version_requirements: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '2.3'
|
34
|
-
- - ">="
|
35
|
-
- !ruby/object:Gem::Version
|
36
|
-
version: 2.3.4
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: berkshelf-api-client
|
39
|
-
requirement: !ruby/object:Gem::Requirement
|
40
|
-
requirements:
|
41
|
-
- - ">="
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: 4.0.0
|
44
|
-
type: :runtime
|
45
|
-
prerelease: false
|
46
|
-
version_requirements: !ruby/object:Gem::Requirement
|
47
|
-
requirements:
|
48
|
-
- - ">="
|
49
|
-
- !ruby/object:Gem::Version
|
50
|
-
version: 4.0.0
|
51
17
|
- !ruby/object:Gem::Dependency
|
52
18
|
name: buff-config
|
53
19
|
requirement: !ruby/object:Gem::Requirement
|
@@ -262,6 +228,20 @@ dependencies:
|
|
262
228
|
- - "~>"
|
263
229
|
- !ruby/object:Gem::Version
|
264
230
|
version: '1.0'
|
231
|
+
- !ruby/object:Gem::Dependency
|
232
|
+
name: chef
|
233
|
+
requirement: !ruby/object:Gem::Requirement
|
234
|
+
requirements:
|
235
|
+
- - ">="
|
236
|
+
- !ruby/object:Gem::Version
|
237
|
+
version: 12.7.2
|
238
|
+
type: :runtime
|
239
|
+
prerelease: false
|
240
|
+
version_requirements: !ruby/object:Gem::Requirement
|
241
|
+
requirements:
|
242
|
+
- - ">="
|
243
|
+
- !ruby/object:Gem::Version
|
244
|
+
version: 12.7.2
|
265
245
|
description: Manages a Cookbook's, or an Application's, Cookbook dependencies
|
266
246
|
email:
|
267
247
|
- jamie@vialstudios.com
|
@@ -348,6 +328,13 @@ files:
|
|
348
328
|
- generator_files/licenses/reserved.erb
|
349
329
|
- generator_files/metadata.rb.erb
|
350
330
|
- lib/berkshelf.rb
|
331
|
+
- lib/berkshelf/api-client.rb
|
332
|
+
- lib/berkshelf/api_client.rb
|
333
|
+
- lib/berkshelf/api_client/chef_server_connection.rb
|
334
|
+
- lib/berkshelf/api_client/connection.rb
|
335
|
+
- lib/berkshelf/api_client/errors.rb
|
336
|
+
- lib/berkshelf/api_client/remote_cookbook.rb
|
337
|
+
- lib/berkshelf/api_client/version.rb
|
351
338
|
- lib/berkshelf/base_generator.rb
|
352
339
|
- lib/berkshelf/berksfile.rb
|
353
340
|
- lib/berkshelf/cached_cookbook.rb
|
@@ -385,6 +372,7 @@ files:
|
|
385
372
|
- lib/berkshelf/packager.rb
|
386
373
|
- lib/berkshelf/resolver.rb
|
387
374
|
- lib/berkshelf/resolver/graph.rb
|
375
|
+
- lib/berkshelf/ridley_compat.rb
|
388
376
|
- lib/berkshelf/shell.rb
|
389
377
|
- lib/berkshelf/shell_out.rb
|
390
378
|
- lib/berkshelf/source.rb
|
@@ -435,6 +423,9 @@ files:
|
|
435
423
|
- spec/support/path_helpers.rb
|
436
424
|
- spec/support/shared_examples/formatter.rb
|
437
425
|
- spec/unit/berkshelf/berksfile_spec.rb
|
426
|
+
- spec/unit/berkshelf/berkshelf/api_client/connection_spec.rb
|
427
|
+
- spec/unit/berkshelf/berkshelf/api_client/remote_cookbook_spec.rb
|
428
|
+
- spec/unit/berkshelf/berkshelf/api_client_spec.rb
|
438
429
|
- spec/unit/berkshelf/cached_cookbook_spec.rb
|
439
430
|
- spec/unit/berkshelf/chef_repo_universe_spec.rb
|
440
431
|
- spec/unit/berkshelf/cli_spec.rb
|
@@ -574,6 +565,9 @@ test_files:
|
|
574
565
|
- spec/support/path_helpers.rb
|
575
566
|
- spec/support/shared_examples/formatter.rb
|
576
567
|
- spec/unit/berkshelf/berksfile_spec.rb
|
568
|
+
- spec/unit/berkshelf/berkshelf/api_client/connection_spec.rb
|
569
|
+
- spec/unit/berkshelf/berkshelf/api_client/remote_cookbook_spec.rb
|
570
|
+
- spec/unit/berkshelf/berkshelf/api_client_spec.rb
|
577
571
|
- spec/unit/berkshelf/cached_cookbook_spec.rb
|
578
572
|
- spec/unit/berkshelf/chef_repo_universe_spec.rb
|
579
573
|
- spec/unit/berkshelf/cli_spec.rb
|