berkshelf 7.0.9 → 8.0.9
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.
- checksums.yaml +4 -4
- data/Gemfile +3 -13
- data/Rakefile +2 -2
- data/berkshelf.gemspec +13 -5
- data/bin/berks +1 -1
- data/lib/berkshelf/api_client/chef_server_connection.rb +4 -6
- data/lib/berkshelf/api_client/remote_cookbook.rb +1 -1
- data/lib/berkshelf/api_client.rb +2 -2
- data/lib/berkshelf/berksfile.rb +34 -34
- data/lib/berkshelf/chef_config_compat.rb +1 -1
- data/lib/berkshelf/cli.rb +5 -5
- data/lib/berkshelf/community_rest.rb +3 -3
- data/lib/berkshelf/config.rb +2 -2
- data/lib/berkshelf/cookbook_store.rb +2 -4
- data/lib/berkshelf/core_ext/file_utils.rb +3 -3
- data/lib/berkshelf/downloader.rb +6 -6
- data/lib/berkshelf/errors.rb +3 -0
- data/lib/berkshelf/file_syncer.rb +10 -12
- data/lib/berkshelf/installer.rb +7 -7
- data/lib/berkshelf/location.rb +4 -4
- data/lib/berkshelf/locations/git.rb +6 -12
- data/lib/berkshelf/locations/github.rb +1 -1
- data/lib/berkshelf/lockfile.rb +9 -9
- data/lib/berkshelf/mixin/git.rb +2 -2
- data/lib/berkshelf/packager.rb +40 -6
- data/lib/berkshelf/shell.rb +1 -1
- data/lib/berkshelf/shell_out.rb +4 -3
- data/lib/berkshelf/source.rb +2 -2
- data/lib/berkshelf/source_uri.rb +1 -1
- data/lib/berkshelf/ssl_policies.rb +6 -8
- data/lib/berkshelf/thor_ext/hash_with_indifferent_access.rb +1 -1
- data/lib/berkshelf/uploader.rb +36 -36
- data/lib/berkshelf/validator.rb +13 -8
- data/lib/berkshelf/version.rb +1 -1
- data/lib/berkshelf/visualizer.rb +2 -2
- data/lib/berkshelf.rb +7 -8
- data/spec/config/knife.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- data/spec/support/git.rb +19 -19
- data/spec/support/path_helpers.rb +4 -4
- data/spec/unit/berkshelf/berkshelf/api_client/chef_server_connection_spec.rb +65 -0
- data/spec/unit/berkshelf/berkshelf/api_client/connection_spec.rb +3 -3
- data/spec/unit/berkshelf/community_rest_spec.rb +3 -3
- data/spec/unit/berkshelf/core_ext/file_utils_spec.rb +2 -2
- data/spec/unit/berkshelf/dependency_spec.rb +1 -1
- data/spec/unit/berkshelf/location_spec.rb +1 -1
- data/spec/unit/berkshelf/locations/git_spec.rb +2 -5
- data/spec/unit/berkshelf/lockfile_spec.rb +2 -2
- data/spec/unit/berkshelf/ridley_compat_spec.rb +1 -1
- data/spec/unit/berkshelf/source_spec.rb +22 -12
- data/spec/unit/berkshelf/ssl_policies_spec.rb +0 -1
- data/spec/unit/berkshelf/validator_spec.rb +10 -7
- metadata +13 -9
|
@@ -4,8 +4,9 @@ module Berkshelf
|
|
|
4
4
|
describe Source do
|
|
5
5
|
let(:berksfile) { double("Berksfile", filepath: "/test/Berksfile") }
|
|
6
6
|
let(:arguments) { [] }
|
|
7
|
+
let(:kwargs) { {} }
|
|
7
8
|
let(:config) { Config.new }
|
|
8
|
-
subject(:instance) { described_class.new(berksfile, *arguments) }
|
|
9
|
+
subject(:instance) { described_class.new(berksfile, *arguments, **kwargs) }
|
|
9
10
|
before do
|
|
10
11
|
allow(Berkshelf::Config).to receive(:instance).and_return(config)
|
|
11
12
|
end
|
|
@@ -19,7 +20,8 @@ module Berkshelf
|
|
|
19
20
|
end
|
|
20
21
|
|
|
21
22
|
context "with a string argument and options" do
|
|
22
|
-
let(:arguments) { ["https://example.com"
|
|
23
|
+
let(:arguments) { ["https://example.com" ] }
|
|
24
|
+
let(:kwargs) { { key: "value" } }
|
|
23
25
|
it { is_expected.to eq :supermarket }
|
|
24
26
|
end
|
|
25
27
|
|
|
@@ -29,7 +31,8 @@ module Berkshelf
|
|
|
29
31
|
end
|
|
30
32
|
|
|
31
33
|
context "with a symbol argument and options" do
|
|
32
|
-
let(:arguments) { [:chef_server
|
|
34
|
+
let(:arguments) { [:chef_server ] }
|
|
35
|
+
let(:kwargs) { { key: "value" } }
|
|
33
36
|
it { is_expected.to eq :chef_server }
|
|
34
37
|
end
|
|
35
38
|
|
|
@@ -44,7 +47,8 @@ module Berkshelf
|
|
|
44
47
|
end
|
|
45
48
|
|
|
46
49
|
context "with a hash argument and disconnected options" do
|
|
47
|
-
let(:arguments) { [{ artifactory: "https://example.com/api/chef/chef-virtual" }
|
|
50
|
+
let(:arguments) { [{ artifactory: "https://example.com/api/chef/chef-virtual" }] }
|
|
51
|
+
let(:kwargs) { { key: "value" } }
|
|
48
52
|
it { is_expected.to eq :artifactory }
|
|
49
53
|
end
|
|
50
54
|
end
|
|
@@ -58,7 +62,8 @@ module Berkshelf
|
|
|
58
62
|
end
|
|
59
63
|
|
|
60
64
|
context "with a string argument and options" do
|
|
61
|
-
let(:arguments) { ["https://example.com"
|
|
65
|
+
let(:arguments) { ["https://example.com" ] }
|
|
66
|
+
let(:kwargs) { { key: "value" } }
|
|
62
67
|
it { is_expected.to eq "https://example.com" }
|
|
63
68
|
end
|
|
64
69
|
|
|
@@ -69,7 +74,8 @@ module Berkshelf
|
|
|
69
74
|
end
|
|
70
75
|
|
|
71
76
|
context "with a symbol argument and options" do
|
|
72
|
-
let(:arguments) { [:chef_server
|
|
77
|
+
let(:arguments) { [:chef_server] }
|
|
78
|
+
let(:kwargs) { { key: "value" } }
|
|
73
79
|
before { config.chef.chef_server_url = "https://chefserver/" }
|
|
74
80
|
it { is_expected.to eq "https://chefserver/" }
|
|
75
81
|
end
|
|
@@ -85,7 +91,8 @@ module Berkshelf
|
|
|
85
91
|
end
|
|
86
92
|
|
|
87
93
|
context "with a hash argument and disconnected options" do
|
|
88
|
-
let(:arguments) { [{ artifactory: "https://example.com/api/chef/chef-virtual" }
|
|
94
|
+
let(:arguments) { [{ artifactory: "https://example.com/api/chef/chef-virtual" } ] }
|
|
95
|
+
let(:kwargs) { { key: "value" } }
|
|
89
96
|
it { is_expected.to eq "https://example.com/api/chef/chef-virtual" }
|
|
90
97
|
end
|
|
91
98
|
|
|
@@ -96,7 +103,7 @@ module Berkshelf
|
|
|
96
103
|
|
|
97
104
|
context "with a chef_repo source" do
|
|
98
105
|
let(:arguments) { [{ chef_repo: "." }] }
|
|
99
|
-
it { is_expected.to eq(windows? ? "file://
|
|
106
|
+
it { is_expected.to eq(windows? ? "file://D/test" : "file:///test") }
|
|
100
107
|
end
|
|
101
108
|
end
|
|
102
109
|
|
|
@@ -119,7 +126,8 @@ module Berkshelf
|
|
|
119
126
|
end
|
|
120
127
|
|
|
121
128
|
context "with a string argument and options" do
|
|
122
|
-
let(:arguments) { ["https://example.com"
|
|
129
|
+
let(:arguments) { ["https://example.com"] }
|
|
130
|
+
let(:kwargs) { { key: "value" } }
|
|
123
131
|
its([:key]) { is_expected.to eq "value" }
|
|
124
132
|
end
|
|
125
133
|
|
|
@@ -129,7 +137,8 @@ module Berkshelf
|
|
|
129
137
|
end
|
|
130
138
|
|
|
131
139
|
context "with a symbol argument and options" do
|
|
132
|
-
let(:arguments) { [:chef_server
|
|
140
|
+
let(:arguments) { [:chef_server] }
|
|
141
|
+
let(:kwargs) { { key: "value" } }
|
|
133
142
|
its([:key]) { is_expected.to eq "value" }
|
|
134
143
|
end
|
|
135
144
|
|
|
@@ -144,7 +153,8 @@ module Berkshelf
|
|
|
144
153
|
end
|
|
145
154
|
|
|
146
155
|
context "with a hash argument and disconnected options" do
|
|
147
|
-
let(:arguments) { [{ artifactory: "https://example.com/api/chef/chef-virtual" }
|
|
156
|
+
let(:arguments) { [{ artifactory: "https://example.com/api/chef/chef-virtual" } ] }
|
|
157
|
+
let(:kwargs) { { key: "value" } }
|
|
148
158
|
its([:key]) { is_expected.to eq "value" }
|
|
149
159
|
end
|
|
150
160
|
|
|
@@ -156,7 +166,7 @@ module Berkshelf
|
|
|
156
166
|
|
|
157
167
|
context "with a chef_repo source" do
|
|
158
168
|
let(:arguments) { [{ chef_repo: "." }] }
|
|
159
|
-
its([:path]) { is_expected.to eq(windows? ? "
|
|
169
|
+
its([:path]) { is_expected.to eq(windows? ? "D:/test" : "/test") }
|
|
160
170
|
end
|
|
161
171
|
end
|
|
162
172
|
|
|
@@ -73,7 +73,6 @@ describe Berkshelf::SSLPolicy do
|
|
|
73
73
|
before do
|
|
74
74
|
allow(chef_config).to receive_messages(trusted_certs_dir: self_signed_crt_path_windows_backslashes)
|
|
75
75
|
allow(File).to receive(:exist?).with(self_signed_crt_path_windows_forwardslashes).and_return(true)
|
|
76
|
-
allow(Dir).to receive(:chdir).with(self_signed_crt_path_windows_forwardslashes)
|
|
77
76
|
end
|
|
78
77
|
|
|
79
78
|
it "replaces the backslashes in trusted_certs_dir from Berkshelf config with forwardslashes" do
|
|
@@ -4,12 +4,9 @@ describe Berkshelf::Validator do
|
|
|
4
4
|
describe "#validate_files" do
|
|
5
5
|
let(:cookbook) { double("cookbook", cookbook_name: "cookbook", path: "path") }
|
|
6
6
|
|
|
7
|
-
before do
|
|
8
|
-
allow(Dir).to receive(:chdir) { |&block| block.call }
|
|
9
|
-
end
|
|
10
|
-
|
|
11
7
|
it "raises an error when the cookbook has spaces in the files" do
|
|
12
8
|
allow(Dir).to receive(:glob).and_return(["/there are/spaces/in this/recipes/default.rb"])
|
|
9
|
+
allow(cookbook).to receive(:dependencies).and_return({"cookbook" => "1.0.0"})
|
|
13
10
|
expect do
|
|
14
11
|
subject.validate_files(cookbook)
|
|
15
12
|
end.to raise_error(Berkshelf::InvalidCookbookFiles)
|
|
@@ -17,15 +14,21 @@ describe Berkshelf::Validator do
|
|
|
17
14
|
|
|
18
15
|
it "does not raise an error when the cookbook is valid" do
|
|
19
16
|
allow(Dir).to receive(:glob).and_return(["/there-are/no-spaces/in-this/recipes/default.rb"])
|
|
17
|
+
allow(cookbook).to receive(:dependencies).and_return({"cookbook" => "1.0.0"})
|
|
20
18
|
expect do
|
|
21
19
|
subject.validate_files(cookbook)
|
|
22
20
|
end.to_not raise_error
|
|
23
21
|
end
|
|
24
22
|
|
|
25
|
-
it "
|
|
26
|
-
allow(
|
|
27
|
-
|
|
23
|
+
it "raises an error when the cookbook version is not valid" do
|
|
24
|
+
allow(cookbook).to receive(:dependencies).and_return({"cookbook" => "1"})
|
|
25
|
+
expect do
|
|
26
|
+
subject.validate_files(cookbook)
|
|
27
|
+
end.to raise_error
|
|
28
|
+
end
|
|
28
29
|
|
|
30
|
+
it "does not raise an error when the cookbook version is valid" do
|
|
31
|
+
allow(cookbook).to receive(:dependencies).and_return({"cookbook" => "1.0"})
|
|
29
32
|
expect do
|
|
30
33
|
subject.validate_files(cookbook)
|
|
31
34
|
end.to_not raise_error
|
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:
|
|
4
|
+
version: 8.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: 2023-09-27 00:00:00.000000000 Z
|
|
16
16
|
dependencies:
|
|
17
17
|
- !ruby/object:Gem::Dependency
|
|
18
18
|
name: mixlib-shellout
|
|
@@ -130,7 +130,7 @@ dependencies:
|
|
|
130
130
|
requirements:
|
|
131
131
|
- - ">="
|
|
132
132
|
- !ruby/object:Gem::Version
|
|
133
|
-
version:
|
|
133
|
+
version: 1.1.4
|
|
134
134
|
- - "<"
|
|
135
135
|
- !ruby/object:Gem::Version
|
|
136
136
|
version: '2.0'
|
|
@@ -140,7 +140,7 @@ dependencies:
|
|
|
140
140
|
requirements:
|
|
141
141
|
- - ">="
|
|
142
142
|
- !ruby/object:Gem::Version
|
|
143
|
-
version:
|
|
143
|
+
version: 1.1.4
|
|
144
144
|
- - "<"
|
|
145
145
|
- !ruby/object:Gem::Version
|
|
146
146
|
version: '2.0'
|
|
@@ -164,14 +164,14 @@ dependencies:
|
|
|
164
164
|
requirements:
|
|
165
165
|
- - ">="
|
|
166
166
|
- !ruby/object:Gem::Version
|
|
167
|
-
version:
|
|
167
|
+
version: 15.7.32
|
|
168
168
|
type: :runtime
|
|
169
169
|
prerelease: false
|
|
170
170
|
version_requirements: !ruby/object:Gem::Requirement
|
|
171
171
|
requirements:
|
|
172
172
|
- - ">="
|
|
173
173
|
- !ruby/object:Gem::Version
|
|
174
|
-
version:
|
|
174
|
+
version: 15.7.32
|
|
175
175
|
- !ruby/object:Gem::Dependency
|
|
176
176
|
name: chef-config
|
|
177
177
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -315,6 +315,7 @@ files:
|
|
|
315
315
|
- spec/support/path_helpers.rb
|
|
316
316
|
- spec/support/shared_examples/formatter.rb
|
|
317
317
|
- spec/unit/berkshelf/berksfile_spec.rb
|
|
318
|
+
- spec/unit/berkshelf/berkshelf/api_client/chef_server_connection_spec.rb
|
|
318
319
|
- spec/unit/berkshelf/berkshelf/api_client/connection_spec.rb
|
|
319
320
|
- spec/unit/berkshelf/berkshelf/api_client/remote_cookbook_spec.rb
|
|
320
321
|
- spec/unit/berkshelf/berkshelf/api_client_spec.rb
|
|
@@ -358,7 +359,10 @@ files:
|
|
|
358
359
|
homepage: https://docs.chef.io/berkshelf.html
|
|
359
360
|
licenses:
|
|
360
361
|
- Apache-2.0
|
|
361
|
-
metadata:
|
|
362
|
+
metadata:
|
|
363
|
+
bug_tracker_uri: https://github.com/chef/berkshelf/issues
|
|
364
|
+
source_code_uri: https://github.com/chef/berkshelf
|
|
365
|
+
changelog_uri: https://github.com/chef/berkshelf/blob/main/CHANGELOG.md
|
|
362
366
|
post_install_message:
|
|
363
367
|
rdoc_options: []
|
|
364
368
|
require_paths:
|
|
@@ -367,14 +371,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
367
371
|
requirements:
|
|
368
372
|
- - ">="
|
|
369
373
|
- !ruby/object:Gem::Version
|
|
370
|
-
version: 2.
|
|
374
|
+
version: 2.7.0
|
|
371
375
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
372
376
|
requirements:
|
|
373
377
|
- - ">="
|
|
374
378
|
- !ruby/object:Gem::Version
|
|
375
379
|
version: 2.0.0
|
|
376
380
|
requirements: []
|
|
377
|
-
rubygems_version: 3.
|
|
381
|
+
rubygems_version: 3.1.4
|
|
378
382
|
signing_key:
|
|
379
383
|
specification_version: 4
|
|
380
384
|
summary: Manages a Chef cookbook's dependencies
|