berkshelf 7.0.8 → 7.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/Rakefile +1 -1
- data/lib/berkshelf.rb +1 -1
- data/lib/berkshelf/api_client/chef_server_connection.rb +3 -2
- data/lib/berkshelf/api_client/connection.rb +1 -1
- data/lib/berkshelf/berksfile.rb +11 -9
- data/lib/berkshelf/cached_cookbook.rb +5 -3
- data/lib/berkshelf/chef_repo_universe.rb +4 -2
- data/lib/berkshelf/cli.rb +1 -1
- data/lib/berkshelf/commands/shelf.rb +1 -1
- data/lib/berkshelf/community_rest.rb +3 -3
- data/lib/berkshelf/config.rb +1 -1
- data/lib/berkshelf/core_ext.rb +1 -1
- data/lib/berkshelf/dependency.rb +1 -1
- data/lib/berkshelf/downloader.rb +5 -2
- data/lib/berkshelf/errors.rb +2 -2
- data/lib/berkshelf/formatters/human.rb +1 -1
- data/lib/berkshelf/formatters/json.rb +1 -1
- data/lib/berkshelf/installer.rb +1 -1
- data/lib/berkshelf/lockfile.rb +2 -2
- data/lib/berkshelf/logger.rb +4 -2
- data/lib/berkshelf/mixin/git.rb +1 -1
- data/lib/berkshelf/resolver.rb +1 -1
- data/lib/berkshelf/ridley_compat.rb +1 -1
- data/lib/berkshelf/shell.rb +1 -0
- data/lib/berkshelf/source.rb +6 -5
- data/lib/berkshelf/ssl_policies.rb +1 -3
- data/lib/berkshelf/thor.rb +1 -1
- data/lib/berkshelf/thor_ext.rb +1 -1
- data/lib/berkshelf/uploader.rb +4 -2
- data/lib/berkshelf/version.rb +1 -1
- data/lib/berkshelf/visualizer.rb +1 -1
- data/spec/config/knife.rb +1 -1
- data/spec/support/chef_server.rb +2 -2
- data/spec/unit/berkshelf/berksfile_spec.rb +7 -7
- data/spec/unit/berkshelf/cli_spec.rb +1 -2
- data/spec/unit/berkshelf/community_rest_spec.rb +1 -1
- data/spec/unit/berkshelf/dependency_spec.rb +5 -5
- data/spec/unit/berkshelf/downloader_spec.rb +4 -8
- data/spec/unit/berkshelf/locations/base_spec.rb +1 -2
- data/spec/unit/berkshelf/locations/path_spec.rb +1 -2
- data/spec/unit/berkshelf/lockfile_spec.rb +9 -18
- data/spec/unit/berkshelf/ridley_compat_spec.rb +1 -1
- data/spec/unit/berkshelf/source_spec.rb +8 -7
- data/spec/unit/berkshelf/ssl_policies_spec.rb +3 -5
- data/spec/unit/berkshelf/uploader_spec.rb +6 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f8c64894fa5e6b2ec2e82b6cc2f4835d67faf33204e5bf1412e4a5eea9fb0b0
|
4
|
+
data.tar.gz: 3dd04763b8ac3735045e7296e498d112dcba3d34fef9c32263f7f8b557faa149
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16a792fea670f247f48880b806f47fa2c50c55aa5cc1c255f2a7f47232adea30eb6360c7f2c957b51c380555dc9aaa6ec242f657ec88101dc5804a4147220954
|
7
|
+
data.tar.gz: 15e850ce857ec01c3b42f319fc159169d7211bf5eb2ed828dec7b4010607860ba47abab36269f1a8fd83817e3310a5b299ed2a32f6de8e7ca4ff412e8534fb51
|
data/Gemfile
CHANGED
@@ -13,6 +13,7 @@ end
|
|
13
13
|
group :development do
|
14
14
|
# these all deliberately float because berkshelf has a Gemfile.lock that
|
15
15
|
# equality pins them. temporarily pin as necessary for API breaks.
|
16
|
+
gem "chef-bin" # for the proxy tests
|
16
17
|
gem "aruba", ">= 0.10.0"
|
17
18
|
gem "cucumber-expressions", "= 5.0.13"
|
18
19
|
gem "chef-zero", ">= 4.0"
|
data/Rakefile
CHANGED
data/lib/berkshelf.rb
CHANGED
@@ -23,7 +23,7 @@ JSON.create_id = nil
|
|
23
23
|
|
24
24
|
require_relative "berkshelf/core_ext"
|
25
25
|
require_relative "berkshelf/thor_ext"
|
26
|
-
|
26
|
+
require_relative "berkshelf/chef_config_compat"
|
27
27
|
|
28
28
|
module Berkshelf
|
29
29
|
Encoding.default_external = Encoding::UTF_8
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
require_relative "../ridley_compat"
|
2
2
|
|
3
3
|
module Berkshelf
|
4
4
|
module APIClient
|
@@ -19,7 +19,8 @@ module Berkshelf
|
|
19
19
|
response.each do |name, versions|
|
20
20
|
versions.each do |version, attributes|
|
21
21
|
attributes[:location_path] = @url
|
22
|
-
cookbooks << RemoteCookbook.new(name, version, attributes)
|
22
|
+
cookbooks << RemoteCookbook.new(name, version, attributes)
|
23
|
+
end
|
23
24
|
end
|
24
25
|
end
|
25
26
|
rescue Ridley::Errors::HTTPNotFound
|
data/lib/berkshelf/berksfile.rb
CHANGED
@@ -13,7 +13,7 @@ module Berkshelf
|
|
13
13
|
def from_options(options = {})
|
14
14
|
options[:berksfile] ||= File.join(Dir.pwd, Berkshelf::DEFAULT_FILENAME)
|
15
15
|
symbolized = Hash[options.map { |k, v| [k.to_sym, v] }]
|
16
|
-
from_file(options[:berksfile], symbolized.select { |k,|
|
16
|
+
from_file(options[:berksfile], symbolized.select { |k,| %i{except only delete}.include? k })
|
17
17
|
end
|
18
18
|
|
19
19
|
# @param [#to_s] file
|
@@ -66,8 +66,8 @@ module Berkshelf
|
|
66
66
|
# group to be installed and all others to be ignored
|
67
67
|
def initialize(path, options = {})
|
68
68
|
@filepath = File.expand_path(path)
|
69
|
-
@dependencies =
|
70
|
-
@sources =
|
69
|
+
@dependencies = {}
|
70
|
+
@sources = {}
|
71
71
|
@delete = options[:delete]
|
72
72
|
|
73
73
|
# defaults for what solvers to use
|
@@ -146,7 +146,7 @@ module Berkshelf
|
|
146
146
|
# @see PathLocation
|
147
147
|
# @see GitLocation
|
148
148
|
def cookbook(*args)
|
149
|
-
options = args.last.is_a?(Hash) ? args.pop :
|
149
|
+
options = args.last.is_a?(Hash) ? args.pop : {}
|
150
150
|
name, constraint = args
|
151
151
|
|
152
152
|
options[:path] &&= File.expand_path(options[:path], File.dirname(filepath))
|
@@ -176,10 +176,10 @@ module Berkshelf
|
|
176
176
|
# @option options [String] :path
|
177
177
|
# path to the metadata file
|
178
178
|
def metadata(options = {})
|
179
|
-
path
|
179
|
+
path = options[:path] || File.dirname(filepath)
|
180
180
|
|
181
181
|
loader = Chef::Cookbook::CookbookVersionLoader.new(path)
|
182
|
-
loader.
|
182
|
+
loader.load!
|
183
183
|
cookbook_version = loader.cookbook_version
|
184
184
|
metadata = cookbook_version.metadata
|
185
185
|
|
@@ -282,7 +282,7 @@ module Berkshelf
|
|
282
282
|
if @dependencies[name]
|
283
283
|
# Only raise an exception if the dependency is a true duplicate
|
284
284
|
groups = (options[:group].nil? || options[:group].empty?) ? [:default] : options[:group]
|
285
|
-
|
285
|
+
unless (@dependencies[name].groups & groups).empty?
|
286
286
|
raise DuplicateDependencyDefined.new(name)
|
287
287
|
end
|
288
288
|
end
|
@@ -500,7 +500,7 @@ module Berkshelf
|
|
500
500
|
latest = cookbooks.select do |cookbook|
|
501
501
|
(include_non_satisfying || dependency.version_constraint.satisfies?(cookbook.version)) &&
|
502
502
|
Semverse::Version.coerce(cookbook.version) > dependency.locked_version
|
503
|
-
end.sort_by
|
503
|
+
end.sort_by(&:version).last
|
504
504
|
|
505
505
|
unless latest.nil?
|
506
506
|
hash[name] ||= {
|
@@ -659,7 +659,7 @@ module Berkshelf
|
|
659
659
|
files.reject! { |file_path| chefignore.ignored?(file_path) }
|
660
660
|
|
661
661
|
# convert Pathname objects back to strings
|
662
|
-
files.map!
|
662
|
+
files.map!(&:to_s)
|
663
663
|
|
664
664
|
# copy each file to destination
|
665
665
|
files.each do |rpath|
|
@@ -748,6 +748,7 @@ module Berkshelf
|
|
748
748
|
# @return [true]
|
749
749
|
def validate_lockfile_present!
|
750
750
|
raise LockfileNotFound unless lockfile.present?
|
751
|
+
|
751
752
|
true
|
752
753
|
end
|
753
754
|
|
@@ -761,6 +762,7 @@ module Berkshelf
|
|
761
762
|
# @return [true]
|
762
763
|
def validate_lockfile_trusted!
|
763
764
|
raise LockfileOutOfSync unless lockfile.trusted?
|
765
|
+
|
764
766
|
true
|
765
767
|
end
|
766
768
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require "chef/cookbook/cookbook_version_loader"
|
2
2
|
require "chef/cookbook/syntax_check"
|
3
|
-
|
3
|
+
require_relative "errors"
|
4
4
|
require "chef/json_compat"
|
5
5
|
|
6
6
|
module Berkshelf
|
@@ -66,7 +66,7 @@ module Berkshelf
|
|
66
66
|
@loader ||=
|
67
67
|
begin
|
68
68
|
loader = Chef::Cookbook::CookbookVersionLoader.new(@path)
|
69
|
-
loader.
|
69
|
+
loader.load!
|
70
70
|
loader
|
71
71
|
end
|
72
72
|
end
|
@@ -151,7 +151,8 @@ module Berkshelf
|
|
151
151
|
def validate
|
152
152
|
raise IOError, "No Cookbook found at: #{path}" unless path.exist?
|
153
153
|
|
154
|
-
syntax_checker = Chef::Cookbook::SyntaxCheck.
|
154
|
+
syntax_checker = Chef::Cookbook::SyntaxCheck.new(path.to_path)
|
155
|
+
|
155
156
|
unless syntax_checker.validate_ruby_files
|
156
157
|
raise Berkshelf::Errors::CookbookSyntaxError, "Invalid ruby files in cookbook: #{cookbook_name} (#{version})."
|
157
158
|
end
|
@@ -166,6 +167,7 @@ module Berkshelf
|
|
166
167
|
json_file = "#{path}/metadata.json"
|
167
168
|
rb_file = "#{path}/metadata.rb"
|
168
169
|
return nil if File.exist?(json_file)
|
170
|
+
|
169
171
|
md = Chef::Cookbook::Metadata.new
|
170
172
|
md.from_file(rb_file)
|
171
173
|
f = File.open(json_file, "w")
|
@@ -1,5 +1,5 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
require_relative "api_client/remote_cookbook"
|
2
|
+
require_relative "cached_cookbook"
|
3
3
|
|
4
4
|
module Berkshelf
|
5
5
|
# Shim to look like a Berkshelf::APIClient but for a chef repo folder.
|
@@ -15,8 +15,10 @@ module Berkshelf
|
|
15
15
|
def universe
|
16
16
|
Dir.entries(cookbooks_path).sort.each_with_object([]) do |entry, cookbooks|
|
17
17
|
next if entry[0] == "." # Skip hidden folders.
|
18
|
+
|
18
19
|
entry_path = "#{cookbooks_path}/#{entry}"
|
19
20
|
next unless File.directory?(entry_path) # Skip non-dirs.
|
21
|
+
|
20
22
|
cookbook = begin
|
21
23
|
Berkshelf::CachedCookbook.from_path(entry_path)
|
22
24
|
rescue IOError
|
data/lib/berkshelf/cli.rb
CHANGED
@@ -13,7 +13,7 @@ module Berkshelf
|
|
13
13
|
else
|
14
14
|
Berkshelf.formatter.msg "Cookbooks in the Berkshelf shelf:"
|
15
15
|
cookbooks.sort.each do |cookbook, versions|
|
16
|
-
Berkshelf.formatter.msg(" * #{cookbook} (#{versions.sort.join(
|
16
|
+
Berkshelf.formatter.msg(" * #{cookbook} (#{versions.sort.join(", ")})")
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -69,10 +69,10 @@ module Berkshelf
|
|
69
69
|
# how often we should pause between retries
|
70
70
|
def initialize(uri = V1_API, options = {})
|
71
71
|
options = options.dup
|
72
|
-
options
|
73
|
-
@api_uri
|
72
|
+
options = { retries: 5, retry_interval: 0.5, ssl: Berkshelf::Config.instance.ssl }.merge(options)
|
73
|
+
@api_uri = uri
|
74
74
|
options[:server_url] = uri
|
75
|
-
@retries
|
75
|
+
@retries = options.delete(:retries)
|
76
76
|
@retry_interval = options.delete(:retry_interval)
|
77
77
|
|
78
78
|
@connection = Berkshelf::RidleyCompatJSON.new(options)
|
data/lib/berkshelf/config.rb
CHANGED
data/lib/berkshelf/core_ext.rb
CHANGED
data/lib/berkshelf/dependency.rb
CHANGED
data/lib/berkshelf/downloader.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require "net/http"
|
2
2
|
require "mixlib/archive"
|
3
|
-
|
3
|
+
require_relative "ssl_policies"
|
4
|
+
require "faraday"
|
4
5
|
|
5
6
|
module Berkshelf
|
6
7
|
class Downloader
|
@@ -120,7 +121,7 @@ module Berkshelf
|
|
120
121
|
)
|
121
122
|
|
122
123
|
begin
|
123
|
-
url = URI(github_client.archive_link(cookbook_uri.path.gsub(
|
124
|
+
url = URI(github_client.archive_link(cookbook_uri.path.gsub(%r{^/}, ""), ref: "v#{version}"))
|
124
125
|
rescue Octokit::Unauthorized
|
125
126
|
return nil
|
126
127
|
end
|
@@ -131,6 +132,7 @@ module Berkshelf
|
|
131
132
|
http.verify_mode = (options["ssl_verify"].nil? || options["ssl_verify"]) ? OpenSSL::SSL::VERIFY_PEER : OpenSSL::SSL::VERIFY_NONE
|
132
133
|
resp = http.get(url.request_uri)
|
133
134
|
return nil unless resp.is_a?(Net::HTTPSuccess)
|
135
|
+
|
134
136
|
open(archive_path, "wb") { |file| file.write(resp.body) }
|
135
137
|
|
136
138
|
Mixlib::Archive.new(archive_path).extract(unpack_dir)
|
@@ -183,6 +185,7 @@ module Berkshelf
|
|
183
185
|
|
184
186
|
resp = connection.get(cookbook_uri.request_uri + "&private_token=" + options["private_token"])
|
185
187
|
return nil unless resp.status == 200
|
188
|
+
|
186
189
|
open(archive_path, "wb") { |file| file.write(resp.body) }
|
187
190
|
|
188
191
|
Mixlib::Archive.new(archive_path).extract(unpack_dir)
|
data/lib/berkshelf/errors.rb
CHANGED
@@ -83,7 +83,7 @@ module Berkshelf
|
|
83
83
|
|
84
84
|
def to_s
|
85
85
|
@original_exception.to_s +
|
86
|
-
"Unable to find a solution for demands: #{demands.join(
|
86
|
+
"Unable to find a solution for demands: #{demands.join(", ")}"
|
87
87
|
end
|
88
88
|
|
89
89
|
alias_method :message, :to_s
|
@@ -372,7 +372,7 @@ module Berkshelf
|
|
372
372
|
|
373
373
|
def to_s
|
374
374
|
"Unknown license: '#{license}'\n" +
|
375
|
-
"Available licenses: #{CookbookGenerator::LICENSES.join(
|
375
|
+
"Available licenses: #{CookbookGenerator::LICENSES.join(", ")}"
|
376
376
|
end
|
377
377
|
|
378
378
|
alias_method :message, :to_s
|
@@ -68,7 +68,7 @@ module Berkshelf
|
|
68
68
|
|
69
69
|
hash.each do |name, info|
|
70
70
|
info["remote"].each do |remote_source, remote_version|
|
71
|
-
out = " * #{name} (#{info[
|
71
|
+
out = " * #{name} (#{info["local"]} => #{remote_version})"
|
72
72
|
|
73
73
|
unless remote_source.default?
|
74
74
|
out << " [#{remote_source.uri}]"
|
data/lib/berkshelf/installer.rb
CHANGED
data/lib/berkshelf/lockfile.rb
CHANGED
@@ -228,7 +228,7 @@ module Berkshelf
|
|
228
228
|
|
229
229
|
# @return [Array<CachedCookbook>]
|
230
230
|
def cached
|
231
|
-
graph.locks.values.collect
|
231
|
+
graph.locks.values.collect(&:cached_cookbook)
|
232
232
|
end
|
233
233
|
|
234
234
|
# The list of dependencies constrained in this lockfile.
|
@@ -570,7 +570,7 @@ module Berkshelf
|
|
570
570
|
end
|
571
571
|
end
|
572
572
|
|
573
|
-
graph << " #{name} (#{info[
|
573
|
+
graph << " #{name} (#{info["locked_version"]})\n"
|
574
574
|
end
|
575
575
|
|
576
576
|
contents = "#{dependencies}\n#{graph}"
|
data/lib/berkshelf/logger.rb
CHANGED
@@ -3,7 +3,7 @@ module Berkshelf
|
|
3
3
|
def initialize(device = STDOUT)
|
4
4
|
super
|
5
5
|
self.level = Logger::WARN
|
6
|
-
@filter_params =
|
6
|
+
@filter_params = []
|
7
7
|
end
|
8
8
|
|
9
9
|
# Reimplements Logger#add adding message filtering. The info,
|
@@ -28,6 +28,7 @@ module Berkshelf
|
|
28
28
|
if @logdev.nil? || severity < (@level)
|
29
29
|
return true
|
30
30
|
end
|
31
|
+
|
31
32
|
progname ||= @progname
|
32
33
|
if message.nil?
|
33
34
|
if block_given?
|
@@ -38,7 +39,8 @@ module Berkshelf
|
|
38
39
|
end
|
39
40
|
end
|
40
41
|
@logdev.write(
|
41
|
-
format_message(format_severity(severity), Time.now, progname, filter(message))
|
42
|
+
format_message(format_severity(severity), Time.now, progname, filter(message))
|
43
|
+
)
|
42
44
|
true
|
43
45
|
end
|
44
46
|
|
data/lib/berkshelf/mixin/git.rb
CHANGED
data/lib/berkshelf/resolver.rb
CHANGED
data/lib/berkshelf/shell.rb
CHANGED
data/lib/berkshelf/source.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
require_relative "api-client"
|
2
|
+
require_relative "chef_repo_universe"
|
3
|
+
require_relative "ssl_policies"
|
4
4
|
require "openssl"
|
5
5
|
|
6
6
|
module Berkshelf
|
@@ -84,7 +84,7 @@ module Berkshelf
|
|
84
84
|
def build_universe
|
85
85
|
@universe = api_client.universe
|
86
86
|
rescue => ex
|
87
|
-
@universe =
|
87
|
+
@universe = []
|
88
88
|
raise ex
|
89
89
|
end
|
90
90
|
|
@@ -154,7 +154,7 @@ module Berkshelf
|
|
154
154
|
end
|
155
155
|
|
156
156
|
def inspect
|
157
|
-
"#<#{self.class.name} #{type}: #{uri.to_s.inspect}, #{options.map { |k, v| "#{k}: #{v.inspect}" }.join(
|
157
|
+
"#<#{self.class.name} #{type}: #{uri.to_s.inspect}, #{options.map { |k, v| "#{k}: #{v.inspect}" }.join(", ")}>"
|
158
158
|
end
|
159
159
|
|
160
160
|
def hash
|
@@ -163,6 +163,7 @@ module Berkshelf
|
|
163
163
|
|
164
164
|
def ==(other)
|
165
165
|
return false unless other.is_a?(self.class)
|
166
|
+
|
166
167
|
type == other.type && uri == other.uri
|
167
168
|
end
|
168
169
|
|
@@ -8,9 +8,7 @@ module Berkshelf
|
|
8
8
|
attr_reader :store
|
9
9
|
|
10
10
|
def initialize
|
11
|
-
@store = OpenSSL::X509::Store.new.tap
|
12
|
-
store.set_default_paths
|
13
|
-
end
|
11
|
+
@store = OpenSSL::X509::Store.new.tap(&:set_default_paths)
|
14
12
|
|
15
13
|
set_custom_certs if ::File.exist?(trusted_certs_dir)
|
16
14
|
end
|
data/lib/berkshelf/thor.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
require_relative "cli"
|
data/lib/berkshelf/thor_ext.rb
CHANGED
data/lib/berkshelf/uploader.rb
CHANGED
@@ -32,7 +32,7 @@ module Berkshelf
|
|
32
32
|
Berkshelf.log.debug " No names given, using all cookbooks"
|
33
33
|
filtered_cookbooks
|
34
34
|
else
|
35
|
-
Berkshelf.log.debug " Names given (#{names.join(
|
35
|
+
Berkshelf.log.debug " Names given (#{names.join(", ")})"
|
36
36
|
names.map { |name| lockfile.retrieve(name) }
|
37
37
|
end
|
38
38
|
|
@@ -75,13 +75,15 @@ module Berkshelf
|
|
75
75
|
[ cookbook_version ],
|
76
76
|
force: options[:force],
|
77
77
|
concurrency: 1, # sadly
|
78
|
-
rest: connection
|
78
|
+
rest: connection,
|
79
|
+
skip_syntax_check: options[:skip_syntax_check]
|
79
80
|
).upload_cookbooks
|
80
81
|
Berkshelf.formatter.uploaded(cookbook, connection)
|
81
82
|
rescue Chef::Exceptions::CookbookFrozen
|
82
83
|
if options[:halt_on_frozen]
|
83
84
|
raise FrozenCookbook.new(cookbook)
|
84
85
|
end
|
86
|
+
|
85
87
|
Berkshelf.formatter.skipping(cookbook, connection)
|
86
88
|
end
|
87
89
|
ensure
|
data/lib/berkshelf/version.rb
CHANGED
data/lib/berkshelf/visualizer.rb
CHANGED
data/spec/config/knife.rb
CHANGED
@@ -6,5 +6,5 @@ validation_client_name "validator"
|
|
6
6
|
validation_key File.expand_path("spec/config/validator.pem")
|
7
7
|
chef_server_url "http://localhost:26310"
|
8
8
|
cache_type "BasicFile"
|
9
|
-
cache_options( path: "#{ENV[
|
9
|
+
cache_options( path: "#{ENV["HOME"]}/.chef/checksums" )
|
10
10
|
cookbook_path []
|
data/spec/support/chef_server.rb
CHANGED
@@ -200,10 +200,10 @@ describe Berkshelf::Berksfile do
|
|
200
200
|
|
201
201
|
describe "#dependencies" do
|
202
202
|
let(:groups) do
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
203
|
+
%i{
|
204
|
+
nautilus
|
205
|
+
skarner
|
206
|
+
}
|
207
207
|
end
|
208
208
|
|
209
209
|
it "returns all Berkshelf::Dependencys added to the instance of Berksfile" do
|
@@ -235,8 +235,8 @@ describe Berkshelf::Berksfile do
|
|
235
235
|
describe "#groups" do
|
236
236
|
before do
|
237
237
|
allow(subject).to receive(:dependencies) { [dependency_one, dependency_two] }
|
238
|
-
allow(dependency_one).to receive(:groups) {
|
239
|
-
allow(dependency_two).to receive(:groups) {
|
238
|
+
allow(dependency_one).to receive(:groups) { %i{nautilus skarner} }
|
239
|
+
allow(dependency_two).to receive(:groups) { %i{nautilus riven} }
|
240
240
|
end
|
241
241
|
|
242
242
|
it "returns a hash containing keys for every group a dependency is a member of" do
|
@@ -255,7 +255,7 @@ describe Berkshelf::Berksfile do
|
|
255
255
|
describe "#add_dependency" do
|
256
256
|
let(:name) { "cookbook_one" }
|
257
257
|
let(:constraint) { "= 1.2.0" }
|
258
|
-
let(:options) {
|
258
|
+
let(:options) { {} }
|
259
259
|
|
260
260
|
before(:each) do
|
261
261
|
subject.add_dependency(name, constraint, options)
|
@@ -13,8 +13,7 @@ module Berkshelf
|
|
13
13
|
describe "#upload" do
|
14
14
|
it "calls to upload with params if passed in cli" do
|
15
15
|
expect(berksfile).to receive(:upload).with(cookbooks,
|
16
|
-
include(skip_syntax_check: true, freeze: false)
|
17
|
-
)
|
16
|
+
include(skip_syntax_check: true, freeze: false))
|
18
17
|
|
19
18
|
subject.options[:skip_syntax_check] = true
|
20
19
|
subject.options[:no_freeze] = true
|
@@ -68,7 +68,7 @@ describe Berkshelf::CommunityREST do
|
|
68
68
|
let(:archive) { double("archive", path: "/foo/bar", unlink: true) }
|
69
69
|
|
70
70
|
before do
|
71
|
-
allow(subject).to receive(:stream).with(any_args
|
71
|
+
allow(subject).to receive(:stream).with(any_args).and_return(archive)
|
72
72
|
allow(Berkshelf::CommunityREST).to receive(:unpack)
|
73
73
|
.and_return("/some/path")
|
74
74
|
end
|
@@ -71,7 +71,7 @@ describe Berkshelf::Dependency do
|
|
71
71
|
end
|
72
72
|
|
73
73
|
context "given a group option containing an array of groups" do
|
74
|
-
let(:groups) {
|
74
|
+
let(:groups) { %i{development test} }
|
75
75
|
let(:source) { described_class.new(berksfile, cookbook_name, group: groups) }
|
76
76
|
|
77
77
|
it "assigns all the groups to the group attribute" do
|
@@ -95,24 +95,24 @@ describe Berkshelf::Dependency do
|
|
95
95
|
describe "#add_group" do
|
96
96
|
it "stores strings as symbols" do
|
97
97
|
subject.add_group "foo"
|
98
|
-
expect(subject.groups).to eq(
|
98
|
+
expect(subject.groups).to eq(%i{default foo})
|
99
99
|
end
|
100
100
|
|
101
101
|
it "does not store duplicate groups" do
|
102
102
|
subject.add_group "bar"
|
103
103
|
subject.add_group "bar"
|
104
104
|
subject.add_group :bar
|
105
|
-
expect(subject.groups).to eq(
|
105
|
+
expect(subject.groups).to eq(%i{default bar})
|
106
106
|
end
|
107
107
|
|
108
108
|
it "adds multiple groups" do
|
109
109
|
subject.add_group "baz", "quux"
|
110
|
-
expect(subject.groups).to eq(
|
110
|
+
expect(subject.groups).to eq(%i{default baz quux})
|
111
111
|
end
|
112
112
|
|
113
113
|
it "handles multiple groups as an array" do
|
114
114
|
subject.add_group %w{baz quux}
|
115
|
-
expect(subject.groups).to eq(
|
115
|
+
expect(subject.groups).to eq(%i{default baz quux})
|
116
116
|
end
|
117
117
|
end
|
118
118
|
|
@@ -5,14 +5,12 @@ module Berkshelf
|
|
5
5
|
let(:berksfile) do
|
6
6
|
double(Berksfile,
|
7
7
|
lockfile: lockfile,
|
8
|
-
dependencies: []
|
9
|
-
)
|
8
|
+
dependencies: [])
|
10
9
|
end
|
11
10
|
|
12
11
|
let(:lockfile) do
|
13
12
|
double(Lockfile,
|
14
|
-
graph: graph
|
15
|
-
)
|
13
|
+
graph: graph)
|
16
14
|
end
|
17
15
|
|
18
16
|
let(:graph) { double(Lockfile::Graph, locks: {}) }
|
@@ -124,15 +122,13 @@ module Berkshelf
|
|
124
122
|
cookbook_copyright: "user",
|
125
123
|
cookbook_email: "user@example.com",
|
126
124
|
cookbook_license: "apachev2",
|
127
|
-
trusted_certs_dir: self_signed_crt_path
|
128
|
-
)
|
125
|
+
trusted_certs_dir: self_signed_crt_path)
|
129
126
|
end
|
130
127
|
|
131
128
|
let(:berkshelf_config) do
|
132
129
|
double(Config,
|
133
130
|
ssl: double(verify: true),
|
134
|
-
chef: chef_config
|
135
|
-
)
|
131
|
+
chef: chef_config)
|
136
132
|
end
|
137
133
|
|
138
134
|
before do
|
@@ -8,8 +8,7 @@ module Berkshelf
|
|
8
8
|
double("dependency",
|
9
9
|
name: "nginx",
|
10
10
|
version_constraint: constraint,
|
11
|
-
berksfile: berksfile
|
12
|
-
)
|
11
|
+
berksfile: berksfile)
|
13
12
|
end
|
14
13
|
let(:path) { fixtures_path.join("cookbooks", "example_cookbook") }
|
15
14
|
let(:relative_path) { Pathname.new("../../../fixtures/cookbooks/example_cookbook") }
|
@@ -8,8 +8,7 @@ describe Berkshelf::Lockfile do
|
|
8
8
|
let(:lock_path) { File.absolute_path("/path/to/Bacon") }
|
9
9
|
let(:berksfile) do
|
10
10
|
double("Berksfile",
|
11
|
-
filepath: lock_path
|
12
|
-
)
|
11
|
+
filepath: lock_path)
|
13
12
|
end
|
14
13
|
|
15
14
|
subject { described_class.from_berksfile(berksfile) }
|
@@ -77,8 +76,7 @@ describe Berkshelf::Lockfile do
|
|
77
76
|
version: "1.0.0",
|
78
77
|
location: "api",
|
79
78
|
dependencies: {},
|
80
|
-
cached_cookbook: cookbook
|
81
|
-
)
|
79
|
+
cached_cookbook: cookbook)
|
82
80
|
berksfile = double("berksfile", dependencies: [apt])
|
83
81
|
subject.instance_variable_set(:@berksfile, berksfile)
|
84
82
|
allow(subject).to receive(:find).with(apt).and_return(apt)
|
@@ -95,8 +93,7 @@ describe Berkshelf::Lockfile do
|
|
95
93
|
version: "1.0.0",
|
96
94
|
location: "api",
|
97
95
|
dependencies: { "bacon" => "1.0.0" },
|
98
|
-
cached_cookbook: cookbook
|
99
|
-
)
|
96
|
+
cached_cookbook: cookbook)
|
100
97
|
bacon = double(name: "bacon", version: "1.0.0", dependencies: {})
|
101
98
|
berksfile = double("berksfile", dependencies: [apt])
|
102
99
|
subject.instance_variable_set(:@berksfile, berksfile)
|
@@ -115,15 +112,13 @@ describe Berkshelf::Lockfile do
|
|
115
112
|
version: "1.0.0",
|
116
113
|
location: "api",
|
117
114
|
dependencies: { "bacon" => "1.0.0" },
|
118
|
-
cached_cookbook: cookbook
|
119
|
-
)
|
115
|
+
cached_cookbook: cookbook)
|
120
116
|
bacon = double("bacon",
|
121
117
|
name: "bacon",
|
122
118
|
version_constraint: Semverse::Constraint.new(">= 0.0.0"),
|
123
119
|
version: "1.0.0",
|
124
120
|
location: "api",
|
125
|
-
dependencies: { "apt" => "1.0.0" }
|
126
|
-
)
|
121
|
+
dependencies: { "apt" => "1.0.0" })
|
127
122
|
berksfile = double("berksfile", dependencies: [apt])
|
128
123
|
subject.instance_variable_set(:@berksfile, berksfile)
|
129
124
|
allow(subject).to receive(:find).with(apt).and_return(apt)
|
@@ -141,8 +136,7 @@ describe Berkshelf::Lockfile do
|
|
141
136
|
version: "1.0.0",
|
142
137
|
location: "api",
|
143
138
|
dependencies: { "bacon" => "1.0.0" },
|
144
|
-
cached_cookbook: cookbook
|
145
|
-
)
|
139
|
+
cached_cookbook: cookbook)
|
146
140
|
berksfile = double("berksfile", dependencies: [apt])
|
147
141
|
subject.instance_variable_set(:@berksfile, berksfile)
|
148
142
|
allow(subject).to receive(:find).with(apt).and_return(apt)
|
@@ -177,8 +171,7 @@ describe Berkshelf::Lockfile do
|
|
177
171
|
version: "1.0.0",
|
178
172
|
location: "api",
|
179
173
|
dependencies: {},
|
180
|
-
cached_cookbook: cookbook
|
181
|
-
)
|
174
|
+
cached_cookbook: cookbook)
|
182
175
|
berksfile = double("berksfile", dependencies: [apt])
|
183
176
|
subject.instance_variable_set(:@berksfile, berksfile)
|
184
177
|
allow(subject).to receive(:find).with(apt).and_return(apt)
|
@@ -195,8 +188,7 @@ describe Berkshelf::Lockfile do
|
|
195
188
|
version: "1.0.0",
|
196
189
|
location: "api",
|
197
190
|
dependencies: {},
|
198
|
-
cached_cookbook: cookbook
|
199
|
-
)
|
191
|
+
cached_cookbook: cookbook)
|
200
192
|
apt_master = apt.dup
|
201
193
|
allow(apt_master).to receive_messages(location: "github")
|
202
194
|
allow(apt_master).to receive_messages(cached_cookbook: cookbook)
|
@@ -393,8 +385,7 @@ describe Berkshelf::Lockfile::Graph do
|
|
393
385
|
name: "test-0.0.1",
|
394
386
|
version: "0.0.1",
|
395
387
|
cookbook_name: "test",
|
396
|
-
dependencies: {}
|
397
|
-
)
|
388
|
+
dependencies: {})
|
398
389
|
subject.update([cookbook])
|
399
390
|
|
400
391
|
expect(subject.locks.keys).to include(cookbook.cookbook_name)
|
@@ -110,12 +110,12 @@ module Berkshelf
|
|
110
110
|
# Check all baseline values.
|
111
111
|
its([:timeout]) { is_expected.to eq 30 }
|
112
112
|
its([:open_timeout]) { is_expected.to eq 3 }
|
113
|
-
its(
|
114
|
-
its(
|
115
|
-
its(
|
116
|
-
its(
|
117
|
-
its(
|
118
|
-
its(
|
113
|
+
its(%i{ssl verify}) { is_expected.to be true }
|
114
|
+
its(%i{ssl ca_file}) { is_expected.to be_nil }
|
115
|
+
its(%i{ssl ca_path}) { is_expected.to be_nil }
|
116
|
+
its(%i{ssl client_cert}) { is_expected.to be_nil }
|
117
|
+
its(%i{ssl client_key}) { is_expected.to be_nil }
|
118
|
+
its(%i{ssl cert_store}) { is_expected.to be_a(OpenSSL::X509::Store) }
|
119
119
|
end
|
120
120
|
|
121
121
|
context "with a string argument and options" do
|
@@ -198,7 +198,8 @@ module Berkshelf
|
|
198
198
|
[
|
199
199
|
APIClient::RemoteCookbook.new("cb1", "1.0.8"),
|
200
200
|
APIClient::RemoteCookbook.new("cb1", "1.0.22"),
|
201
|
-
]
|
201
|
+
]
|
202
|
+
end
|
202
203
|
|
203
204
|
before do
|
204
205
|
allow_any_instance_of(APIClient::Connection).to receive(:universe).and_return(cookbooks)
|
@@ -16,19 +16,17 @@ describe Berkshelf::SSLPolicy do
|
|
16
16
|
cookbook_copyright: "user",
|
17
17
|
cookbook_email: "user@example.com",
|
18
18
|
cookbook_license: "apachev2",
|
19
|
-
trusted_certs_dir: self_signed_crt_path
|
20
|
-
)
|
19
|
+
trusted_certs_dir: self_signed_crt_path)
|
21
20
|
end
|
22
21
|
|
23
22
|
let(:berkshelf_config) do
|
24
23
|
double(Berkshelf::Config,
|
25
24
|
ssl: double(verify: true),
|
26
|
-
chef: chef_config
|
27
|
-
)
|
25
|
+
chef: chef_config)
|
28
26
|
end
|
29
27
|
|
30
28
|
subject do
|
31
|
-
Berkshelf::SSLPolicy.new
|
29
|
+
Berkshelf::SSLPolicy.new
|
32
30
|
end
|
33
31
|
|
34
32
|
before do
|
@@ -5,14 +5,12 @@ module Berkshelf
|
|
5
5
|
let(:berksfile) do
|
6
6
|
double(Berksfile,
|
7
7
|
lockfile: lockfile,
|
8
|
-
dependencies: []
|
9
|
-
)
|
8
|
+
dependencies: [])
|
10
9
|
end
|
11
10
|
|
12
11
|
let(:lockfile) do
|
13
12
|
double(Lockfile,
|
14
|
-
graph: graph
|
15
|
-
)
|
13
|
+
graph: graph)
|
16
14
|
end
|
17
15
|
|
18
16
|
let(:graph) { double(Lockfile::Graph, locks: {}) }
|
@@ -48,7 +46,7 @@ module Berkshelf
|
|
48
46
|
end
|
49
47
|
|
50
48
|
describe "#run" do
|
51
|
-
let(:options) {
|
49
|
+
let(:options) { {} }
|
52
50
|
|
53
51
|
let(:chef_config) do
|
54
52
|
double(Berkshelf::ChefConfigCompat,
|
@@ -61,15 +59,13 @@ module Berkshelf
|
|
61
59
|
cookbook_copyright: "user",
|
62
60
|
cookbook_email: "user@example.com",
|
63
61
|
cookbook_license: "apachev2",
|
64
|
-
trusted_certs_dir: self_signed_crt_path
|
65
|
-
)
|
62
|
+
trusted_certs_dir: self_signed_crt_path)
|
66
63
|
end
|
67
64
|
|
68
65
|
let(:berkshelf_config) do
|
69
66
|
double(Config,
|
70
67
|
ssl: double(verify: true),
|
71
|
-
chef: chef_config
|
72
|
-
)
|
68
|
+
chef: chef_config)
|
73
69
|
end
|
74
70
|
|
75
71
|
let(:default_ridley_options) do
|
@@ -211,7 +207,7 @@ module Berkshelf
|
|
211
207
|
subject { described_class.new(berksfile).send(:lookup_dependencies, "runit") }
|
212
208
|
|
213
209
|
it "returns array of cookbook's dependencies and their dependencies" do
|
214
|
-
expect(subject).to eq
|
210
|
+
expect(subject).to eq %w{build-essential yum yum-epel}
|
215
211
|
end
|
216
212
|
end
|
217
213
|
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: 7.0.
|
4
|
+
version: 7.0.9
|
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:
|
15
|
+
date: 2020-01-27 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: mixlib-shellout
|