berkshelf 3.1.3 → 3.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/Gemfile +1 -1
- data/features/berksfile.feature +1 -1
- data/features/commands/install.feature +50 -10
- data/features/commands/search.feature +1 -0
- data/features/commands/upload.feature +1 -1
- data/features/config.feature +2 -2
- data/generator_files/Berksfile.erb +1 -1
- data/generator_files/Vagrantfile.erb +5 -2
- data/lib/berkshelf/berksfile.rb +4 -4
- data/lib/berkshelf/community_rest.rb +1 -0
- data/lib/berkshelf/config.rb +2 -2
- data/lib/berkshelf/errors.rb +50 -39
- data/lib/berkshelf/formatters/human.rb +1 -1
- data/lib/berkshelf/formatters/json.rb +1 -1
- data/lib/berkshelf/installer.rb +4 -0
- data/lib/berkshelf/version.rb +1 -1
- data/spec/unit/berkshelf/community_rest_spec.rb +8 -0
- data/spec/unit/berkshelf/cookbook_generator_spec.rb +1 -1
- data/spec/unit/berkshelf/init_generator_spec.rb +2 -2
- data/spec/unit/berkshelf/installer_spec.rb +1 -1
- data/spec/unit/berkshelf/source_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c2cbd226c97f7eb03ba011273102912c1ab35c3
|
4
|
+
data.tar.gz: 41a2609f4d1ea587b37be2e78f9a965408f801c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1fb76696aa23da536edce710c03a1da9abe896470ccbed29713c97681f713d5213229804841566b5e5e908c3fc7f2f2465ccf871b36c8f2ced7bdaabd71678e
|
7
|
+
data.tar.gz: 907002c134b4c2294895dc3889fa32e52d71bb762c0c4298df6b4632e352836e645e5ed4746c8740f47ef9efcfa24be9a7a2a09905737ae4c83e47304d880318
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
> This is a high level digest of changes. For the complete CHANGELOG diff two tags in the project's [commit history](https://github.com/berkshelf/berkshelf/commits/master).
|
2
2
|
|
3
|
+
# 3.1.4
|
4
|
+
|
5
|
+
* Improvements
|
6
|
+
* Update the default vagrant box from the generators to Ubuntu 14.04 (formerly 12.04 EOL)
|
7
|
+
|
8
|
+
* Bug fixes
|
9
|
+
* Handle the case where a remote source had been removed but still existed in the lockfile
|
10
|
+
* Follow redirects (HTTP -> HTTPS) in all requests
|
11
|
+
|
3
12
|
# 3.1.3
|
4
13
|
|
5
14
|
* Enhancements
|
data/Gemfile
CHANGED
data/features/berksfile.feature
CHANGED
@@ -242,15 +242,15 @@ Feature: berks install
|
|
242
242
|
Scenario: installing a Berksfile that contains a Git location
|
243
243
|
Given I have a Berksfile pointing at the local Berkshelf API with:
|
244
244
|
"""
|
245
|
-
cookbook 'berkshelf-cookbook-fixture',
|
246
|
-
git: 'git://github.com/RiotGames/berkshelf-cookbook-fixture.git',
|
245
|
+
cookbook 'berkshelf-cookbook-fixture',
|
246
|
+
git: 'git://github.com/RiotGames/berkshelf-cookbook-fixture.git',
|
247
247
|
tag: 'v0.2.0'
|
248
248
|
"""
|
249
249
|
When I successfully run `berks install`
|
250
250
|
Then the cookbook store should have the git cookbooks:
|
251
251
|
| berkshelf-cookbook-fixture | 0.2.0 | 70a527e17d91f01f031204562460ad1c17f972ee |
|
252
252
|
And the git cookbook "berkshelf-cookbook-fixture-70a527e17d91f01f031204562460ad1c17f972ee" should not have the following directories:
|
253
|
-
| .git |
|
253
|
+
| .git |
|
254
254
|
|
255
255
|
Scenario: installing a Berksfile that contains a Git location with a tag
|
256
256
|
Given I have a Berksfile pointing at the local Berkshelf API with:
|
@@ -364,13 +364,11 @@ Feature: berks install
|
|
364
364
|
"""
|
365
365
|
And I write to "Berksfile.lock" with:
|
366
366
|
"""
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
}
|
373
|
-
}
|
367
|
+
DEPENDENCIES
|
368
|
+
bacon (~> 0.1)
|
369
|
+
|
370
|
+
GRAPH
|
371
|
+
bacon (0.2.0)
|
374
372
|
"""
|
375
373
|
When I successfully run `berks install`
|
376
374
|
Then the output should contain:
|
@@ -399,6 +397,48 @@ Feature: berks install
|
|
399
397
|
"""
|
400
398
|
And the exit status should be "NoSolutionError"
|
401
399
|
|
400
|
+
Scenario: running install when the Cookbook from Berksfile.lock is not found in the sources
|
401
|
+
Given I have a Berksfile pointing at the local Berkshelf API with:
|
402
|
+
"""
|
403
|
+
cookbook 'foo'
|
404
|
+
"""
|
405
|
+
And I write to "Berksfile.lock" with:
|
406
|
+
"""
|
407
|
+
DEPENDENCIES
|
408
|
+
foo
|
409
|
+
|
410
|
+
GRAPH
|
411
|
+
foo (0.1.0)
|
412
|
+
"""
|
413
|
+
When I run `berks install`
|
414
|
+
Then the output should contain:
|
415
|
+
"""
|
416
|
+
Cookbook 'foo' (0.1.0) not found in any of the sources! This can happen if the remote cookbook has been deleted or if the sources inside the Berksfile have changed. Please run `berks update foo` to resolve to a valid version.
|
417
|
+
"""
|
418
|
+
|
419
|
+
Scenario: running install when the version from Berksfile.lock is not found in the sources
|
420
|
+
Given the Chef Server has cookbooks:
|
421
|
+
| foo | 0.3.0 |
|
422
|
+
| foo | 0.2.0 |
|
423
|
+
And the Berkshelf API server's cache is up to date
|
424
|
+
And I have a Berksfile pointing at the local Berkshelf API with:
|
425
|
+
"""
|
426
|
+
cookbook 'foo'
|
427
|
+
"""
|
428
|
+
And I write to "Berksfile.lock" with:
|
429
|
+
"""
|
430
|
+
DEPENDENCIES
|
431
|
+
foo
|
432
|
+
|
433
|
+
GRAPH
|
434
|
+
foo (0.1.0)
|
435
|
+
"""
|
436
|
+
When I run `berks install`
|
437
|
+
Then the output should contain:
|
438
|
+
"""
|
439
|
+
Cookbook 'foo' (0.1.0) not found in any of the sources! This can happen if the remote cookbook has been deleted or if the sources inside the Berksfile have changed. Please run `berks update foo` to resolve to a valid version.
|
440
|
+
"""
|
441
|
+
|
402
442
|
Scenario: installing when there are sources with duplicate names defined in the same group
|
403
443
|
Given I have a Berksfile pointing at the local Berkshelf API with:
|
404
444
|
"""
|
@@ -407,7 +407,7 @@ Feature: berks upload
|
|
407
407
|
"""
|
408
408
|
And the cookbook "fake" has the file "Berksfile" with:
|
409
409
|
"""
|
410
|
-
source 'https://
|
410
|
+
source 'https://supermarket.getchef.com'
|
411
411
|
metadata
|
412
412
|
"""
|
413
413
|
And the cookbook "fake" has the file "Berksfile.lock" with:
|
data/features/config.feature
CHANGED
@@ -3,8 +3,8 @@ Feature: Reading a Berkshelf configuration file
|
|
3
3
|
When I successfully run `berks cookbook sparkle_motion`
|
4
4
|
Then the resulting "sparkle_motion" Vagrantfile should contain:
|
5
5
|
| config.omnibus.chef_version = :latest |
|
6
|
-
| config.vm.box = "
|
7
|
-
| config.vm.box_url = "https://
|
6
|
+
| config.vm.box = "chef/ubuntu-14.04" |
|
7
|
+
| config.vm.box_url = "https://vagrantcloud.com/chef/ubuntu-14.04/version/1/provider/virtualbox.box" |
|
8
8
|
|
9
9
|
Scenario: Using a Berkshelf configuration file that disables the vagrant-omnibus plugin
|
10
10
|
Given I have a Berkshelf config file containing:
|
@@ -25,11 +25,14 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
|
25
25
|
<% end -%>
|
26
26
|
|
27
27
|
# Every Vagrant virtual environment requires a box to build off of.
|
28
|
+
# If this value is a shorthand to a box in Vagrant Cloud then
|
29
|
+
# config.vm.box_url doesn't need to be specified.
|
28
30
|
config.vm.box = "<%= berkshelf_config.vagrant.vm.box %>"
|
29
31
|
|
30
32
|
# The url from where the 'config.vm.box' box will be fetched if it
|
31
|
-
# doesn't already exist on the
|
32
|
-
|
33
|
+
# is not a Vagrant Cloud box and if it doesn't already exist on the
|
34
|
+
# user's system.
|
35
|
+
# config.vm.box_url = "<%= berkshelf_config.vagrant.vm.box_url %>"
|
33
36
|
|
34
37
|
# Assign this VM to a host-only network IP, allowing you to access it
|
35
38
|
# via the IP. Host-only networks can talk to the host machine as well as
|
data/lib/berkshelf/berksfile.rb
CHANGED
@@ -27,7 +27,7 @@ module Berkshelf
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
-
DEFAULT_API_URL = "https://
|
30
|
+
DEFAULT_API_URL = "https://supermarket.getchef.com".freeze
|
31
31
|
|
32
32
|
include Mixin::Logging
|
33
33
|
include Mixin::DSLEval
|
@@ -172,7 +172,7 @@ module Berkshelf
|
|
172
172
|
# in a second source would not be used.
|
173
173
|
#
|
174
174
|
# @example
|
175
|
-
# source "https://
|
175
|
+
# source "https://supermarket.getchef.com"
|
176
176
|
# source "https://berks-api.riotgames.com"
|
177
177
|
#
|
178
178
|
# @param [String] api_url
|
@@ -207,7 +207,7 @@ module Berkshelf
|
|
207
207
|
if args.first == :opscode
|
208
208
|
Berkshelf.formatter.deprecation "Your Berksfile contains a site location pointing to the Opscode Community " +
|
209
209
|
"Site (site :opscode). Site locations have been replaced by the source location. Change this to: " +
|
210
|
-
"'source \"https://
|
210
|
+
"'source \"https://supermarket.getchef.com\"' to remove this warning. For more information visit " +
|
211
211
|
"https://github.com/berkshelf/berkshelf/wiki/deprecated-locations"
|
212
212
|
source(DEFAULT_API_URL)
|
213
213
|
return
|
@@ -445,7 +445,7 @@ module Berkshelf
|
|
445
445
|
# "nginx" => {
|
446
446
|
# "local" => #<Version 1.8.0>,
|
447
447
|
# "remote" => {
|
448
|
-
# #<Source uri: "https://
|
448
|
+
# #<Source uri: "https://supermarket.getchef.com"> #=> #<Version 2.6.2>
|
449
449
|
# }
|
450
450
|
# }
|
451
451
|
# }
|
data/lib/berkshelf/config.rb
CHANGED
@@ -95,11 +95,11 @@ module Berkshelf
|
|
95
95
|
default: false
|
96
96
|
attribute 'vagrant.vm.box',
|
97
97
|
type: String,
|
98
|
-
default: '
|
98
|
+
default: 'chef/ubuntu-14.04',
|
99
99
|
required: true
|
100
100
|
attribute 'vagrant.vm.box_url',
|
101
101
|
type: String,
|
102
|
-
default: 'https://
|
102
|
+
default: 'https://vagrantcloud.com/chef/ubuntu-14.04/version/1/provider/virtualbox.box',
|
103
103
|
required: true
|
104
104
|
attribute 'vagrant.vm.forward_port',
|
105
105
|
type: Hash,
|
data/lib/berkshelf/errors.rb
CHANGED
@@ -2,7 +2,7 @@ module Berkshelf
|
|
2
2
|
class BerkshelfError < StandardError
|
3
3
|
class << self
|
4
4
|
# @param [Integer] code
|
5
|
-
def
|
5
|
+
def set_status_code(code)
|
6
6
|
define_method(:status_code) { code }
|
7
7
|
define_singleton_method(:status_code) { code }
|
8
8
|
end
|
@@ -11,13 +11,13 @@ module Berkshelf
|
|
11
11
|
alias_method :message, :to_s
|
12
12
|
end
|
13
13
|
|
14
|
-
class DeprecatedError < BerkshelfError;
|
15
|
-
class InternalError < BerkshelfError;
|
14
|
+
class DeprecatedError < BerkshelfError; set_status_code(10); end
|
15
|
+
class InternalError < BerkshelfError; set_status_code(99); end
|
16
16
|
class ArgumentError < InternalError; end
|
17
17
|
class AbstractFunction < InternalError; end
|
18
18
|
|
19
19
|
class BerksfileNotFound < BerkshelfError
|
20
|
-
|
20
|
+
set_status_code(100)
|
21
21
|
|
22
22
|
# @param [#to_s] filepath
|
23
23
|
# the path where a Berksfile was not found
|
@@ -31,7 +31,7 @@ module Berkshelf
|
|
31
31
|
end
|
32
32
|
|
33
33
|
class CookbookNotFound < BerkshelfError
|
34
|
-
|
34
|
+
set_status_code(103)
|
35
35
|
|
36
36
|
def initialize(name, version, location)
|
37
37
|
@name = name
|
@@ -49,7 +49,7 @@ module Berkshelf
|
|
49
49
|
end
|
50
50
|
|
51
51
|
class DuplicateDependencyDefined < BerkshelfError
|
52
|
-
|
52
|
+
set_status_code(105)
|
53
53
|
|
54
54
|
def initialize(name)
|
55
55
|
@name = name
|
@@ -64,7 +64,7 @@ module Berkshelf
|
|
64
64
|
end
|
65
65
|
|
66
66
|
class NoSolutionError < BerkshelfError
|
67
|
-
|
67
|
+
set_status_code(106)
|
68
68
|
|
69
69
|
attr_reader :demands
|
70
70
|
|
@@ -80,12 +80,12 @@ module Berkshelf
|
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
|
-
class CookbookSyntaxError < BerkshelfError;
|
84
|
-
class ConstraintNotSatisfied < BerkshelfError;
|
83
|
+
class CookbookSyntaxError < BerkshelfError; set_status_code(107); end
|
84
|
+
class ConstraintNotSatisfied < BerkshelfError; set_status_code(111); end
|
85
85
|
class BerksfileReadError < BerkshelfError
|
86
|
-
|
86
|
+
set_status_code(113)
|
87
87
|
|
88
|
-
# @param [#
|
88
|
+
# @param [#set_status_code] original_error
|
89
89
|
def initialize(original_error)
|
90
90
|
@original_error = original_error
|
91
91
|
@error_message = original_error.to_s
|
@@ -111,7 +111,7 @@ module Berkshelf
|
|
111
111
|
end
|
112
112
|
|
113
113
|
class MismatchedCookbookName < BerkshelfError
|
114
|
-
|
114
|
+
set_status_code(114)
|
115
115
|
|
116
116
|
# @param [Dependency] dependency
|
117
117
|
# the dependency with the expected name
|
@@ -139,7 +139,7 @@ module Berkshelf
|
|
139
139
|
end
|
140
140
|
|
141
141
|
class InvalidConfiguration < BerkshelfError
|
142
|
-
|
142
|
+
set_status_code(115)
|
143
143
|
|
144
144
|
def initialize(errors)
|
145
145
|
@errors = errors
|
@@ -158,7 +158,7 @@ module Berkshelf
|
|
158
158
|
end
|
159
159
|
|
160
160
|
class InsufficientPrivledges < BerkshelfError
|
161
|
-
|
161
|
+
set_status_code(119)
|
162
162
|
|
163
163
|
def initialize(path)
|
164
164
|
@path = path
|
@@ -172,7 +172,7 @@ module Berkshelf
|
|
172
172
|
end
|
173
173
|
|
174
174
|
class DependencyNotFound < BerkshelfError
|
175
|
-
|
175
|
+
set_status_code(120)
|
176
176
|
|
177
177
|
# @param [String, Array<String>] names
|
178
178
|
# the list of cookbook names that were not defined
|
@@ -200,7 +200,7 @@ module Berkshelf
|
|
200
200
|
end
|
201
201
|
|
202
202
|
class CommunitySiteError < BerkshelfError
|
203
|
-
|
203
|
+
set_status_code(123)
|
204
204
|
|
205
205
|
def initialize(uri, message)
|
206
206
|
@uri = uri
|
@@ -214,7 +214,7 @@ module Berkshelf
|
|
214
214
|
end
|
215
215
|
|
216
216
|
class CookbookValidationFailure < BerkshelfError
|
217
|
-
|
217
|
+
set_status_code(124)
|
218
218
|
|
219
219
|
# @param [Location] location
|
220
220
|
# the location (or any subclass) raising this validation error
|
@@ -232,7 +232,7 @@ module Berkshelf
|
|
232
232
|
|
233
233
|
class UploadFailure < BerkshelfError; end
|
234
234
|
class FrozenCookbook < UploadFailure
|
235
|
-
|
235
|
+
set_status_code(126)
|
236
236
|
|
237
237
|
# @param [CachedCookbook] cookbook
|
238
238
|
def initialize(cookbook)
|
@@ -247,7 +247,7 @@ module Berkshelf
|
|
247
247
|
end
|
248
248
|
|
249
249
|
class OutdatedDependency < BerkshelfError
|
250
|
-
|
250
|
+
set_status_code(128)
|
251
251
|
|
252
252
|
# @param [Dependency] locked_dependency
|
253
253
|
# the locked dependency
|
@@ -270,7 +270,7 @@ module Berkshelf
|
|
270
270
|
end
|
271
271
|
|
272
272
|
class EnvironmentNotFound < BerkshelfError
|
273
|
-
|
273
|
+
set_status_code(129)
|
274
274
|
|
275
275
|
def initialize(environment_name)
|
276
276
|
@environment_name = environment_name
|
@@ -282,7 +282,7 @@ module Berkshelf
|
|
282
282
|
end
|
283
283
|
|
284
284
|
class ChefConnectionError < BerkshelfError
|
285
|
-
|
285
|
+
set_status_code(130)
|
286
286
|
|
287
287
|
def to_s
|
288
288
|
'There was an error connecting to the Chef Server'
|
@@ -290,7 +290,7 @@ module Berkshelf
|
|
290
290
|
end
|
291
291
|
|
292
292
|
class UnknownCompressionType < BerkshelfError
|
293
|
-
|
293
|
+
set_status_code(131)
|
294
294
|
|
295
295
|
def initialize(destination)
|
296
296
|
@destination = destination
|
@@ -309,7 +309,7 @@ module Berkshelf
|
|
309
309
|
# @param [Array<#to_s>] files
|
310
310
|
# the list of files that were not valid
|
311
311
|
class InvalidCookbookFiles < BerkshelfError
|
312
|
-
|
312
|
+
set_status_code(132)
|
313
313
|
|
314
314
|
def initialize(cookbook, files)
|
315
315
|
@cookbook = cookbook
|
@@ -328,7 +328,7 @@ module Berkshelf
|
|
328
328
|
end
|
329
329
|
|
330
330
|
class LicenseNotFound < BerkshelfError
|
331
|
-
|
331
|
+
set_status_code(134)
|
332
332
|
|
333
333
|
attr_reader :license
|
334
334
|
|
@@ -345,7 +345,7 @@ module Berkshelf
|
|
345
345
|
# Raised when a cookbook or its recipes contain a space or invalid
|
346
346
|
# character in the path.
|
347
347
|
class ConfigNotFound < BerkshelfError
|
348
|
-
|
348
|
+
set_status_code(135)
|
349
349
|
|
350
350
|
# @param [String] type
|
351
351
|
# the type of config that was not found (Berkshelf, Chef, etc)
|
@@ -362,7 +362,7 @@ module Berkshelf
|
|
362
362
|
end
|
363
363
|
|
364
364
|
class LockfileParserError < BerkshelfError
|
365
|
-
|
365
|
+
set_status_code(136)
|
366
366
|
|
367
367
|
# @param [String] lockfile
|
368
368
|
# the path to the Lockfile
|
@@ -379,7 +379,7 @@ module Berkshelf
|
|
379
379
|
end
|
380
380
|
|
381
381
|
class InvalidSourceURI < BerkshelfError
|
382
|
-
|
382
|
+
set_status_code(137)
|
383
383
|
|
384
384
|
def initialize(url, reason = nil)
|
385
385
|
@url = url
|
@@ -393,10 +393,10 @@ module Berkshelf
|
|
393
393
|
end
|
394
394
|
end
|
395
395
|
|
396
|
-
class DuplicateDemand < BerkshelfError;
|
397
|
-
class VendorError < BerkshelfError;
|
396
|
+
class DuplicateDemand < BerkshelfError; set_status_code(138); end
|
397
|
+
class VendorError < BerkshelfError; set_status_code(139); end
|
398
398
|
class LockfileNotFound < BerkshelfError
|
399
|
-
|
399
|
+
set_status_code(140)
|
400
400
|
|
401
401
|
def to_s
|
402
402
|
'Lockfile not found! Run `berks install` to create the lockfile.'
|
@@ -404,7 +404,7 @@ module Berkshelf
|
|
404
404
|
end
|
405
405
|
|
406
406
|
class NotACookbook < BerkshelfError
|
407
|
-
|
407
|
+
set_status_code(141)
|
408
408
|
|
409
409
|
# @param [String] path
|
410
410
|
# the path to the thing that is not a cookbook
|
@@ -418,10 +418,10 @@ module Berkshelf
|
|
418
418
|
end
|
419
419
|
end
|
420
420
|
|
421
|
-
class PackageError < BerkshelfError;
|
421
|
+
class PackageError < BerkshelfError; set_status_code(143); end
|
422
422
|
|
423
423
|
class LockfileOutOfSync < BerkshelfError
|
424
|
-
|
424
|
+
set_status_code(144)
|
425
425
|
|
426
426
|
def to_s
|
427
427
|
'The lockfile is out of sync! Run `berks install` to sync the lockfile.'
|
@@ -429,7 +429,7 @@ module Berkshelf
|
|
429
429
|
end
|
430
430
|
|
431
431
|
class DependencyNotInstalled < BerkshelfError
|
432
|
-
|
432
|
+
set_status_code(145)
|
433
433
|
|
434
434
|
def initialize(dependency)
|
435
435
|
@name = dependency.name
|
@@ -443,7 +443,7 @@ module Berkshelf
|
|
443
443
|
end
|
444
444
|
|
445
445
|
class NoAPISourcesDefined < BerkshelfError
|
446
|
-
|
446
|
+
set_status_code(146)
|
447
447
|
|
448
448
|
def to_s
|
449
449
|
"Your Berksfile does not define any API sources! You must define " \
|
@@ -451,12 +451,12 @@ module Berkshelf
|
|
451
451
|
"default Berkshelf API server, add the following code to the top of " \
|
452
452
|
"your Berksfile:" \
|
453
453
|
"\n\n" \
|
454
|
-
" source 'https://
|
454
|
+
" source 'https://supermarket.getchef.com'"
|
455
455
|
end
|
456
456
|
end
|
457
457
|
|
458
458
|
class GraphvizNotInstalled < BerkshelfError
|
459
|
-
|
459
|
+
set_status_code(147)
|
460
460
|
|
461
461
|
def to_s
|
462
462
|
"Graphviz is not installed! In order to generate a dependency graph, " \
|
@@ -467,7 +467,7 @@ module Berkshelf
|
|
467
467
|
end
|
468
468
|
|
469
469
|
class GraphvizCommandFailed < BerkshelfError
|
470
|
-
|
470
|
+
set_status_code(148)
|
471
471
|
|
472
472
|
def initialize(command, output)
|
473
473
|
@command = command
|
@@ -480,9 +480,20 @@ module Berkshelf
|
|
480
480
|
end
|
481
481
|
end
|
482
482
|
|
483
|
+
class MissingLockfileCookbookVersion < CookbookNotFound
|
484
|
+
set_status_code(149)
|
485
|
+
|
486
|
+
def to_s
|
487
|
+
super + " " \
|
488
|
+
"This can happen if the remote cookbook has been deleted or if the sources inside the Berksfile have changed. " \
|
489
|
+
"Please run `berks update #{@name}` to resolve to a valid version."
|
490
|
+
end
|
491
|
+
end
|
492
|
+
|
493
|
+
|
483
494
|
# Git errors
|
484
495
|
# ------------------------------
|
485
|
-
class GitError < BerkshelfError;
|
496
|
+
class GitError < BerkshelfError; set_status_code(400); end
|
486
497
|
|
487
498
|
class GitNotInstalled < GitError
|
488
499
|
def initialize
|
@@ -57,7 +57,7 @@ module Berkshelf
|
|
57
57
|
#
|
58
58
|
# @param [Hash] hash
|
59
59
|
# the list of outdated cookbooks in the format
|
60
|
-
# { 'cookbook' => { '
|
60
|
+
# { 'cookbook' => { 'supermarket.getchef.com' => #<Cookbook> } }
|
61
61
|
def outdated(hash)
|
62
62
|
if hash.empty?
|
63
63
|
Berkshelf.ui.info('All cookbooks up to date!')
|
@@ -89,7 +89,7 @@ module Berkshelf
|
|
89
89
|
#
|
90
90
|
# @param [Hash] hash
|
91
91
|
# the list of outdated cookbooks in the format
|
92
|
-
# { 'cookbook' => { '
|
92
|
+
# { 'cookbook' => { 'supermarket.getchef.com' => #<Cookbook> } }
|
93
93
|
def outdated(hash)
|
94
94
|
hash.each do |name, info|
|
95
95
|
info['remote'].each do |remote_source, remote_version|
|
data/lib/berkshelf/installer.rb
CHANGED
@@ -90,6 +90,10 @@ module Berkshelf
|
|
90
90
|
name, version = dependency.name, dependency.locked_version.to_s
|
91
91
|
source = berksfile.source_for(name, version)
|
92
92
|
|
93
|
+
# Raise error if our Berksfile.lock has cookbook versions that
|
94
|
+
# can't be found in sources
|
95
|
+
raise MissingLockfileCookbookVersion.new(name, version, 'in any of the sources') unless source
|
96
|
+
|
93
97
|
Berkshelf.log.debug " Downloading #{dependency.name} (#{dependency.locked_version}) from #{source}"
|
94
98
|
|
95
99
|
cookbook = source.cookbook(name, version)
|
data/lib/berkshelf/version.rb
CHANGED
@@ -64,6 +64,14 @@ describe Berkshelf::CommunityREST do
|
|
64
64
|
let(:api_uri) { Berkshelf::CommunityREST::V1_API }
|
65
65
|
subject { Berkshelf::CommunityREST.new(api_uri) }
|
66
66
|
|
67
|
+
describe '#initialize' do
|
68
|
+
context 'Faraday handlers' do
|
69
|
+
it 'includes follow_redirects to prevent 301 from community, stopping some cookbooks installing' do
|
70
|
+
expect(subject.builder.handlers).to include(Ridley::Middleware::FollowRedirects)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
67
75
|
describe '#download' do
|
68
76
|
let(:archive) { double('archive', path: '/foo/bar', unlink: true) }
|
69
77
|
|
@@ -58,7 +58,7 @@ describe Berkshelf::CookbookGenerator do
|
|
58
58
|
contains "description 'Installs/Configures sparkle_motion'"
|
59
59
|
end
|
60
60
|
file 'Berksfile' do
|
61
|
-
contains 'source "https://
|
61
|
+
contains 'source "https://supermarket.getchef.com"'
|
62
62
|
contains 'metadata'
|
63
63
|
end
|
64
64
|
file 'Gemfile'
|
@@ -30,8 +30,8 @@ describe Berkshelf::InitGenerator do
|
|
30
30
|
file 'Vagrantfile' do
|
31
31
|
contains 'recipe[some_cookbook::default]'
|
32
32
|
contains ' config.omnibus.chef_version = :latest'
|
33
|
-
contains 'config.vm.box = "
|
34
|
-
contains 'config.vm.box_url = "https://
|
33
|
+
contains 'config.vm.box = "chef/ubuntu-14.04"'
|
34
|
+
contains 'config.vm.box_url = "https://vagrantcloud.com/chef/ubuntu-14.04/version/1/provider/virtualbox.box"'
|
35
35
|
end
|
36
36
|
file 'chefignore'
|
37
37
|
}
|
@@ -6,7 +6,7 @@ describe Berkshelf::Installer do
|
|
6
6
|
subject { described_class.new(berksfile) }
|
7
7
|
|
8
8
|
describe "#build_universe" do
|
9
|
-
let(:source_one) { double('one', uri: 'https://
|
9
|
+
let(:source_one) { double('one', uri: 'https://supermarket.getchef.com') }
|
10
10
|
let(:source_two) { double('two', uri: 'https://api.chef.org') }
|
11
11
|
let(:sources) { [ source_one, source_two ] }
|
12
12
|
|
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: 3.1.
|
4
|
+
version: 3.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jamie Winsor
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2014-
|
15
|
+
date: 2014-07-14 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: addressable
|