berkshelf 1.4.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +16 -0
- data/PLUGINS.md +24 -0
- data/README.md +20 -0
- data/berkshelf.gemspec +12 -11
- data/features/install_command.feature +12 -0
- data/features/support/env.rb +2 -2
- data/lib/berkshelf/berksfile.rb +3 -1
- data/lib/berkshelf/cookbook_source.rb +25 -20
- data/lib/berkshelf/errors.rb +11 -0
- data/lib/berkshelf/locations/site_location.rb +6 -2
- data/lib/berkshelf/version.rb +1 -1
- data/spec/unit/berkshelf/berksfile_spec.rb +99 -1
- metadata +4 -6
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
# 1.4.1
|
2
|
+
|
3
|
+
- Berksfile#upload will now honor the given server_url option
|
4
|
+
- Add validation to shortnames of 'site' in Berksfile
|
5
|
+
- Fix init generator issue by locking to the appropriate version of Rubygems
|
6
|
+
|
7
|
+
# 1.4.0
|
8
|
+
|
9
|
+
- Add ability to freeze cookbooks. Cookbooks are frozen on upload by default
|
10
|
+
- Add ability to forcefully upload cookbooks even if they are frozen with the `--force` option
|
11
|
+
- Add `berks info` command for displaying information about cookbooks in your Berkshelf
|
12
|
+
- Add `berks contingent` command for displaying a list of cookbooks which are dependent upon one another
|
13
|
+
- Cookbook generator now has the option of generating chef minispec files (false by default)
|
14
|
+
- Fix bug in downloading cookbooks which were packaged as plain tars instead of tar.gzs
|
15
|
+
- Path locations will now be relative to the Berksfile they are defined in
|
16
|
+
|
1
17
|
# 1.3.1
|
2
18
|
- Support for Vagrant 1.1.x
|
3
19
|
- Move Berkshelf Vagrant plugin into it's [own repository](https://github.com/RiotGames/berkshelf-vagrant)
|
data/PLUGINS.md
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
Berkshelf Plugins
|
2
|
+
=================
|
3
|
+
This is a list of community-contributed plugins for Berkshelf. A few notes:
|
4
|
+
|
5
|
+
- Please do not open issues regarding a community plugin on Berkshelf. Create the issue on the plugin first please.
|
6
|
+
- Plugins are listed in alphabetical order for consistency.
|
7
|
+
|
8
|
+
Plugins
|
9
|
+
-------
|
10
|
+
- [berkshelf-shims](https://github.com/JeffBellegarde/berkshelf-shims) - Provide shims functionality for Berkshelf.
|
11
|
+
- [vagrant-berkshelf](https://github.com/RiotGames/vagrant-berkshelf) - A Vagrant plugin to add Berkshelf integration to the Chef provisioners.
|
12
|
+
|
13
|
+
I want to add my plugin!
|
14
|
+
------------------------
|
15
|
+
1. Plugins should be prefixed with `berkshelf-` for consistency.
|
16
|
+
1. Create your plugin on github - be sure to include tests. We will most likely not list a plugin that is untested.
|
17
|
+
1. Fork the Berkshelf project on github.
|
18
|
+
1. Edit this file, adding your plugin. All plugins must be on github. The format for a plugin is:
|
19
|
+
|
20
|
+
[Linked Project Name](#) - A short description of the plugin, what it does, why it exists, etc. ([Optional Link to Plugin Website](#))
|
21
|
+
|
22
|
+
For example:
|
23
|
+
|
24
|
+
[berkshelf-myface](https://github.com/RiotGames/berkshelf-myface) - A plugin to add myface support to Berkshelf.
|
data/README.md
CHANGED
@@ -37,6 +37,26 @@ And make sure you have this in your bash/zsh profile:
|
|
37
37
|
|
38
38
|
[ -f `brew --prefix`/etc/bash_completion ] && source `brew --prefix`/etc/bash_completion
|
39
39
|
|
40
|
+
Plugins
|
41
|
+
-------
|
42
|
+
Please see [Plugins page](https://github.com/RiotGames/berkshelf/blob/master/PLUGINS.md) for more information.
|
43
|
+
|
44
|
+
SSL Errors
|
45
|
+
----------
|
46
|
+
|
47
|
+
If you have trouble getting Berkshelf to successfully talk to an SSL Chef server, you can try making sure you
|
48
|
+
have a certificate bundle available to your shell. `export SSL_CERT_FILE=...path/to/cert/file...`
|
49
|
+
|
50
|
+
If you need to disable SSL, you can in `~/.berkshelf/config.json` like so:
|
51
|
+
|
52
|
+
```
|
53
|
+
{
|
54
|
+
"ssl": {
|
55
|
+
"verify": false
|
56
|
+
}
|
57
|
+
}
|
58
|
+
```
|
59
|
+
|
40
60
|
Authors
|
41
61
|
-------
|
42
62
|
- Jamie Winsor (<reset@riotgames.com>)
|
data/berkshelf.gemspec
CHANGED
@@ -15,17 +15,18 @@ Gem::Specification.new do |s|
|
|
15
15
|
"justin.campbell@riotgames.com"
|
16
16
|
]
|
17
17
|
|
18
|
-
s.description
|
19
|
-
s.summary
|
20
|
-
s.homepage
|
21
|
-
s.license
|
22
|
-
s.files
|
23
|
-
s.executables
|
24
|
-
s.test_files
|
25
|
-
s.name
|
26
|
-
s.require_paths
|
27
|
-
s.version
|
28
|
-
s.required_ruby_version
|
18
|
+
s.description = %q{Manages a Cookbook's, or an Application's, Cookbook dependencies}
|
19
|
+
s.summary = s.description
|
20
|
+
s.homepage = "http://berkshelf.com"
|
21
|
+
s.license = "Apache 2.0"
|
22
|
+
s.files = `git ls-files`.split($\)
|
23
|
+
s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
24
|
+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
25
|
+
s.name = "berkshelf"
|
26
|
+
s.require_paths = ["lib"]
|
27
|
+
s.version = Berkshelf::VERSION
|
28
|
+
s.required_ruby_version = ">= 1.9.1"
|
29
|
+
s.required_rubygems_version = ">= 1.8.0"
|
29
30
|
|
30
31
|
s.add_dependency 'celluloid', '>= 0.13.0'
|
31
32
|
s.add_dependency 'yajl-ruby'
|
@@ -318,3 +318,15 @@ Feature: install cookbooks from a Berksfile
|
|
318
318
|
An error occured during Git execution:
|
319
319
|
"""
|
320
320
|
And the CLI should exit with the status code for error "GitError"
|
321
|
+
|
322
|
+
Scenario: invalid site symbol
|
323
|
+
Given I write to "Berksfile" with:
|
324
|
+
"""
|
325
|
+
site :somethingabsurd
|
326
|
+
cookbook "ohai"
|
327
|
+
"""
|
328
|
+
When I run `berks install`
|
329
|
+
Then the output should contain:
|
330
|
+
"""
|
331
|
+
Unknown site shortname: :somethingabsurd. Supported shortnames are: :opscode
|
332
|
+
"""
|
data/features/support/env.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
ENV['RUBY_ENV'] == 'test'
|
2
|
-
|
3
1
|
require 'rubygems'
|
4
2
|
require 'bundler'
|
5
3
|
require 'spork'
|
@@ -12,6 +10,7 @@ Spork.prefork do
|
|
12
10
|
|
13
11
|
APP_ROOT = File.expand_path('../../../', __FILE__)
|
14
12
|
|
13
|
+
ENV['RUBY_ENV'] = 'test'
|
15
14
|
ENV["BERKSHELF_PATH"] = File.join(APP_ROOT, "tmp", "berkshelf")
|
16
15
|
ENV["BERKSHELF_CHEF_CONFIG"] = File.join(APP_ROOT, "spec", "knife.rb")
|
17
16
|
|
@@ -32,6 +31,7 @@ Spork.prefork do
|
|
32
31
|
World(Berkshelf::TestGenerators)
|
33
32
|
|
34
33
|
Before do
|
34
|
+
set_env 'RUBY_ENV', 'test'
|
35
35
|
clean_cookbook_store
|
36
36
|
generate_berks_config(File.join(ENV["BERKSHELF_PATH"], 'config.json'))
|
37
37
|
@aruba_io_wait_seconds = 5
|
data/lib/berkshelf/berksfile.rb
CHANGED
@@ -465,6 +465,8 @@ module Berkshelf
|
|
465
465
|
# @option options [Boolean] :halt_on_frozen (false)
|
466
466
|
# Raise a FrozenCookbook error if one of the cookbooks being uploaded is already located
|
467
467
|
# on the remote Chef Server and frozen.
|
468
|
+
# @option options [String] :server_url
|
469
|
+
# An overriding Chef Server to upload the cookbooks to
|
468
470
|
#
|
469
471
|
# @raise [UploadFailure] if you are uploading cookbooks with an invalid or not-specified client key
|
470
472
|
# @raise [Berkshelf::FrozenCookbook]
|
@@ -480,7 +482,7 @@ module Berkshelf
|
|
480
482
|
)
|
481
483
|
|
482
484
|
ridley_options = options.slice(:ssl)
|
483
|
-
ridley_options[:server_url] = Berkshelf::Config.instance.chef.chef_server_url
|
485
|
+
ridley_options[:server_url] = options[:server_url] || Berkshelf::Config.instance.chef.chef_server_url
|
484
486
|
ridley_options[:client_name] = Berkshelf::Config.instance.chef.node_name
|
485
487
|
ridley_options[:client_key] = Berkshelf::Config.instance.chef.client_key
|
486
488
|
ridley_options[:ssl] = { verify: options[:ssl_verify] }
|
@@ -68,32 +68,37 @@ module Berkshelf
|
|
68
68
|
|
69
69
|
extend Forwardable
|
70
70
|
|
71
|
+
# @return [Berkshelf::Berksfile]
|
71
72
|
attr_reader :berksfile
|
73
|
+
# @return [String]
|
72
74
|
attr_reader :name
|
73
|
-
|
75
|
+
# @return [Solve::Constraint]
|
74
76
|
attr_reader :version_constraint
|
77
|
+
# @return [Berkshelf::CachedCookbook]
|
75
78
|
attr_accessor :cached_cookbook
|
76
79
|
|
77
|
-
#
|
78
|
-
#
|
80
|
+
# @param [Berkshelf::Berksfile] berksfile
|
81
|
+
# the berksfile this source belongs to
|
82
|
+
# @param [String] name
|
83
|
+
# the name of source
|
79
84
|
#
|
80
|
-
#
|
81
|
-
#
|
82
|
-
#
|
83
|
-
#
|
84
|
-
#
|
85
|
-
#
|
86
|
-
#
|
87
|
-
#
|
88
|
-
#
|
89
|
-
#
|
90
|
-
#
|
91
|
-
#
|
92
|
-
#
|
93
|
-
#
|
94
|
-
#
|
95
|
-
#
|
96
|
-
#
|
85
|
+
# @option options [String, Solve::Constraint] :constraint
|
86
|
+
# version constraint to resolve for this source
|
87
|
+
# @option options [String] :git
|
88
|
+
# the Git URL to clone
|
89
|
+
# @option options [String] :site
|
90
|
+
# a URL pointing to a community API endpoint
|
91
|
+
# @option options [String] :path
|
92
|
+
# a filepath to the cookbook on your local disk
|
93
|
+
# @option options [Symbol, Array] :group
|
94
|
+
# the group or groups that the cookbook belongs to
|
95
|
+
# @option options [String] :ref
|
96
|
+
# the commit hash or an alias to a commit hash to clone
|
97
|
+
# @option options [String] :branch
|
98
|
+
# same as ref
|
99
|
+
# @option options [String] :tag
|
100
|
+
# same as tag
|
101
|
+
# @option options [String] :locked_version
|
97
102
|
def initialize(berksfile, name, options = {})
|
98
103
|
self.class.validate_options(options)
|
99
104
|
|
data/lib/berkshelf/errors.rb
CHANGED
@@ -152,4 +152,15 @@ module Berkshelf
|
|
152
152
|
|
153
153
|
class UploadFailure < BerkshelfError; end
|
154
154
|
class FrozenCookbook < UploadFailure; status_code(126); end
|
155
|
+
class InvalidSiteShortnameError < BerkshelfError
|
156
|
+
status_code(127)
|
157
|
+
|
158
|
+
def initialize(shortname)
|
159
|
+
@shortname = shortname
|
160
|
+
end
|
161
|
+
|
162
|
+
def to_s
|
163
|
+
"Unknown site shortname: #{@shortname.inspect}. Supported shortnames are: #{SiteLocation::SHORTNAMES.keys.map(&:inspect).join(',')}"
|
164
|
+
end
|
165
|
+
end
|
155
166
|
end
|
@@ -9,6 +9,8 @@ module Berkshelf
|
|
9
9
|
def_delegator :conn, :api_uri
|
10
10
|
attr_accessor :version_constraint
|
11
11
|
|
12
|
+
SHORTNAMES = {opscode: CommunityREST::V1_API}.freeze
|
13
|
+
|
12
14
|
# @param [#to_s] name
|
13
15
|
# @param [Solve::Constraint] version_constraint
|
14
16
|
# @param [Hash] options
|
@@ -20,8 +22,10 @@ module Berkshelf
|
|
20
22
|
@name = name
|
21
23
|
@version_constraint = version_constraint
|
22
24
|
|
23
|
-
api_uri = if options[:site].nil? || options[:site]
|
24
|
-
|
25
|
+
api_uri = if options[:site].nil? || SHORTNAMES.has_key?(options[:site])
|
26
|
+
SHORTNAMES[options[:site]]
|
27
|
+
elsif options[:site].kind_of?(Symbol)
|
28
|
+
raise InvalidSiteShortnameError.new(options[:site])
|
25
29
|
else
|
26
30
|
options[:site]
|
27
31
|
end
|
data/lib/berkshelf/version.rb
CHANGED
@@ -402,6 +402,104 @@ EOF
|
|
402
402
|
end
|
403
403
|
|
404
404
|
describe "#upload" do
|
405
|
-
|
405
|
+
let(:upload) { subject.upload(options) }
|
406
|
+
let(:options) { Hash.new }
|
407
|
+
let(:ssl) { double('ssl', verify: true) }
|
408
|
+
let(:chef) {
|
409
|
+
double('chef',
|
410
|
+
node_name: "fake-client",
|
411
|
+
client_key: "client-key",
|
412
|
+
chef_server_url: "http://configured-chef-server/")
|
413
|
+
}
|
414
|
+
let(:berkshelf_config) { double('berks', ssl: ssl, chef: chef) }
|
415
|
+
let(:default_ridley_options) {
|
416
|
+
{
|
417
|
+
client_name: "fake-client",
|
418
|
+
client_key: "client-key",
|
419
|
+
ssl: {
|
420
|
+
verify: true
|
421
|
+
}
|
422
|
+
}
|
423
|
+
}
|
424
|
+
|
425
|
+
before do
|
426
|
+
Berkshelf::Config.stub(:instance).and_return(berkshelf_config)
|
427
|
+
subject.stub(:resolve).and_return([])
|
428
|
+
end
|
429
|
+
|
430
|
+
context "when there is no :server_url" do
|
431
|
+
let(:chef) {
|
432
|
+
double('chef',
|
433
|
+
node_name: "fake-client",
|
434
|
+
client_key: "client-key",
|
435
|
+
chef_server_url: nil)
|
436
|
+
}
|
437
|
+
let(:message) { "Missing required attribute in your Berkshelf configuration: chef.server_url" }
|
438
|
+
|
439
|
+
it "raises an error" do
|
440
|
+
expect {
|
441
|
+
upload
|
442
|
+
}.to raise_error(Berkshelf::UploadFailure, message)
|
443
|
+
end
|
444
|
+
end
|
445
|
+
|
446
|
+
context "when there is no :client_name" do
|
447
|
+
let(:chef) {
|
448
|
+
double('chef',
|
449
|
+
node_name: nil,
|
450
|
+
client_key: "client-key",
|
451
|
+
chef_server_url: "http://configured-chef-server/")
|
452
|
+
}
|
453
|
+
let(:message) { "Missing required attribute in your Berkshelf configuration: chef.node_name" }
|
454
|
+
|
455
|
+
it "raises an error" do
|
456
|
+
expect {
|
457
|
+
upload
|
458
|
+
}.to raise_error(Berkshelf::UploadFailure, message)
|
459
|
+
end
|
460
|
+
end
|
461
|
+
|
462
|
+
context "when there is no :client_key" do
|
463
|
+
let(:chef) {
|
464
|
+
double('chef',
|
465
|
+
node_name: "fake-client",
|
466
|
+
client_key: nil,
|
467
|
+
chef_server_url: "http://configured-chef-server/")
|
468
|
+
}
|
469
|
+
let(:message) { "Missing required attribute in your Berkshelf configuration: chef.client_key" }
|
470
|
+
|
471
|
+
it "raises an error" do
|
472
|
+
expect {
|
473
|
+
upload
|
474
|
+
}.to raise_error(Berkshelf::UploadFailure, message)
|
475
|
+
end
|
476
|
+
end
|
477
|
+
|
478
|
+
context "when a Chef Server url is not passed as an option" do
|
479
|
+
let(:ridley_options) do
|
480
|
+
{server_url: "http://configured-chef-server/"}.merge(default_ridley_options)
|
481
|
+
end
|
482
|
+
|
483
|
+
it "uses Berkshelf::Config configured server_url" do
|
484
|
+
Ridley.should_receive(:new).with(ridley_options)
|
485
|
+
upload
|
486
|
+
end
|
487
|
+
end
|
488
|
+
|
489
|
+
context "when a Chef Server url is passed as an option" do
|
490
|
+
let(:options) {
|
491
|
+
{
|
492
|
+
server_url: "http://fake-chef-server.com/"
|
493
|
+
}
|
494
|
+
}
|
495
|
+
let(:ridley_options) {
|
496
|
+
{server_url: "http://fake-chef-server.com/"}.merge(default_ridley_options)
|
497
|
+
}
|
498
|
+
|
499
|
+
it "uses the passed in :server_url" do
|
500
|
+
Ridley.should_receive(:new).with(ridley_options)
|
501
|
+
upload
|
502
|
+
end
|
503
|
+
end
|
406
504
|
end
|
407
505
|
end
|
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: 1.4.
|
4
|
+
version: 1.4.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2013-04-
|
15
|
+
date: 2013-04-30 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: celluloid
|
@@ -450,6 +450,7 @@ files:
|
|
450
450
|
- Gemfile
|
451
451
|
- Guardfile
|
452
452
|
- LICENSE
|
453
|
+
- PLUGINS.md
|
453
454
|
- README.md
|
454
455
|
- Thorfile
|
455
456
|
- berkshelf-complete.sh
|
@@ -635,10 +636,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
635
636
|
requirements:
|
636
637
|
- - ! '>='
|
637
638
|
- !ruby/object:Gem::Version
|
638
|
-
version:
|
639
|
-
segments:
|
640
|
-
- 0
|
641
|
-
hash: -3407693517536282074
|
639
|
+
version: 1.8.0
|
642
640
|
requirements: []
|
643
641
|
rubyforge_project:
|
644
642
|
rubygems_version: 1.8.23
|