puppet 6.12.0-x64-mingw32 → 6.13.0-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Gemfile.lock +12 -12
- data/README.md +1 -1
- data/ext/project_data.yaml +1 -1
- data/lib/puppet.rb +22 -7
- data/lib/puppet/application/resource.rb +1 -1
- data/lib/puppet/configurer.rb +8 -13
- data/lib/puppet/defaults.rb +83 -49
- data/lib/puppet/environments.rb +26 -18
- data/lib/puppet/face/facts.rb +8 -5
- data/lib/puppet/file_system/memory_file.rb +6 -0
- data/lib/puppet/file_system/memory_impl.rb +13 -0
- data/lib/puppet/file_system/windows.rb +7 -10
- data/lib/puppet/http.rb +2 -0
- data/lib/puppet/http/client.rb +30 -0
- data/lib/puppet/http/errors.rb +2 -0
- data/lib/puppet/http/service.rb +61 -2
- data/lib/puppet/http/service/compiler.rb +86 -0
- data/lib/puppet/http/service/file_server.rb +85 -0
- data/lib/puppet/http/service/report.rb +4 -8
- data/lib/puppet/http/session.rb +8 -1
- data/lib/puppet/indirector/catalog/compiler.rb +10 -0
- data/lib/puppet/indirector/file_bucket_file/file.rb +1 -1
- data/lib/puppet/indirector/json.rb +1 -1
- data/lib/puppet/indirector/msgpack.rb +1 -1
- data/lib/puppet/network/http/connection.rb +4 -0
- data/lib/puppet/network/http/nocache_pool.rb +1 -0
- data/lib/puppet/network/http/pool.rb +5 -1
- data/lib/puppet/parser/ast/pops_bridge.rb +6 -11
- data/lib/puppet/pops/evaluator/access_operator.rb +2 -2
- data/lib/puppet/pops/evaluator/evaluator_impl.rb +1 -1
- data/lib/puppet/pops/loader/puppet_plan_instantiator.rb +12 -3
- data/lib/puppet/pops/parser/evaluating_parser.rb +5 -7
- data/lib/puppet/pops/types/p_object_type_extension.rb +10 -0
- data/lib/puppet/pops/types/type_calculator.rb +24 -0
- data/lib/puppet/pops/validation/checker4_0.rb +1 -1
- data/lib/puppet/pops/validation/tasks_checker.rb +5 -1
- data/lib/puppet/provider/aix_object.rb +4 -2
- data/lib/puppet/provider/group/aix.rb +1 -0
- data/lib/puppet/provider/group/groupadd.rb +52 -24
- data/lib/puppet/provider/package/apt.rb +14 -3
- data/lib/puppet/provider/package/dnfmodule.rb +9 -2
- data/lib/puppet/provider/package/dpkg.rb +14 -7
- data/lib/puppet/provider/package/fink.rb +20 -3
- data/lib/puppet/provider/package/openbsd.rb +13 -1
- data/lib/puppet/provider/package/pkg.rb +18 -5
- data/lib/puppet/provider/package/yum.rb +9 -5
- data/lib/puppet/provider/user/aix.rb +1 -0
- data/lib/puppet/provider/user/directoryservice.rb +30 -5
- data/lib/puppet/provider/user/useradd.rb +6 -7
- data/lib/puppet/reports/store.rb +1 -1
- data/lib/puppet/settings.rb +2 -0
- data/lib/puppet/ssl/certificate.rb +2 -1
- data/lib/puppet/test/test_helper.rb +4 -0
- data/lib/puppet/transaction/resource_harness.rb +1 -1
- data/lib/puppet/type/group.rb +2 -2
- data/lib/puppet/type/package.rb +63 -9
- data/lib/puppet/type/user.rb +2 -2
- data/lib/puppet/util/log/destinations.rb +1 -1
- data/lib/puppet/util/pidlock.rb +26 -6
- data/lib/puppet/util/plist.rb +6 -0
- data/lib/puppet/util/storage.rb +0 -1
- data/lib/puppet/util/yaml.rb +1 -1
- data/lib/puppet/version.rb +1 -1
- data/locales/puppet.pot +127 -115
- data/man/man5/puppet.conf.5 +21 -7
- data/man/man8/puppet-agent.8 +1 -1
- data/man/man8/puppet-apply.8 +1 -1
- data/man/man8/puppet-catalog.8 +1 -1
- data/man/man8/puppet-config.8 +1 -1
- data/man/man8/puppet-describe.8 +1 -1
- data/man/man8/puppet-device.8 +1 -1
- data/man/man8/puppet-doc.8 +1 -1
- data/man/man8/puppet-epp.8 +1 -1
- data/man/man8/puppet-facts.8 +1 -1
- data/man/man8/puppet-filebucket.8 +1 -1
- data/man/man8/puppet-generate.8 +1 -1
- data/man/man8/puppet-help.8 +1 -1
- data/man/man8/puppet-key.8 +1 -1
- data/man/man8/puppet-lookup.8 +1 -1
- data/man/man8/puppet-man.8 +1 -1
- data/man/man8/puppet-module.8 +1 -1
- data/man/man8/puppet-node.8 +1 -1
- data/man/man8/puppet-parser.8 +1 -1
- data/man/man8/puppet-plugin.8 +1 -1
- data/man/man8/puppet-report.8 +1 -1
- data/man/man8/puppet-resource.8 +1 -1
- data/man/man8/puppet-script.8 +1 -1
- data/man/man8/puppet-ssl.8 +1 -1
- data/man/man8/puppet-status.8 +1 -1
- data/man/man8/puppet.8 +2 -2
- data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_fetch_if_not_on_the_local_disk.yml +0 -35
- data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_not_update_if_content_on_disk_is_up-to-date.yml +0 -37
- data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_update_if_content_differs_on_disk.yml +0 -37
- data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_mtime/should_fetch_if_mtime_is_older_on_disk.yml +0 -35
- data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_mtime/should_fetch_if_no_header_specified.yml +0 -33
- data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_mtime/should_fetch_if_not_on_the_local_disk.yml +0 -35
- data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_mtime/should_not_update_if_mtime_is_newer_on_disk.yml +0 -35
- data/spec/integration/configurer_spec.rb +26 -7
- data/spec/integration/indirector/facts/facter_spec.rb +4 -0
- data/spec/unit/application/apply_spec.rb +2 -12
- data/spec/unit/application/resource_spec.rb +2 -2
- data/spec/unit/configurer/fact_handler_spec.rb +0 -4
- data/spec/unit/configurer_spec.rb +0 -3
- data/spec/unit/defaults_spec.rb +1 -1
- data/spec/unit/environments_spec.rb +57 -28
- data/spec/unit/face/facts_spec.rb +24 -20
- data/spec/unit/file_system_spec.rb +16 -2
- data/spec/unit/http/client_spec.rb +6 -0
- data/spec/unit/http/service/compiler_spec.rb +322 -0
- data/spec/unit/http/service/file_server_spec.rb +219 -0
- data/spec/unit/http/service/report_spec.rb +8 -1
- data/spec/unit/http/service_spec.rb +4 -0
- data/spec/unit/http/session_spec.rb +31 -0
- data/spec/unit/indirector/catalog/compiler_spec.rb +46 -29
- data/spec/unit/network/http/connection_spec.rb +23 -1
- data/spec/unit/network/http/nocache_pool_spec.rb +3 -3
- data/spec/unit/network/http/pool_spec.rb +32 -0
- data/spec/unit/node/facts_spec.rb +2 -1
- data/spec/unit/node_spec.rb +7 -4
- data/spec/unit/pops/serialization/to_from_hr_spec.rb +6 -1
- data/spec/unit/pops/validator/validator_spec.rb +7 -2
- data/spec/unit/provider/aix_object_spec.rb +16 -2
- data/spec/unit/provider/group/groupadd_spec.rb +167 -56
- data/spec/unit/provider/package/apt_spec.rb +13 -2
- data/spec/unit/provider/package/aptitude_spec.rb +1 -0
- data/spec/unit/provider/package/dnfmodule_spec.rb +22 -0
- data/spec/unit/provider/package/dpkg_spec.rb +28 -6
- data/spec/unit/provider/package/openbsd_spec.rb +17 -0
- data/spec/unit/provider/package/pkg_spec.rb +15 -1
- data/spec/unit/provider/package/yum_spec.rb +50 -0
- data/spec/unit/provider/user/directoryservice_spec.rb +41 -0
- data/spec/unit/provider/user/useradd_spec.rb +13 -8
- data/spec/unit/puppet_pal_2pec.rb +3 -0
- data/spec/unit/puppet_pal_catalog_spec.rb +3 -0
- data/spec/unit/puppet_spec.rb +14 -0
- data/spec/unit/ssl/certificate_spec.rb +7 -0
- data/spec/unit/transaction/persistence_spec.rb +1 -10
- data/spec/unit/type/package_spec.rb +8 -0
- data/spec/unit/type/user_spec.rb +0 -1
- data/spec/unit/util/pidlock_spec.rb +38 -16
- data/spec/unit/util/plist_spec.rb +20 -0
- data/spec/unit/util/storage_spec.rb +1 -8
- metadata +10 -4
@@ -32,12 +32,14 @@ describe Puppet::Type.type(:package).provider(:apt) do
|
|
32
32
|
|
33
33
|
it "should use 'apt-get remove' to uninstall" do
|
34
34
|
expect(provider).to receive(:aptget).with("-y", "-q", :remove, name)
|
35
|
+
expect(provider).to receive(:properties).and_return({:mark => :none})
|
35
36
|
provider.uninstall
|
36
37
|
end
|
37
38
|
|
38
39
|
it "should use 'apt-get purge' and 'dpkg purge' to purge" do
|
39
40
|
expect(provider).to receive(:aptget).with("-y", "-q", :remove, "--purge", name)
|
40
41
|
expect(provider).to receive(:dpkg).with("--purge", name)
|
42
|
+
expect(provider).to receive(:properties).and_return({:mark => :none})
|
41
43
|
provider.purge
|
42
44
|
end
|
43
45
|
|
@@ -88,14 +90,14 @@ Version table:
|
|
88
90
|
it "should preseed if a responsefile is provided" do
|
89
91
|
resource[:responsefile] = "/my/file"
|
90
92
|
expect(provider).to receive(:run_preseed)
|
91
|
-
|
93
|
+
expect(provider).to receive(:properties).and_return({:mark => :none})
|
92
94
|
allow(provider).to receive(:aptget)
|
93
95
|
provider.install
|
94
96
|
end
|
95
97
|
|
96
98
|
it "should check for a cdrom" do
|
97
99
|
expect(provider).to receive(:checkforcdrom)
|
98
|
-
|
100
|
+
expect(provider).to receive(:properties).and_return({:mark => :none})
|
99
101
|
allow(provider).to receive(:aptget)
|
100
102
|
provider.install
|
101
103
|
end
|
@@ -106,6 +108,7 @@ Version table:
|
|
106
108
|
expect(command[-1]).to eq(name)
|
107
109
|
expect(command[-2]).to eq(:install)
|
108
110
|
end
|
111
|
+
expect(provider).to receive(:properties).and_return({:mark => :none})
|
109
112
|
|
110
113
|
provider.install
|
111
114
|
end
|
@@ -115,6 +118,7 @@ Version table:
|
|
115
118
|
expect(provider).to receive(:aptget) do |*command|
|
116
119
|
expect(command[-1]).to eq("#{name}=1.0")
|
117
120
|
end
|
121
|
+
expect(provider).to receive(:properties).and_return({:mark => :none})
|
118
122
|
|
119
123
|
provider.install
|
120
124
|
end
|
@@ -124,6 +128,7 @@ Version table:
|
|
124
128
|
expect(provider).to receive(:aptget) do |*command|
|
125
129
|
expect(command).to include("--force-yes")
|
126
130
|
end
|
131
|
+
expect(provider).to receive(:properties).and_return({:mark => :none})
|
127
132
|
|
128
133
|
provider.install
|
129
134
|
end
|
@@ -132,6 +137,7 @@ Version table:
|
|
132
137
|
expect(provider).to receive(:aptget) do |*command|
|
133
138
|
expect(command).to include("-q")
|
134
139
|
end
|
140
|
+
expect(provider).to receive(:properties).and_return({:mark => :none})
|
135
141
|
|
136
142
|
provider.install
|
137
143
|
end
|
@@ -140,6 +146,7 @@ Version table:
|
|
140
146
|
expect(provider).to receive(:aptget) do |*command|
|
141
147
|
expect(command).to include("-y")
|
142
148
|
end
|
149
|
+
expect(provider).to receive(:properties).and_return({:mark => :none})
|
143
150
|
|
144
151
|
provider.install
|
145
152
|
end
|
@@ -149,6 +156,7 @@ Version table:
|
|
149
156
|
expect(provider).to receive(:aptget) do |*command|
|
150
157
|
expect(command).to include("DPkg::Options::=--force-confold")
|
151
158
|
end
|
159
|
+
expect(provider).to receive(:properties).and_return({:mark => :none})
|
152
160
|
|
153
161
|
provider.install
|
154
162
|
end
|
@@ -158,6 +166,7 @@ Version table:
|
|
158
166
|
expect(provider).to receive(:aptget) do |*command|
|
159
167
|
expect(command).to include("DPkg::Options::=--force-confnew")
|
160
168
|
end
|
169
|
+
expect(provider).to receive(:properties).and_return({:mark => :none})
|
161
170
|
|
162
171
|
provider.install
|
163
172
|
end
|
@@ -165,6 +174,7 @@ Version table:
|
|
165
174
|
it 'should support string install options' do
|
166
175
|
resource[:install_options] = ['--foo', '--bar']
|
167
176
|
expect(provider).to receive(:aptget).with('-q', '-y', '-o', 'DPkg::Options::=--force-confold', '--foo', '--bar', :install, name)
|
177
|
+
expect(provider).to receive(:properties).and_return({:mark => :none})
|
168
178
|
|
169
179
|
provider.install
|
170
180
|
end
|
@@ -172,6 +182,7 @@ Version table:
|
|
172
182
|
it 'should support hash install options' do
|
173
183
|
resource[:install_options] = ['--foo', { '--bar' => 'baz', '--baz' => 'foo' }]
|
174
184
|
expect(provider).to receive(:aptget).with('-q', '-y', '-o', 'DPkg::Options::=--force-confold', '--foo', '--bar=baz', '--baz=foo', :install, name)
|
185
|
+
expect(provider).to receive(:properties).and_return({:mark => :none})
|
175
186
|
|
176
187
|
provider.install
|
177
188
|
end
|
@@ -33,6 +33,7 @@ describe Puppet::Type.type(:package).provider(:aptitude) do
|
|
33
33
|
expect(pkg.provider).to receive(:aptitude).
|
34
34
|
with('-y', '-o', 'DPkg::Options::=--force-confold', :install, 'faff').
|
35
35
|
and_return(0)
|
36
|
+
expect(pkg.provider).to receive(:properties).and_return({:mark => :none})
|
36
37
|
|
37
38
|
pkg.provider.install
|
38
39
|
end
|
@@ -161,6 +161,28 @@ describe Puppet::Type.type(:package).provider(:dnfmodule) do
|
|
161
161
|
provider.install
|
162
162
|
end
|
163
163
|
end
|
164
|
+
|
165
|
+
context "with an installed flavor" do
|
166
|
+
before do
|
167
|
+
provider.instance_variable_get('@property_hash')[:flavor] = 'minimal'
|
168
|
+
end
|
169
|
+
|
170
|
+
it "should remove existing packages and reset the module stream before installing another flavor" do
|
171
|
+
resource[:flavor] = 'common'
|
172
|
+
expect(provider).to receive(:execute).thrice.with(array_including(/remove|reset|install/))
|
173
|
+
provider.flavor = resource[:flavor]
|
174
|
+
end
|
175
|
+
|
176
|
+
it "should not do anything if the flavor doesn't change" do
|
177
|
+
resource[:flavor] = 'minimal'
|
178
|
+
expect(provider).not_to receive(:execute)
|
179
|
+
provider.flavor = resource[:flavor]
|
180
|
+
end
|
181
|
+
|
182
|
+
it "should return the existing flavor" do
|
183
|
+
expect(provider.flavor).to eq('minimal')
|
184
|
+
end
|
185
|
+
end
|
164
186
|
end
|
165
187
|
|
166
188
|
context "parsing the output of module list --installed" do
|
@@ -156,7 +156,8 @@ describe Puppet::Type.type(:package).provider(:dpkg), unless: Puppet::Util::Plat
|
|
156
156
|
it "considers the package held if its state is 'hold'" do
|
157
157
|
dpkg_query_execution_with_multiple_args_returns(query_output.gsub("install","hold"),args_with_provides,virtual_packages_query_args)
|
158
158
|
dpkg_query_execution_with_multiple_args_returns(dpkg_query_result.gsub("install","hold"), args, query_args)
|
159
|
-
expect(provider.query[:ensure]).to eq(
|
159
|
+
expect(provider.query[:ensure]).to eq("2.7.13")
|
160
|
+
expect(provider.query[:mark]).to eq(:hold)
|
160
161
|
end
|
161
162
|
|
162
163
|
context "regex check for query search" do
|
@@ -225,10 +226,16 @@ describe Puppet::Type.type(:package).provider(:dpkg), unless: Puppet::Util::Plat
|
|
225
226
|
not_installed_bash = bash_installed_output.gsub("installed", "not-installed")
|
226
227
|
not_installed_bash.gsub!(bash_version, "")
|
227
228
|
dpkg_query_execution_returns(not_installed_bash)
|
228
|
-
|
229
229
|
expect(provider.query[:ensure]).to eq(:purged)
|
230
230
|
end
|
231
231
|
|
232
|
+
it "considers the package held if its state is 'hold'" do
|
233
|
+
dpkg_query_execution_returns(bash_installed_output.gsub("install","hold"))
|
234
|
+
query=provider.query
|
235
|
+
expect(query[:ensure]).to eq("4.2-5ubuntu3")
|
236
|
+
expect(query[:mark]).to eq(:hold)
|
237
|
+
end
|
238
|
+
|
232
239
|
it "considers the package absent if it is marked 'config-files'" do
|
233
240
|
dpkg_query_execution_returns(bash_installed_output.gsub("installed","config-files"))
|
234
241
|
expect(provider.query[:ensure]).to eq(:absent)
|
@@ -251,7 +258,9 @@ describe Puppet::Type.type(:package).provider(:dpkg), unless: Puppet::Util::Plat
|
|
251
258
|
|
252
259
|
it "considers the package held if its state is 'hold'" do
|
253
260
|
dpkg_query_execution_returns(bash_installed_output.gsub("install","hold"))
|
254
|
-
|
261
|
+
query=provider.query
|
262
|
+
expect(query[:ensure]).to eq("4.2-5ubuntu3")
|
263
|
+
expect(query[:mark]).to eq(:hold)
|
255
264
|
end
|
256
265
|
|
257
266
|
context "parsing tests" do
|
@@ -328,14 +337,15 @@ describe Puppet::Type.type(:package).provider(:dpkg), unless: Puppet::Util::Plat
|
|
328
337
|
|
329
338
|
it "uses 'dpkg -i' to install the package" do
|
330
339
|
expect(resource).to receive(:[]).with(:source).and_return("mypackagefile")
|
340
|
+
expect(provider).to receive(:properties).and_return({:mark => :hold})
|
331
341
|
expect(provider).to receive(:unhold)
|
332
342
|
expect(provider).to receive(:dpkg).with(any_args, "-i", "mypackagefile")
|
333
|
-
|
334
343
|
provider.install
|
335
344
|
end
|
336
345
|
|
337
346
|
it "keeps old config files if told to do so" do
|
338
347
|
expect(resource).to receive(:[]).with(:configfiles).and_return(:keep)
|
348
|
+
expect(provider).to receive(:properties).and_return({:mark => :hold})
|
339
349
|
expect(provider).to receive(:unhold)
|
340
350
|
expect(provider).to receive(:dpkg).with("--force-confold", any_args)
|
341
351
|
|
@@ -344,6 +354,7 @@ describe Puppet::Type.type(:package).provider(:dpkg), unless: Puppet::Util::Plat
|
|
344
354
|
|
345
355
|
it "replaces old config files if told to do so" do
|
346
356
|
expect(resource).to receive(:[]).with(:configfiles).and_return(:replace)
|
357
|
+
expect(provider).to receive(:properties).and_return({:mark => :hold})
|
347
358
|
expect(provider).to receive(:unhold)
|
348
359
|
expect(provider).to receive(:dpkg).with("--force-confnew", any_args)
|
349
360
|
|
@@ -351,6 +362,7 @@ describe Puppet::Type.type(:package).provider(:dpkg), unless: Puppet::Util::Plat
|
|
351
362
|
end
|
352
363
|
|
353
364
|
it "ensures any hold is removed" do
|
365
|
+
expect(provider).to receive(:properties).and_return({:mark => :hold})
|
354
366
|
expect(provider).to receive(:unhold).once
|
355
367
|
expect(provider).to receive(:dpkg)
|
356
368
|
provider.install
|
@@ -369,14 +381,24 @@ describe Puppet::Type.type(:package).provider(:dpkg), unless: Puppet::Util::Plat
|
|
369
381
|
allow(provider).to receive(:execute)
|
370
382
|
allow(provider).to receive(:package_not_installed?).and_return(true)
|
371
383
|
expect(provider).to receive(:install).once
|
372
|
-
provider.hold
|
384
|
+
expect(provider).to receive(:hold)
|
385
|
+
provider.deprecated_hold
|
386
|
+
end
|
387
|
+
|
388
|
+
it "skips install new package if hold is true" do
|
389
|
+
allow(provider).to receive(:execute)
|
390
|
+
allow(provider).to receive(:package_not_installed?).and_return(true)
|
391
|
+
expect(provider).to receive(:install).once
|
392
|
+
expect(provider).to receive(:hold)
|
393
|
+
provider.deprecated_hold
|
373
394
|
end
|
374
395
|
|
375
396
|
it "skips install new package if package is allready installed" do
|
376
397
|
allow(provider).to receive(:execute)
|
377
398
|
allow(provider).to receive(:package_not_installed?).and_return(false)
|
378
399
|
expect(provider).not_to receive(:install)
|
379
|
-
provider.hold
|
400
|
+
expect(provider).to receive(:hold)
|
401
|
+
provider.deprecated_hold
|
380
402
|
end
|
381
403
|
|
382
404
|
it "executes dpkg --set-selections when holding" do
|
@@ -395,4 +395,21 @@ describe Puppet::Type.type(:package).provider(:openbsd) do
|
|
395
395
|
end
|
396
396
|
end
|
397
397
|
end
|
398
|
+
|
399
|
+
context "#flavor" do
|
400
|
+
before do
|
401
|
+
provider.instance_variable_get('@property_hash')[:flavor] = 'no_x11-python'
|
402
|
+
end
|
403
|
+
|
404
|
+
it 'should return the existing flavor' do
|
405
|
+
expect(provider.flavor).to eq('no_x11-python')
|
406
|
+
end
|
407
|
+
|
408
|
+
it 'should remove and install the new flavor if different' do
|
409
|
+
provider.resource[:flavor] = 'no_x11-ruby'
|
410
|
+
expect(provider).to receive(:uninstall).ordered
|
411
|
+
expect(provider).to receive(:install).ordered
|
412
|
+
provider.flavor = provider.resource[:flavor]
|
413
|
+
end
|
414
|
+
end
|
398
415
|
end
|
@@ -92,7 +92,7 @@ describe Puppet::Type.type(:package).provider(:pkg), unless: Puppet::Util::Platf
|
|
92
92
|
|
93
93
|
{
|
94
94
|
'pkg://omnios/SUNWcs@0.5.11,5.11-0.151006:20130506T161045Z i--' => {:name => 'SUNWcs', :ensure => '0.5.11,5.11-0.151006:20130506T161045Z', :status => 'installed', :provider => :pkg, :publisher => 'omnios'},
|
95
|
-
'pkg://omnios/incorporation/jeos/illumos-gate@11,5.11-0.151006:20130506T183443Z if-' => {:name => 'incorporation/jeos/illumos-gate', :ensure =>
|
95
|
+
'pkg://omnios/incorporation/jeos/illumos-gate@11,5.11-0.151006:20130506T183443Z if-' => {:name => 'incorporation/jeos/illumos-gate', :ensure => "11,5.11-0.151006:20130506T183443Z", :mark => :hold, :status => 'installed', :provider => :pkg, :publisher => 'omnios'},
|
96
96
|
'pkg://solaris/SUNWcs@0.5.11,5.11-0.151.0.1:20101105T001108Z installed -----' => {:name => 'SUNWcs', :ensure => '0.5.11,5.11-0.151.0.1:20101105T001108Z', :status => 'installed', :provider => :pkg, :publisher => 'solaris'},
|
97
97
|
}.each do |k, v|
|
98
98
|
it "[#{k}] should correctly parse" do
|
@@ -262,14 +262,17 @@ describe Puppet::Type.type(:package).provider(:pkg), unless: Puppet::Util::Platf
|
|
262
262
|
it "should support install options" do
|
263
263
|
resource[:install_options] = ['--foo', {'--bar' => 'baz'}]
|
264
264
|
expect(provider).to receive(:query).and_return({:ensure => :absent})
|
265
|
+
expect(provider).to receive(:properties).and_return({:mark => :hold})
|
265
266
|
expect(provider).to receive(:unhold)
|
266
267
|
expect(Puppet::Util::Execution).to receive(:execute)
|
267
268
|
.with(['/bin/pkg', 'install', *hash[:flags], '--foo', '--bar=baz', 'dummy'], {:failonfail => false, :combine => true})
|
269
|
+
allow($CHILD_STATUS).to receive(:exitstatus).and_return(0)
|
268
270
|
provider.install
|
269
271
|
end
|
270
272
|
|
271
273
|
it "should accept all licenses" do
|
272
274
|
expect(provider).to receive(:query).with(no_args).and_return({:ensure => :absent})
|
275
|
+
expect(provider).to receive(:properties).and_return({:mark => :hold})
|
273
276
|
expect(Puppet::Util::Execution).to receive(:execute)
|
274
277
|
.with(['/bin/pkg', 'install', *hash[:flags], 'dummy'], {:failonfail => false, :combine => true})
|
275
278
|
.and_return(Puppet::Util::Execution::ProcessOutput.new('', 0))
|
@@ -284,6 +287,7 @@ describe Puppet::Type.type(:package).provider(:pkg), unless: Puppet::Util::Platf
|
|
284
287
|
# Should install also check if the version installed is the same version we are asked to install? or should we rely on puppet for that?
|
285
288
|
resource[:ensure] = '0.0.7,5.11-0.151006:20131230T130000Z'
|
286
289
|
allow($CHILD_STATUS).to receive(:exitstatus).and_return(0)
|
290
|
+
expect(provider).to receive(:properties).and_return({:mark => :hold})
|
287
291
|
expect(Puppet::Util::Execution).to receive(:execute).with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true})
|
288
292
|
expect(Puppet::Util::Execution).to receive(:execute)
|
289
293
|
.with(['/bin/pkg', 'list', '-Hv', 'dummy'], {:failonfail => false, :combine => true})
|
@@ -296,6 +300,7 @@ describe Puppet::Type.type(:package).provider(:pkg), unless: Puppet::Util::Platf
|
|
296
300
|
|
297
301
|
it "should install specific version(2)" do
|
298
302
|
resource[:ensure] = '0.0.8'
|
303
|
+
expect(provider).to receive(:properties).and_return({:mark => :hold})
|
299
304
|
expect(Puppet::Util::Execution).to receive(:execute).with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true})
|
300
305
|
expect(Puppet::Util::Execution).to receive(:execute)
|
301
306
|
.with(['/bin/pkg', 'list', '-Hv', 'dummy'], {:failonfail => false, :combine => true})
|
@@ -309,6 +314,7 @@ describe Puppet::Type.type(:package).provider(:pkg), unless: Puppet::Util::Platf
|
|
309
314
|
|
310
315
|
it "should downgrade to specific version" do
|
311
316
|
resource[:ensure] = '0.0.7'
|
317
|
+
expect(provider).to receive(:properties).and_return({:mark => :hold})
|
312
318
|
expect(provider).to receive(:query).with(no_args).and_return({:ensure => '0.0.8,5.11-0.151106:20131230T130000Z'})
|
313
319
|
allow($CHILD_STATUS).to receive(:exitstatus).and_return(0)
|
314
320
|
expect(Puppet::Util::Execution).to receive(:execute).with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true})
|
@@ -320,6 +326,7 @@ describe Puppet::Type.type(:package).provider(:pkg), unless: Puppet::Util::Platf
|
|
320
326
|
|
321
327
|
it "should install any if version is not specified" do
|
322
328
|
resource[:ensure] = :present
|
329
|
+
expect(provider).to receive(:properties).and_return({:mark => :hold})
|
323
330
|
expect(provider).to receive(:query).with(no_args).and_return({:ensure => :absent})
|
324
331
|
expect(Puppet::Util::Execution).to receive(:execute)
|
325
332
|
.with(['/bin/pkg', 'install', *hash[:flags], 'dummy'], {:failonfail => false, :combine => true})
|
@@ -331,6 +338,7 @@ describe Puppet::Type.type(:package).provider(:pkg), unless: Puppet::Util::Platf
|
|
331
338
|
|
332
339
|
it "should install if no version was previously installed, and a specific version was requested" do
|
333
340
|
resource[:ensure] = '0.0.7'
|
341
|
+
expect(provider).to receive(:properties).and_return({:mark => :hold})
|
334
342
|
expect(provider).to receive(:query).with(no_args).and_return({:ensure => :absent})
|
335
343
|
expect(Puppet::Util::Execution).to receive(:execute).with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true})
|
336
344
|
expect(Puppet::Util::Execution).to receive(:execute)
|
@@ -344,6 +352,7 @@ describe Puppet::Type.type(:package).provider(:pkg), unless: Puppet::Util::Platf
|
|
344
352
|
resource[:ensure] = '1.0-0.151006'
|
345
353
|
is = :absent
|
346
354
|
expect(provider).to receive(:query).with(no_args).and_return({:ensure => is})
|
355
|
+
expect(provider).to receive(:properties).and_return({:mark => :hold})
|
347
356
|
expect(described_class).to receive(:pkg)
|
348
357
|
.with(:list, '-Hvfa', 'dummy@1.0-0.151006')
|
349
358
|
.and_return(Puppet::Util::Execution::ProcessOutput.new(File.read(my_fixture('dummy_implicit_version')), 0))
|
@@ -359,6 +368,7 @@ describe Puppet::Type.type(:package).provider(:pkg), unless: Puppet::Util::Platf
|
|
359
368
|
resource[:ensure] = '1.0-0.151006'
|
360
369
|
is = '1.0,5.11-0.151006:20140219T191204Z'
|
361
370
|
expect(provider).to receive(:query).with(no_args).and_return({:ensure => is})
|
371
|
+
expect(provider).to receive(:properties).and_return({:mark => :hold})
|
362
372
|
expect(described_class).to receive(:pkg).with(:list, '-Hvfa', 'dummy@1.0-0.151006').and_return(File.read(my_fixture('dummy_implicit_version')))
|
363
373
|
expect(Puppet::Util::Execution).to receive(:execute).with(['/bin/pkg', 'update', '-n', 'dummy@1.0,5.11-0.151006:20140220T084443Z'], {:failonfail => false, :combine => true})
|
364
374
|
expect(provider).to receive(:unhold).with(no_args)
|
@@ -417,12 +427,16 @@ describe Puppet::Type.type(:package).provider(:pkg), unless: Puppet::Util::Platf
|
|
417
427
|
it "should support current pkg version" do
|
418
428
|
expect(described_class).to receive(:pkg).with(:version).and_return('630e1ffc7a19')
|
419
429
|
expect(described_class).to receive(:pkg).with([:uninstall, resource[:name]])
|
430
|
+
expect(provider).to receive(:properties).and_return({:hold => false})
|
431
|
+
|
420
432
|
provider.uninstall
|
421
433
|
end
|
422
434
|
|
423
435
|
it "should support original pkg commands" do
|
424
436
|
expect(described_class).to receive(:pkg).with(:version).and_return('052adf36c3f4')
|
425
437
|
expect(described_class).to receive(:pkg).with([:uninstall, '-r', resource[:name]])
|
438
|
+
expect(provider).to receive(:properties).and_return({:hold => false})
|
439
|
+
|
426
440
|
provider.uninstall
|
427
441
|
end
|
428
442
|
end
|
@@ -95,6 +95,56 @@ describe Puppet::Type.type(:package).provider(:yum) do
|
|
95
95
|
provider.install
|
96
96
|
end
|
97
97
|
end
|
98
|
+
|
99
|
+
describe 'with install_options' do
|
100
|
+
it 'can parse disable-repo with array of strings' do
|
101
|
+
resource[:install_options] = ['--disable-repo=dev*', '--disable-repo=prod*']
|
102
|
+
expect(provider).to receive(:execute) do | arr|
|
103
|
+
expect(arr[-3]).to eq(["--disable-repo=dev*", "--disable-repo=prod*"])
|
104
|
+
end
|
105
|
+
provider.install
|
106
|
+
end
|
107
|
+
|
108
|
+
it 'can parse disable-repo with array of hashes' do
|
109
|
+
resource[:install_options] = [{'--disable-repo' => 'dev*'}, {'--disable-repo' => 'prod*'}]
|
110
|
+
expect(provider).to receive(:execute) do | arr|
|
111
|
+
expect(arr[-3]).to eq(["--disable-repo=dev*", "--disable-repo=prod*"])
|
112
|
+
end
|
113
|
+
provider.install
|
114
|
+
end
|
115
|
+
|
116
|
+
it 'can parse enable-repo with array of strings' do
|
117
|
+
resource[:install_options] = ['--enable-repo=dev*', '--enable-repo=prod*']
|
118
|
+
expect(provider).to receive(:execute) do | arr|
|
119
|
+
expect(arr[-3]).to eq(["--enable-repo=dev*", "--enable-repo=prod*"])
|
120
|
+
end
|
121
|
+
provider.install
|
122
|
+
end
|
123
|
+
|
124
|
+
it 'can parse enable-repo with array of hashes' do
|
125
|
+
resource[:install_options] = [{'--enable-repo' => 'dev*'}, {'--disable-repo' => 'prod*'}]
|
126
|
+
expect(provider).to receive(:execute) do | arr|
|
127
|
+
expect(arr[-3]).to eq(["--enable-repo=dev*", "--disable-repo=prod*"])
|
128
|
+
end
|
129
|
+
provider.install
|
130
|
+
end
|
131
|
+
|
132
|
+
it 'can parse enable-repo with single hash' do
|
133
|
+
resource[:install_options] = [{'--enable-repo' => 'dev*','--disable-repo' => 'prod*'}]
|
134
|
+
expect(provider).to receive(:execute) do | arr|
|
135
|
+
expect(arr[-3]).to eq(["--disable-repo=prod*", "--enable-repo=dev*"])
|
136
|
+
end
|
137
|
+
provider.install
|
138
|
+
end
|
139
|
+
|
140
|
+
it 'can parse enable-repo with empty array' do
|
141
|
+
resource[:install_options] = []
|
142
|
+
expect(provider).to receive(:execute) do | arr|
|
143
|
+
expect(arr[-3]).to eq([])
|
144
|
+
end
|
145
|
+
provider.install
|
146
|
+
end
|
147
|
+
end
|
98
148
|
end
|
99
149
|
|
100
150
|
context "parsing the output of check-update" do
|
@@ -196,6 +196,17 @@ describe Puppet::Type.type(:user).provider(:directoryservice) do
|
|
196
196
|
}
|
197
197
|
end
|
198
198
|
|
199
|
+
let (:dsimport_preamble) do
|
200
|
+
'0x0A 0x5C 0x3A 0x2C dsRecTypeStandard:Users 2 dsAttrTypeStandard:RecordName base64:dsAttrTypeNative:ShadowHashData'
|
201
|
+
end
|
202
|
+
|
203
|
+
let (:dsimport_contents) do
|
204
|
+
<<-DSIMPORT
|
205
|
+
#{dsimport_preamble}
|
206
|
+
#{username}:#{Base64.strict_encode64(sha512_embedded_bplist)}
|
207
|
+
DSIMPORT
|
208
|
+
end
|
209
|
+
|
199
210
|
# The below represents output of 'dscl -plist . readall /Users' converted to
|
200
211
|
# a native Ruby hash if only one user were installed on the system.
|
201
212
|
# This lets us check the behavior of all the methods necessary to return a
|
@@ -960,6 +971,24 @@ end
|
|
960
971
|
end
|
961
972
|
end
|
962
973
|
|
974
|
+
describe '#set_shadow_hash_data' do
|
975
|
+
let(:users_plist) { {'ShadowHashData' => ['string_data'] } }
|
976
|
+
|
977
|
+
it 'should flush the plist data to disk on OS X < 10.15' do
|
978
|
+
allow(provider.class).to receive(:get_os_version).and_return('10.12')
|
979
|
+
|
980
|
+
expect(provider).to receive(:write_users_plist_to_disk)
|
981
|
+
provider.set_shadow_hash_data(users_plist, pbkdf2_embedded_plist)
|
982
|
+
end
|
983
|
+
|
984
|
+
it 'should flush the plist data a temporary file on OS X >= 10.15' do
|
985
|
+
allow(provider.class).to receive(:get_os_version).and_return('10.15')
|
986
|
+
|
987
|
+
expect(provider).to receive(:write_and_import_shadow_hash_data)
|
988
|
+
provider.set_shadow_hash_data(users_plist, pbkdf2_embedded_plist)
|
989
|
+
end
|
990
|
+
end
|
991
|
+
|
963
992
|
describe '#set_salted_pbkdf2' do
|
964
993
|
let(:users_plist) { {'ShadowHashData' => ['string_data'] } }
|
965
994
|
let(:entropy_shadow_hash_data) do
|
@@ -1011,6 +1040,18 @@ end
|
|
1011
1040
|
end
|
1012
1041
|
end
|
1013
1042
|
|
1043
|
+
describe '#write_and_import_shadow_hash_data' do
|
1044
|
+
it 'should save the passed plist to a temporary file and import it' do
|
1045
|
+
tmpfile = double('tempfile', :path => "/tmp/dsimport_#{username}", :flush => nil)
|
1046
|
+
allow(Tempfile).to receive(:create).and_yield(tmpfile)
|
1047
|
+
allow(provider).to receive(:dscl).with('.', 'delete', user_path, 'ShadowHashData')
|
1048
|
+
|
1049
|
+
expect(tmpfile).to receive(:write).with(dsimport_contents)
|
1050
|
+
expect(provider).to receive(:dsimport).with(tmpfile.path, '/Local/Default', 'M')
|
1051
|
+
provider.write_and_import_shadow_hash_data(sha512_embedded_bplist)
|
1052
|
+
end
|
1053
|
+
end
|
1054
|
+
|
1014
1055
|
describe '#merge_attribute_with_dscl' do
|
1015
1056
|
it 'should raise an error if a dscl command raises an error' do
|
1016
1057
|
expect(provider).to receive(:dscl).with('.', '-merge', user_path, 'GeneratedUID', 'GUID').and_raise(Puppet::ExecutionFailure, 'boom')
|