chef-cli 3.0.40 → 3.1.0
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad936b7c0a024d571d22f4de9c78681906f98c07190e66ef723d07f680e3611d
|
4
|
+
data.tar.gz: 4e18354644f446734170b934fa9a1899a2178a121a62c64779e29995f5fad7be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: adad25885aea41a51a851f1958f1c43668530d7a4eefaa4e4dffade6291f117836bb8f8908ac5d1ef0a2e13a0ab9ef3a689af6a5c8c874f370de7399c69e76c1
|
7
|
+
data.tar.gz: c89105687373b57a2809f5c540828c45a633b2872a73d4e926fd1e3aa189938be05d0a23ee8fc1f173bff5d3834826e1199a7c566cc09fa3fa835e8e1ddcaa6b
|
@@ -91,7 +91,7 @@ module ChefCLI
|
|
91
91
|
def run(params = [])
|
92
92
|
return 1 unless apply_params!(params)
|
93
93
|
|
94
|
-
attributes_updater.run
|
94
|
+
attributes_updater.run if update_attributes_only?
|
95
95
|
installer.run(@cookbooks_to_update, config[:exclude_deps]) unless update_attributes_only?
|
96
96
|
0
|
97
97
|
rescue PolicyfileServiceError => e
|
@@ -61,7 +61,7 @@ module ChefCLI
|
|
61
61
|
|
62
62
|
if installing_from_lock?
|
63
63
|
install_from_lock
|
64
|
-
elsif cookbooks_to_update.empty? # means update everything
|
64
|
+
elsif cookbooks_to_update.empty? || policyfile_lock.nil? # means update everything
|
65
65
|
generate_lock_and_install
|
66
66
|
else
|
67
67
|
update_lock_and_install(cookbooks_to_update, exclude_deps)
|
data/lib/chef-cli/version.rb
CHANGED
@@ -132,10 +132,6 @@ describe ChefCLI::Command::Update do
|
|
132
132
|
context "when the command is successful" do
|
133
133
|
before do
|
134
134
|
expect(install_service).to receive(:run)
|
135
|
-
expect(ChefCLI::PolicyfileServices::UpdateAttributes).to receive(:new)
|
136
|
-
.with(policyfile: nil, ui: command.ui, root_dir: Dir.pwd, chef_config: anything)
|
137
|
-
.and_return(update_attrs_service)
|
138
|
-
expect(update_attrs_service).to receive(:run)
|
139
135
|
end
|
140
136
|
|
141
137
|
it "returns 0" do
|
@@ -159,10 +155,6 @@ describe ChefCLI::Command::Update do
|
|
159
155
|
|
160
156
|
before do
|
161
157
|
expect(install_service).to receive(:run).and_raise(exception)
|
162
|
-
expect(ChefCLI::PolicyfileServices::UpdateAttributes).to receive(:new)
|
163
|
-
.with(policyfile: nil, ui: command.ui, root_dir: Dir.pwd, chef_config: anything)
|
164
|
-
.and_return(update_attrs_service)
|
165
|
-
expect(update_attrs_service).to receive(:run)
|
166
158
|
end
|
167
159
|
|
168
160
|
it "returns 1" do
|
@@ -54,6 +54,10 @@ describe ChefCLI::PolicyfileServices::Install do
|
|
54
54
|
|
55
55
|
let(:overwrite) { false }
|
56
56
|
|
57
|
+
let(:cookbooks_to_update) { [] || [ "my_cookbook" ] }
|
58
|
+
|
59
|
+
let(:cookbooks_to_update_empty) { false }
|
60
|
+
|
57
61
|
let(:ui) { TestHelpers::TestUI.new }
|
58
62
|
|
59
63
|
let(:install_service) { described_class.new(policyfile: policyfile_rb_name, ui: ui, root_dir: working_dir, overwrite: overwrite) }
|
@@ -153,6 +157,90 @@ describe ChefCLI::PolicyfileServices::Install do
|
|
153
157
|
|
154
158
|
end
|
155
159
|
|
160
|
+
context "when cookbook to update is empty and no policy lock exist" do
|
161
|
+
|
162
|
+
let(:cookbooks_to_update_empty) { true }
|
163
|
+
|
164
|
+
it "create the policy lock" do
|
165
|
+
install_service.run(:cookbooks_to_update)
|
166
|
+
generated_lock = result_policyfile_lock
|
167
|
+
expect(generated_lock.name).to eq("install-example")
|
168
|
+
expect(generated_lock.cookbook_locks).to have_key("local-cookbook")
|
169
|
+
end
|
170
|
+
|
171
|
+
it "checks for policy lock" do
|
172
|
+
lock = install_service.policyfile_lock
|
173
|
+
expect(lock).to eq(nil)
|
174
|
+
end
|
175
|
+
|
176
|
+
end
|
177
|
+
|
178
|
+
context "when cookbook to update is empty and policy lock exist" do
|
179
|
+
|
180
|
+
before do
|
181
|
+
install_service.dup.run
|
182
|
+
end
|
183
|
+
|
184
|
+
let(:cookbooks_to_update_empty) { true }
|
185
|
+
|
186
|
+
it "create the policy lock" do
|
187
|
+
install_service.run(:cookbooks_to_update)
|
188
|
+
generated_lock = result_policyfile_lock
|
189
|
+
expect(generated_lock.name).to eq("install-example")
|
190
|
+
expect(generated_lock.cookbook_locks).to have_key("local-cookbook")
|
191
|
+
end
|
192
|
+
|
193
|
+
it "checks for policy lock" do
|
194
|
+
lock = install_service.policyfile_lock
|
195
|
+
expect(lock).to be_an_instance_of(ChefCLI::PolicyfileLock)
|
196
|
+
expect(lock.name).to eq("install-example")
|
197
|
+
expect(lock.cookbook_locks).to have_key("local-cookbook")
|
198
|
+
end
|
199
|
+
|
200
|
+
end
|
201
|
+
|
202
|
+
context "when cookbook to update is not empty and no policy lock exist" do
|
203
|
+
|
204
|
+
let(:cookbooks_to_update) { [ "my_cookbook" ] }
|
205
|
+
|
206
|
+
it "create the policy lock" do
|
207
|
+
install_service.run(:cookbooks_to_update)
|
208
|
+
generated_lock = result_policyfile_lock
|
209
|
+
expect(generated_lock.name).to eq("install-example")
|
210
|
+
expect(generated_lock.cookbook_locks).to have_key("local-cookbook")
|
211
|
+
end
|
212
|
+
|
213
|
+
it "checks for policy lock" do
|
214
|
+
lock = install_service.policyfile_lock
|
215
|
+
expect(lock).to eq(nil)
|
216
|
+
end
|
217
|
+
|
218
|
+
end
|
219
|
+
|
220
|
+
context "when cookbook to update is not empty and policy lock exist" do
|
221
|
+
|
222
|
+
before do
|
223
|
+
install_service.dup.run
|
224
|
+
end
|
225
|
+
|
226
|
+
let(:cookbooks_to_update) { [ "my_cookbook" ] }
|
227
|
+
|
228
|
+
it "create the policy lock" do
|
229
|
+
install_service.run(:cookbooks_to_update)
|
230
|
+
generated_lock = result_policyfile_lock
|
231
|
+
expect(generated_lock.name).to eq("install-example")
|
232
|
+
expect(generated_lock.cookbook_locks).to have_key("local-cookbook")
|
233
|
+
end
|
234
|
+
|
235
|
+
it "create the policy lock" do
|
236
|
+
lock = install_service.policyfile_lock
|
237
|
+
expect(lock).to be_an_instance_of(ChefCLI::PolicyfileLock)
|
238
|
+
expect(lock.name).to eq("install-example")
|
239
|
+
expect(lock.cookbook_locks).to have_key("local-cookbook")
|
240
|
+
end
|
241
|
+
|
242
|
+
end
|
243
|
+
|
156
244
|
context "and a lockfile exists and `overwrite` is specified" do
|
157
245
|
|
158
246
|
let(:overwrite) { true }
|