puppet 4.7.1-x64-mingw32 → 4.8.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.
- data/Gemfile +0 -3
- data/MAINTAINERS +76 -0
- data/README.md +0 -6
- data/Rakefile +2 -2
- data/lib/puppet/agent.rb +3 -3
- data/lib/puppet/application/apply.rb +1 -1
- data/lib/puppet/configurer.rb +2 -2
- data/lib/puppet/data_providers.rb +1 -0
- data/lib/puppet/data_providers/data_adapter.rb +1 -0
- data/lib/puppet/data_providers/data_function_support.rb +1 -0
- data/lib/puppet/data_providers/function_env_data_provider.rb +1 -0
- data/lib/puppet/data_providers/function_module_data_provider.rb +1 -0
- data/lib/puppet/data_providers/hiera_config.rb +1 -0
- data/lib/puppet/data_providers/hiera_env_data_provider.rb +1 -0
- data/lib/puppet/data_providers/hiera_interpolate.rb +1 -0
- data/lib/puppet/data_providers/hiera_module_data_provider.rb +1 -0
- data/lib/puppet/data_providers/hiera_support.rb +1 -2
- data/lib/puppet/data_providers/json_data_provider_factory.rb +2 -0
- data/lib/puppet/data_providers/yaml_data_provider_factory.rb +2 -0
- data/lib/puppet/defaults.rb +20 -1
- data/lib/puppet/environments.rb +5 -2
- data/lib/puppet/face/catalog.rb +1 -1
- data/lib/puppet/face/epp.rb +57 -11
- data/lib/puppet/face/module/install.rb +6 -6
- data/lib/puppet/functions.rb +23 -24
- data/lib/puppet/functions/alert.rb +14 -0
- data/lib/puppet/functions/binary_file.rb +25 -0
- data/lib/puppet/functions/break.rb +22 -0
- data/lib/puppet/functions/contain.rb +33 -0
- data/lib/puppet/functions/crit.rb +14 -0
- data/lib/puppet/functions/debug.rb +14 -0
- data/lib/puppet/functions/emerg.rb +14 -0
- data/lib/puppet/functions/epp.rb +1 -1
- data/lib/puppet/functions/err.rb +14 -0
- data/lib/puppet/functions/find_file.rb +31 -0
- data/lib/puppet/functions/include.rb +21 -0
- data/lib/puppet/functions/info.rb +14 -0
- data/lib/puppet/functions/new.rb +1 -1
- data/lib/puppet/functions/next.rb +23 -0
- data/lib/puppet/functions/notice.rb +14 -0
- data/lib/puppet/functions/regsubst.rb +12 -16
- data/lib/puppet/functions/require.rb +37 -0
- data/lib/puppet/functions/return.rb +22 -0
- data/lib/puppet/functions/strftime.rb +35 -0
- data/lib/puppet/functions/warning.rb +14 -0
- data/lib/puppet/generate/models/type/type.rb +4 -0
- data/lib/puppet/generate/templates/type/pcore.erb +2 -1
- data/lib/puppet/indirector/face.rb +6 -1
- data/lib/puppet/network/http/error.rb +2 -2
- data/lib/puppet/network/http/handler.rb +2 -2
- data/lib/puppet/node/environment.rb +11 -0
- data/lib/puppet/parser/ast.rb +5 -0
- data/lib/puppet/parser/ast/pops_bridge.rb +17 -4
- data/lib/puppet/parser/compiler.rb +29 -1
- data/lib/puppet/parser/functions.rb +6 -0
- data/lib/puppet/parser/functions/assert_type.rb +1 -1
- data/lib/puppet/parser/functions/binary_file.rb +24 -0
- data/lib/puppet/parser/functions/break.rb +39 -0
- data/lib/puppet/parser/functions/contain.rb +7 -15
- data/lib/puppet/parser/functions/defined.rb +2 -2
- data/lib/puppet/parser/functions/dig.rb +1 -1
- data/lib/puppet/parser/functions/each.rb +1 -1
- data/lib/puppet/parser/functions/epp.rb +2 -2
- data/lib/puppet/parser/functions/filter.rb +1 -1
- data/lib/puppet/parser/functions/find_file.rb +28 -0
- data/lib/puppet/parser/functions/hiera.rb +4 -4
- data/lib/puppet/parser/functions/hiera_array.rb +1 -1
- data/lib/puppet/parser/functions/hiera_hash.rb +1 -1
- data/lib/puppet/parser/functions/hiera_include.rb +1 -1
- data/lib/puppet/parser/functions/include.rb +4 -8
- data/lib/puppet/parser/functions/inline_epp.rb +1 -1
- data/lib/puppet/parser/functions/lest.rb +1 -1
- data/lib/puppet/parser/functions/lookup.rb +4 -2
- data/lib/puppet/parser/functions/map.rb +1 -1
- data/lib/puppet/parser/functions/match.rb +1 -1
- data/lib/puppet/parser/functions/new.rb +414 -18
- data/lib/puppet/parser/functions/next.rb +38 -0
- data/lib/puppet/parser/functions/reduce.rb +1 -1
- data/lib/puppet/parser/functions/regsubst.rb +4 -2
- data/lib/puppet/parser/functions/require.rb +4 -27
- data/lib/puppet/parser/functions/return.rb +71 -0
- data/lib/puppet/parser/functions/reverse_each.rb +1 -1
- data/lib/puppet/parser/functions/scanf.rb +13 -8
- data/lib/puppet/parser/functions/slice.rb +1 -1
- data/lib/puppet/parser/functions/split.rb +1 -1
- data/lib/puppet/parser/functions/step.rb +1 -1
- data/lib/puppet/parser/functions/strftime.rb +185 -0
- data/lib/puppet/parser/functions/then.rb +1 -1
- data/lib/puppet/parser/functions/type.rb +1 -1
- data/lib/puppet/parser/functions/with.rb +3 -3
- data/lib/puppet/parser/resource.rb +8 -5
- data/lib/puppet/parser/scope.rb +1 -1
- data/lib/puppet/plugins/configuration.rb +8 -0
- data/lib/puppet/plugins/data_providers.rb +1 -0
- data/lib/puppet/plugins/data_providers/data_provider.rb +7 -28
- data/lib/puppet/plugins/data_providers/registry.rb +1 -0
- data/lib/puppet/pops.rb +4 -0
- data/lib/puppet/pops/evaluator/access_operator.rb +36 -5
- data/lib/puppet/pops/evaluator/closure.rb +81 -12
- data/lib/puppet/pops/evaluator/compare_operator.rb +24 -1
- data/lib/puppet/pops/evaluator/evaluator_impl.rb +29 -5
- data/lib/puppet/pops/evaluator/json_strict_literal_evaluator.rb +1 -1
- data/lib/puppet/pops/evaluator/runtime3_converter.rb +53 -62
- data/lib/puppet/pops/evaluator/runtime3_support.rb +15 -6
- data/lib/puppet/pops/functions/dispatch.rb +9 -2
- data/lib/puppet/pops/functions/dispatcher.rb +3 -1
- data/lib/puppet/pops/functions/function.rb +19 -2
- data/lib/puppet/pops/issues.rb +9 -0
- data/lib/puppet/pops/label_provider.rb +2 -2
- data/lib/puppet/pops/loader/loader.rb +17 -0
- data/lib/puppet/pops/loader/static_loader.rb +0 -41
- data/lib/puppet/pops/lookup.rb +12 -0
- data/lib/puppet/pops/lookup/context.rb +86 -0
- data/lib/puppet/pops/lookup/explainer.rb +46 -6
- data/lib/puppet/pops/lookup/invocation.rb +19 -0
- data/lib/puppet/pops/lookup/sub_lookup.rb +1 -1
- data/lib/puppet/pops/model/factory.rb +20 -8
- data/lib/puppet/pops/model/model_label_provider.rb +3 -0
- data/lib/puppet/pops/model/model_meta.rb +2 -0
- data/lib/puppet/pops/model/model_tree_dumper.rb +14 -0
- data/lib/puppet/pops/parser/egrammar.ra +11 -6
- data/lib/puppet/pops/parser/eparser.rb +1112 -1086
- data/lib/puppet/pops/parser/heredoc_support.rb +1 -2
- data/lib/puppet/pops/pcore.rb +1 -0
- data/lib/puppet/pops/puppet_stack.rb +3 -3
- data/lib/puppet/pops/resource/param.rb +5 -1
- data/lib/puppet/pops/resource/resource_type_impl.rb +8 -4
- data/lib/puppet/pops/resource/resource_type_set.pcore +1 -0
- data/lib/puppet/pops/serialization/abstract_reader.rb +19 -2
- data/lib/puppet/pops/serialization/abstract_writer.rb +16 -3
- data/lib/puppet/pops/serialization/deserializer.rb +5 -1
- data/lib/puppet/pops/serialization/extension.rb +2 -0
- data/lib/puppet/pops/serialization/json.rb +76 -26
- data/lib/puppet/pops/serialization/serializer.rb +5 -1
- data/lib/puppet/pops/serialization/time_factory.rb +2 -1
- data/lib/puppet/pops/time/timespan.rb +718 -0
- data/lib/puppet/pops/time/timestamp.rb +148 -0
- data/lib/puppet/pops/types/p_binary_type.rb +220 -0
- data/lib/puppet/pops/types/p_object_type.rb +12 -6
- data/lib/puppet/pops/types/p_sensitive_type.rb +5 -1
- data/lib/puppet/pops/types/p_timespan_type.rb +141 -0
- data/lib/puppet/pops/types/p_timestamp_type.rb +69 -0
- data/lib/puppet/pops/types/string_converter.rb +62 -0
- data/lib/puppet/pops/types/type_asserter.rb +1 -1
- data/lib/puppet/pops/types/type_calculator.rb +17 -3
- data/lib/puppet/pops/types/type_factory.rb +35 -1
- data/lib/puppet/pops/types/type_formatter.rb +64 -11
- data/lib/puppet/pops/types/type_mismatch_describer.rb +110 -61
- data/lib/puppet/pops/types/type_parser.rb +18 -4
- data/lib/puppet/pops/types/types.rb +98 -63
- data/lib/puppet/pops/validation.rb +9 -1
- data/lib/puppet/pops/validation/checker4_0.rb +7 -0
- data/lib/puppet/property.rb +1 -1
- data/lib/puppet/provider.rb +3 -6
- data/lib/puppet/provider/mcx/mcxcontent.rb +1 -1
- data/lib/puppet/provider/mount/parsed.rb +18 -4
- data/lib/puppet/provider/nameservice/directoryservice.rb +15 -7
- data/lib/puppet/provider/package/gem.rb +6 -1
- data/lib/puppet/provider/package/pip.rb +0 -1
- data/lib/puppet/provider/package/pkg.rb +5 -1
- data/lib/puppet/provider/package/pkgng.rb +1 -1
- data/lib/puppet/provider/package/yum.rb +10 -0
- data/lib/puppet/provider/service/launchd.rb +1 -0
- data/lib/puppet/provider/user/directoryservice.rb +6 -6
- data/lib/puppet/provider/yumrepo/inifile.rb +1 -1
- data/lib/puppet/provider/zpool/zpool.rb +1 -1
- data/lib/puppet/resource.rb +54 -12
- data/lib/puppet/resource/capability_finder.rb +15 -9
- data/lib/puppet/resource/catalog.rb +25 -6
- data/lib/puppet/resource/type.rb +3 -1
- data/lib/puppet/settings.rb +1 -1
- data/lib/puppet/settings/environment_conf.rb +12 -4
- data/lib/puppet/syntax_checkers/base64.rb +41 -0
- data/lib/puppet/syntax_checkers/json.rb +0 -2
- data/lib/puppet/transaction.rb +6 -0
- data/lib/puppet/transaction/additional_resource_generator.rb +5 -0
- data/lib/puppet/transaction/report.rb +7 -2
- data/lib/puppet/type.rb +2 -1
- data/lib/puppet/type/file/checksum.rb +1 -0
- data/lib/puppet/type/file/content.rb +4 -4
- data/lib/puppet/type/mount.rb +44 -0
- data/lib/puppet/type/ssh_authorized_key.rb +1 -1
- data/lib/puppet/type/tidy.rb +3 -0
- data/lib/puppet/type/user.rb +12 -6
- data/lib/puppet/util/log.rb +25 -0
- data/lib/puppet/util/plist.rb +8 -3
- data/lib/puppet/version.rb +1 -1
- data/lib/puppet_x.rb +7 -1
- data/spec/integration/application/apply_spec.rb +118 -0
- data/spec/integration/parser/compiler_spec.rb +28 -0
- data/spec/integration/parser/pcore_resource_spec.rb +40 -3
- data/spec/integration/provider/mount_spec.rb +2 -1
- data/spec/integration/util/windows/principal_spec.rb +2 -2
- data/spec/integration/util/windows/registry_spec.rb +4 -4
- data/spec/lib/puppet_spec/compiler.rb +5 -1
- data/spec/lib/puppet_spec/unindent.rb +5 -0
- data/spec/shared_contexts/types_setup.rb +6 -0
- data/spec/shared_examples/rhel_package_provider.rb +16 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/unit/agent_spec.rb +11 -0
- data/spec/unit/application/lookup_spec.rb +94 -3
- data/spec/unit/capability_spec.rb +22 -0
- data/spec/unit/configurer_spec.rb +8 -0
- data/spec/unit/face/epp_face_spec.rb +22 -3
- data/spec/unit/functions/assert_type_spec.rb +3 -3
- data/spec/unit/functions/binary_file_spec.rb +46 -0
- data/spec/unit/functions/break_spec.rb +89 -0
- data/spec/unit/{parser/functions → functions}/contain_spec.rb +68 -3
- data/spec/unit/functions/find_file_spec.rb +69 -0
- data/spec/unit/functions/include_spec.rb +175 -0
- data/spec/unit/functions/logging_spec.rb +54 -0
- data/spec/unit/functions/lookup_spec.rb +3 -3
- data/spec/unit/functions/new_spec.rb +105 -5
- data/spec/unit/functions/next_spec.rb +93 -0
- data/spec/unit/functions/require_spec.rb +83 -0
- data/spec/unit/functions/return_spec.rb +105 -0
- data/spec/unit/{parser/functions → functions}/shared.rb +14 -11
- data/spec/unit/functions/strftime_spec.rb +152 -0
- data/spec/unit/functions4_spec.rb +22 -0
- data/spec/unit/indirector/face_spec.rb +10 -2
- data/spec/unit/network/http/error_spec.rb +1 -2
- data/spec/unit/network/http/handler_spec.rb +6 -5
- data/spec/unit/parser/functions/hiera_array_spec.rb +1 -1
- data/spec/unit/parser/functions/hiera_hash_spec.rb +1 -1
- data/spec/unit/parser/functions/hiera_include_spec.rb +1 -1
- data/spec/unit/parser/functions/hiera_spec.rb +1 -1
- data/spec/unit/parser/functions/lookup_spec.rb +1 -1
- data/spec/unit/parser/functions/regsubst_spec.rb +1 -1
- data/spec/unit/parser/functions/split_spec.rb +1 -1
- data/spec/unit/pops/evaluator/access_ops_spec.rb +81 -1
- data/spec/unit/pops/evaluator/arithmetic_ops_spec.rb +170 -0
- data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +29 -4
- data/spec/unit/pops/evaluator/runtime3_converter_spec.rb +112 -4
- data/spec/unit/pops/loaders/dependency_loader_spec.rb +12 -0
- data/spec/unit/pops/loaders/static_loader_spec.rb +0 -26
- data/spec/unit/pops/lookup/context_spec.rb +149 -0
- data/spec/unit/pops/parser/parse_functions_spec.rb +19 -0
- data/spec/unit/pops/parser/parse_lambda_spec.rb +19 -0
- data/spec/unit/pops/puppet_stack_spec.rb +1 -1
- data/spec/unit/pops/resource/resource_type_impl_spec.rb +74 -0
- data/spec/unit/pops/serialization/packer_spec.rb +34 -14
- data/spec/unit/pops/serialization/serialization_spec.rb +67 -5
- data/spec/unit/pops/time/timespan_spec.rb +121 -0
- data/spec/unit/pops/types/p_binary_type_spec.rb +243 -0
- data/spec/unit/pops/types/p_object_type_spec.rb +7 -7
- data/spec/unit/pops/types/p_sensitive_type_spec.rb +1 -1
- data/spec/unit/pops/types/p_timespan_type_spec.rb +273 -0
- data/spec/unit/pops/types/p_timestamp_type_spec.rb +311 -0
- data/spec/unit/pops/types/p_type_set_type_spec.rb +13 -13
- data/spec/unit/pops/types/ruby_generator_spec.rb +12 -12
- data/spec/unit/pops/types/string_converter_spec.rb +89 -0
- data/spec/unit/pops/types/type_asserter_spec.rb +3 -3
- data/spec/unit/pops/types/type_calculator_spec.rb +113 -5
- data/spec/unit/pops/types/type_formatter_spec.rb +40 -0
- data/spec/unit/pops/types/type_mismatch_describer_spec.rb +49 -38
- data/spec/unit/pops/types/type_parser_spec.rb +87 -4
- data/spec/unit/pops/types/types_spec.rb +1 -1
- data/spec/unit/pops/validator/validator_spec.rb +23 -0
- data/spec/unit/provider/mount/parsed_spec.rb +47 -29
- data/spec/unit/provider/package/pkg_spec.rb +109 -99
- data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +1 -0
- data/spec/unit/provider/user/aix_spec.rb +1 -1
- data/spec/unit/provider/user/directoryservice_spec.rb +101 -30
- data/spec/unit/resource/capability_finder_spec.rb +29 -7
- data/spec/unit/resource/catalog_spec.rb +127 -0
- data/spec/unit/ssl/certificate_request_spec.rb +1 -1
- data/spec/unit/transaction/additional_resource_generator_spec.rb +30 -0
- data/spec/unit/transaction/persistence_spec.rb +1 -6
- data/spec/unit/transaction/report_spec.rb +23 -0
- data/spec/unit/transaction_spec.rb +38 -0
- data/spec/unit/type/mount_spec.rb +5 -0
- data/spec/unit/util/plist_spec.rb +14 -2
- metadata +71 -12
- data/spec/integration/parser/functions/require_spec.rb +0 -43
- data/spec/unit/parser/functions/include_spec.rb +0 -55
- data/spec/unit/parser/functions/require_spec.rb +0 -68
@@ -201,105 +201,115 @@ describe Puppet::Type.type(:package).provider(:pkg) do
|
|
201
201
|
end
|
202
202
|
|
203
203
|
context ":install" do
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
204
|
+
[
|
205
|
+
{ :osrel => '11.0', :flags => ['--accept'] },
|
206
|
+
{ :osrel => '11.2', :flags => ['--accept', '--sync-actuators-timeout', '900'] },
|
207
|
+
].each do |hash|
|
208
|
+
context "with :operatingsystemrelease #{hash[:osrel]}" do
|
209
|
+
before :each do
|
210
|
+
Facter.stubs(:value).with(:operatingsystemrelease).returns hash[:osrel]
|
211
|
+
end
|
212
|
+
it "should accept all licenses" do
|
213
|
+
provider.expects(:query).with().returns({:ensure => :absent})
|
214
|
+
Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'install', *hash[:flags], 'dummy'], {:failonfail => false, :combine => true}).returns ''
|
215
|
+
Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true}).returns ''
|
216
|
+
$CHILD_STATUS.stubs(:exitstatus).returns 0
|
217
|
+
provider.install
|
218
|
+
end
|
219
|
+
|
220
|
+
it "should install specific version(1)" do
|
221
|
+
# 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?
|
222
|
+
resource[:ensure] = '0.0.7,5.11-0.151006:20131230T130000Z'
|
223
|
+
$CHILD_STATUS.stubs(:exitstatus).returns 0
|
224
|
+
Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true})
|
225
|
+
Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'list', '-Hv', 'dummy'], {:failonfail => false, :combine => true}).returns 'pkg://foo/dummy@0.0.6,5.11-0.151006:20131230T130000Z installed -----'
|
226
|
+
Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'update', *hash[:flags], 'dummy@0.0.7,5.11-0.151006:20131230T130000Z'], {:failonfail => false, :combine => true}).returns ''
|
227
|
+
provider.install
|
228
|
+
end
|
229
|
+
|
230
|
+
it "should install specific version(2)" do
|
231
|
+
resource[:ensure] = '0.0.8'
|
232
|
+
Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true})
|
233
|
+
Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'list', '-Hv', 'dummy'], {:failonfail => false, :combine => true}).returns 'pkg://foo/dummy@0.0.7,5.11-0.151006:20131230T130000Z installed -----'
|
234
|
+
Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'update', *hash[:flags], 'dummy@0.0.8'], {:failonfail => false, :combine => true}).returns ''
|
235
|
+
$CHILD_STATUS.stubs(:exitstatus).returns 0
|
236
|
+
provider.install
|
237
|
+
end
|
238
|
+
|
239
|
+
it "should downgrade to specific version" do
|
240
|
+
resource[:ensure] = '0.0.7'
|
241
|
+
provider.expects(:query).with().returns({:ensure => '0.0.8,5.11-0.151106:20131230T130000Z'})
|
242
|
+
$CHILD_STATUS.stubs(:exitstatus).returns 0
|
243
|
+
Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true})
|
244
|
+
Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'update', *hash[:flags], 'dummy@0.0.7'], {:failonfail => false, :combine => true}).returns ''
|
245
|
+
provider.install
|
246
|
+
end
|
247
|
+
|
248
|
+
it "should install any if version is not specified" do
|
249
|
+
resource[:ensure] = :present
|
250
|
+
provider.expects(:query).with().returns({:ensure => :absent})
|
251
|
+
Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'install', *hash[:flags], 'dummy'], {:failonfail => false, :combine => true}).returns ''
|
252
|
+
Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true})
|
253
|
+
$CHILD_STATUS.stubs(:exitstatus).returns 0
|
254
|
+
provider.install
|
255
|
+
end
|
256
|
+
|
257
|
+
it "should install if no version was previously installed, and a specific version was requested" do
|
258
|
+
resource[:ensure] = '0.0.7'
|
259
|
+
provider.expects(:query).with().returns({:ensure => :absent})
|
260
|
+
Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'unfreeze', 'dummy'], {:failonfail => false, :combine => true})
|
261
|
+
Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'install', *hash[:flags], 'dummy@0.0.7'], {:failonfail => false, :combine => true}).returns ''
|
262
|
+
$CHILD_STATUS.stubs(:exitstatus).returns 0
|
263
|
+
provider.install
|
264
|
+
end
|
265
|
+
|
266
|
+
it "installs the latest matching version when given implicit version, and none are installed" do
|
267
|
+
resource[:ensure] = '1.0-0.151006'
|
268
|
+
is = :absent
|
269
|
+
provider.expects(:query).with().returns({:ensure => is})
|
270
|
+
described_class.expects(:pkg).with(:list, '-Hvfa', 'dummy@1.0-0.151006').returns File.read(my_fixture('dummy_implicit_version'))
|
271
|
+
Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'install', '-n', 'dummy@1.0,5.11-0.151006:20140220T084443Z'], {:failonfail => false, :combine => true})
|
272
|
+
provider.expects(:unhold).with()
|
273
|
+
Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'install', *hash[:flags], 'dummy@1.0,5.11-0.151006:20140220T084443Z'], {:failonfail => false, :combine => true})
|
274
|
+
$CHILD_STATUS.stubs(:exitstatus).returns 0
|
275
|
+
provider.insync?(is)
|
276
|
+
provider.install
|
277
|
+
end
|
278
|
+
|
279
|
+
it "updates to the latest matching version when given implicit version" do
|
280
|
+
resource[:ensure] = '1.0-0.151006'
|
281
|
+
is = '1.0,5.11-0.151006:20140219T191204Z'
|
282
|
+
provider.expects(:query).with().returns({:ensure => is})
|
283
|
+
described_class.expects(:pkg).with(:list, '-Hvfa', 'dummy@1.0-0.151006').returns File.read(my_fixture('dummy_implicit_version'))
|
284
|
+
Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'update', '-n', 'dummy@1.0,5.11-0.151006:20140220T084443Z'], {:failonfail => false, :combine => true})
|
285
|
+
provider.expects(:unhold).with()
|
286
|
+
Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'update', *hash[:flags], 'dummy@1.0,5.11-0.151006:20140220T084443Z'], {:failonfail => false, :combine => true})
|
287
|
+
$CHILD_STATUS.stubs(:exitstatus).returns 0
|
288
|
+
provider.insync?(is)
|
289
|
+
provider.install
|
290
|
+
end
|
291
|
+
|
292
|
+
it "issues a warning when an implicit version number is used, and in sync" do
|
293
|
+
resource[:ensure] = '1.0-0.151006'
|
294
|
+
is = '1.0,5.11-0.151006:20140220T084443Z'
|
295
|
+
provider.expects(:warning).with("Implicit version 1.0-0.151006 has 3 possible matches")
|
296
|
+
described_class.expects(:pkg).with(:list, '-Hvfa', 'dummy@1.0-0.151006').returns File.read(my_fixture('dummy_implicit_version'))
|
297
|
+
Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'update', '-n', 'dummy@1.0,5.11-0.151006:20140220T084443Z'], {:failonfail => false, :combine => true})
|
298
|
+
$CHILD_STATUS.stubs(:exitstatus).returns 4
|
299
|
+
provider.insync?(is)
|
300
|
+
end
|
301
|
+
|
302
|
+
it "issues a warning when choosing a version number for an implicit match" do
|
303
|
+
resource[:ensure] = '1.0-0.151006'
|
304
|
+
is = :absent
|
305
|
+
provider.expects(:warning).with("Implicit version 1.0-0.151006 has 3 possible matches")
|
306
|
+
provider.expects(:warning).with("Selecting version '1.0,5.11-0.151006:20140220T084443Z' for implicit '1.0-0.151006'")
|
307
|
+
described_class.expects(:pkg).with(:list, '-Hvfa', 'dummy@1.0-0.151006').returns File.read(my_fixture('dummy_implicit_version'))
|
308
|
+
Puppet::Util::Execution.expects(:execute).with(['/bin/pkg', 'install', '-n', 'dummy@1.0,5.11-0.151006:20140220T084443Z'], {:failonfail => false, :combine => true})
|
309
|
+
$CHILD_STATUS.stubs(:exitstatus).returns 0
|
310
|
+
provider.insync?(is)
|
311
|
+
end
|
312
|
+
end
|
303
313
|
end
|
304
314
|
end
|
305
315
|
|
@@ -90,6 +90,7 @@ describe provider_class, :unless => Puppet.features.microsoft_windows? do
|
|
90
90
|
it "should be able to parse name if it includes whitespace" do
|
91
91
|
expect(@provider_class.parse_line('ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQC7pHZ1XRj3tXbFpPFhMGU1bVwz7jr13zt/wuE+pVIJA8GlmHYuYtIxHPfDHlkixdwLachCpSQUL9NbYkkRFRn9m6PZ7125ohE4E4m96QS6SGSQowTiRn4Lzd9LV38g93EMHjPmEkdSq7MY4uJEd6DUYsLvaDYdIgBiLBIWPA3OrQ== fancy user')[:name]).to eq('fancy user')
|
92
92
|
expect(@provider_class.parse_line('from="host1.reductlivelabs.com,host.reductivelabs.com",command="/usr/local/bin/run",ssh-pty ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQC7pHZ1XRj3tXbFpPFhMGU1bVwz7jr13zt/wuE+pVIJA8GlmHYuYtIxHPfDHlkixdwLachCpSQUL9NbYkkRFRn9m6PZ7125ohE4E4m96QS6SGSQowTiRn4Lzd9LV38g93EMHjPmEkdSq7MY4uJEd6DUYsLvaDYdIgBiLBIWPA3OrQ== fancy user')[:name]).to eq('fancy user')
|
93
|
+
expect(@provider_class.parse_line('ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQC7pHZ1XRj3tXbFpPFhMGU1bVwz7jr13zt/wuE+pVIJA8GlmHYuYtIxHPfDHlkixdwLachCpSQUL9NbYkkRFRn9m6PZ7125ohE4E4m96QS6SGSQowTiRn4Lzd9LV38g93EMHjPmEkdSq7MY4uJEd6DUYsLvaDYdIgBiLBIWPA3OrQ== whitespace fan')[:name]).to eq('whitespace fan')
|
93
94
|
end
|
94
95
|
|
95
96
|
it "should be able to parse options containing commas via its parse_options method" do
|
@@ -84,7 +84,7 @@ guest id=100 pgrp=usr groups=usr home=/home/guest
|
|
84
84
|
it "should allow a single attribute to be specified" do
|
85
85
|
@resource.stubs(:original_parameters).returns({ :attributes => single_attribute_array })
|
86
86
|
keys = @provider.managed_attribute_keys(existing_attributes)
|
87
|
-
keys.
|
87
|
+
expect(keys).to be_include(:rlogin)
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
@@ -60,12 +60,18 @@ describe Puppet::Type.type(:user).provider(:directoryservice) do
|
|
60
60
|
}
|
61
61
|
end
|
62
62
|
|
63
|
+
let(:sha512_shadowhashdata_array) do
|
64
|
+
['62706c69 73743030 d101025d 53414c54 45442d53 48413531 324f1044 7ea7d592 131f57b2 c8f8bdbc '\
|
65
|
+
'ec8d9df1 2128a386 393a4f00 c7619bac 2622a44d 451419d1 1da512d5 915ab98e 39718ac9 4083fe2e '\
|
66
|
+
'fd6bf710 a54d477f 8ff735b1 2587192d 080b1900 00000000 00010100 00000000 00000300 00000000 '\
|
67
|
+
'00000000 00000000 000060']
|
68
|
+
end
|
63
69
|
# The below value is the result of executing
|
64
70
|
# `dscl -plist . read /Users/<username> ShadowHashData` on a 10.7
|
65
71
|
# system and converting it to a native Ruby Hash with Plist.parse_xml
|
66
72
|
let(:sha512_shadowhashdata_hash) do
|
67
73
|
{
|
68
|
-
'dsAttrTypeNative:ShadowHashData' =>
|
74
|
+
'dsAttrTypeNative:ShadowHashData' => sha512_shadowhashdata_array
|
69
75
|
}
|
70
76
|
end
|
71
77
|
|
@@ -93,12 +99,21 @@ describe Puppet::Type.type(:user).provider(:directoryservice) do
|
|
93
99
|
'7ea7d592131f57b2c8f8bdbcec8d9df12128a386393a4f00c7619bac2622a44d451419d11da512d5915ab98e39718ac94083fe2efd6bf710a54d477f8ff735b12587192d'
|
94
100
|
end
|
95
101
|
|
102
|
+
let(:pbkdf2_shadowhashdata_array) do
|
103
|
+
['62706c69 73743030 d101025f 10145341 4c544544 2d534841 3531322d 50424b44 4632d303 04050607 '\
|
104
|
+
'0857656e 74726f70 79547361 6c745a69 74657261 74696f6e 734f1080 0590ade1 9e6953c1 35ae872a '\
|
105
|
+
'e7761823 5df7d46c 63de7f9a 0fcdf2cd 9e7d85e4 b7ca8681 01235b61 58e05a30 9805ee48 14b027a4 '\
|
106
|
+
'be9c23ec 2926bc81 72269aff ba5c9a59 85e81091 fa689807 6d297f1f aa75fa61 7551ef16 71d75200 '\
|
107
|
+
'55c4a0d9 7b9b9c58 05aa322b aedbcd8e e9c52381 1653ac2e a9e9c8d8 f1ac519a 0f2b595e 4f102093 '\
|
108
|
+
'77c46908 a1c8ac2c 3e45c0d4 4da8ad0f cd85ec5c 14d9a59f fc40c9da 31f0ec11 60b0080b 22293136 '\
|
109
|
+
'41c4e700 00000000 00010100 00000000 00000900 00000000 00000000 00000000 0000ea']
|
110
|
+
end
|
96
111
|
# The below value is the result of executing
|
97
112
|
# `dscl -plist . read /Users/<username> ShadowHashData` on a 10.8
|
98
113
|
# system and converting it to a native Ruby Hash with Plist.parse_xml
|
99
114
|
let(:pbkdf2_shadowhashdata_hash) do
|
100
115
|
{
|
101
|
-
"dsAttrTypeNative:ShadowHashData"=>
|
116
|
+
"dsAttrTypeNative:ShadowHashData"=> pbkdf2_shadowhashdata_array
|
102
117
|
}
|
103
118
|
end
|
104
119
|
|
@@ -148,12 +163,47 @@ describe Puppet::Type.type(:user).provider(:directoryservice) do
|
|
148
163
|
24752
|
149
164
|
end
|
150
165
|
|
166
|
+
let(:pbkdf2_and_ssha512_shadowhashdata_array) do
|
167
|
+
['62706c69 73743030 d2010203 0a5f1014 53414c54 45442d53 48413531 322d5042 4b444632 5d53414c '\
|
168
|
+
'5445442d 53484135 3132d304 05060708 0957656e 74726f70 79547361 6c745a69 74657261 74696f6e '\
|
169
|
+
'734f1080 0590ade1 9e6953c1 35ae872a e7761823 5df7d46c 63de7f9a 0fcdf2cd 9e7d85e4 b7ca8681 '\
|
170
|
+
'01235b61 58e05a30 9805ee48 14b027a4 be9c23ec 2926bc81 72269aff ba5c9a59 85e81091 fa689807 '\
|
171
|
+
'6d297f1f aa75fa61 7551ef16 71d75200 55c4a0d9 7b9b9c58 05aa322b aedbcd8e e9c52381 1653ac2e '\
|
172
|
+
'a9e9c8d8 f1ac519a 0f2b595e 4f102093 77c46908 a1c8ac2c 3e45c0d4 4da8ad0f cd85ec5c 14d9a59f '\
|
173
|
+
'fc40c9da 31f0ec11 60b04f10 447ea7d5 92131f57 b2c8f8bd bcec8d9d f12128a3 86393a4f 00c7619b '\
|
174
|
+
'ac2622a4 4d451419 d11da512 d5915ab9 8e39718a c94083fe 2efd6bf7 10a54d47 7f8ff735 b1258719 '\
|
175
|
+
'2d000800 0d002400 32003900 41004600 5100d400 f700fa00 00000000 00020100 00000000 00000b00 '\
|
176
|
+
'00000000 00000000 00000000 000141']
|
177
|
+
end
|
178
|
+
|
179
|
+
let(:pbkdf2_and_ssha512_shadowhashdata_hash) do
|
180
|
+
{
|
181
|
+
'dsAttrTypeNative:ShadowHashData' => pbkdf2_and_ssha512_shadowhashdata_array
|
182
|
+
}
|
183
|
+
end
|
184
|
+
|
185
|
+
let (:pbkdf2_and_ssha512_embedded_plist) do
|
186
|
+
"bplist00\xD2\x01\x02\x03\n_\x10\x14SALTED-SHA512-PBKDF2]SALTED-SHA512\xD3\x04\x05\x06\a\b\tWentropyTsaltZiterationsO\x10\x80\x05\x90\xAD\xE1\x9EiS\xC15\xAE\x87*\xE7v\x18#]\xF7\xD4lc\xDE\x7F\x9A\x0F\xCD\xF2\xCD\x9E}\x85\xE4\xB7\xCA\x86\x81\x01#[aX\xE0Z0\x98\x05\xEEH\x14\xB0'\xA4\xBE\x9C#\xEC)&\xBC\x81r&\x9A\xFF\xBA\\\x9AY\x85\xE8\x10\x91\xFAh\x98\am)\x7F\x1F\xAAu\xFAauQ\xEF\x16q\xD7R\x00U\xC4\xA0\xD9{\x9B\x9CX\x05\xAA2+\xAE\xDB\xCD\x8E\xE9\xC5#\x81\x16S\xAC.\xA9\xE9\xC8\xD8\xF1\xACQ\x9A\x0F+Y^O\x10 \x93w\xC4i\b\xA1\xC8\xAC,>E\xC0\xD4M\xA8\xAD\x0F\xCD\x85\xEC\\\x14\xD9\xA5\x9F\xFC@\xC9\xDA1\xF0\xEC\x11`\xB0O\x10D~\xA7\xD5\x92\x13\x1FW\xB2\xC8\xF8\xBD\xBC\xEC\x8D\x9D\xF1!(\xA3\x869:O\x00\xC7a\x9B\xAC&\"\xA4ME\x14\x19\xD1\x1D\xA5\x12\xD5\x91Z\xB9\x8E9q\x8A\xC9@\x83\xFE.\xFDk\xF7\x10\xA5MG\x7F\x8F\xF75\xB1%\x87\x19-\x00\b\x00\r\x00$\x002\x009\x00A\x00F\x00Q\x00\xD4\x00\xF7\x00\xFA\x00\x00\x00\x00\x00\x00\x02\x01\x00\x00\x00\x00\x00\x00\x00\v\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01A"
|
187
|
+
end
|
188
|
+
|
189
|
+
let (:pbkdf2_and_ssha512_embedded_bplist_hash) do
|
190
|
+
{
|
191
|
+
"SALTED-SHA512-PBKDF2" => {
|
192
|
+
"entropy" => pbkdf2_pw_string,
|
193
|
+
"salt" => pbkdf2_salt_value,
|
194
|
+
"iterations" => pbkdf2_iterations_value,
|
195
|
+
},
|
196
|
+
"SALTED-SHA512" => sha512_password_hash
|
197
|
+
}
|
198
|
+
end
|
199
|
+
|
151
200
|
# The below represents output of 'dscl -plist . readall /Users' converted to
|
152
201
|
# a native Ruby hash if only one user were installed on the system.
|
153
202
|
# This lets us check the behavior of all the methods necessary to return a
|
154
203
|
# user's groups property by controlling the data provided by dscl
|
155
|
-
let(:
|
156
|
-
|
204
|
+
let(:testuser_base) do
|
205
|
+
{
|
206
|
+
"dsAttrTypeStandard:RecordName" =>["nonexistent_user"],
|
157
207
|
"dsAttrTypeStandard:UniqueID" =>["1000"],
|
158
208
|
"dsAttrTypeStandard:AuthenticationAuthority"=>
|
159
209
|
[";Kerberosv5;;testuser@LKDC:SHA1.4383E152D9D394AA32D13AE98F6F6E1FE8D00F81;LKDC:SHA1.4383E152D9D394AA32D13AE98F6F6E1FE8D00F81",
|
@@ -172,7 +222,14 @@ describe Puppet::Type.type(:user).provider(:directoryservice) do
|
|
172
222
|
["<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n <plist version=\"1.0\">\n <dict>\n <key>failedLoginCount</key>\n <integer>0</integer>\n <key>failedLoginTimestamp</key>\n <date>2001-01-01T00:00:00Z</date>\n <key>lastLoginTimestamp</key>\n <date>2001-01-01T00:00:00Z</date>\n <key>passwordTimestamp</key>\n <date>2012-08-10T23:53:50Z</date>\n </dict>\n </plist>\n "],
|
173
223
|
"dsAttrTypeStandard:UserShell" =>["/bin/bash"],
|
174
224
|
"dsAttrTypeNative:ShadowHashData" =>
|
175
|
-
["62706c69 73743030 d101025d 53414c54 45442d53 48413531 324f1044 7ea7d592 131f57b2 c8f8bdbc ec8d9df1 2128a386 393a4f00 c7619bac 2622a44d 451419d1 1da512d5 915ab98e 39718ac9 4083fe2e fd6bf710 a54d477f 8ff735b1 2587192d 080b1900 00000000 00010100 00000000 00000300 00000000 00000000 00000000 000060"]
|
225
|
+
["62706c69 73743030 d101025d 53414c54 45442d53 48413531 324f1044 7ea7d592 131f57b2 c8f8bdbc ec8d9df1 2128a386 393a4f00 c7619bac 2622a44d 451419d1 1da512d5 915ab98e 39718ac9 4083fe2e fd6bf710 a54d477f 8ff735b1 2587192d 080b1900 00000000 00010100 00000000 00000300 00000000 00000000 00000000 000060"]
|
226
|
+
}
|
227
|
+
end
|
228
|
+
let(:testuser_hash) do
|
229
|
+
[
|
230
|
+
testuser_base.merge(sha512_shadowhashdata_hash),
|
231
|
+
testuser_base.merge(pbkdf2_shadowhashdata_hash),
|
232
|
+
]
|
176
233
|
end
|
177
234
|
|
178
235
|
# The below represents the result of running Plist.parse_xml on XML
|
@@ -320,7 +377,7 @@ describe Puppet::Type.type(:user).provider(:directoryservice) do
|
|
320
377
|
:groups => 'testgroup,third',
|
321
378
|
:comment => username,
|
322
379
|
:password => sha512_password_hash,
|
323
|
-
:shadowhashdata =>
|
380
|
+
:shadowhashdata => sha512_shadowhashdata_array,
|
324
381
|
:name => username,
|
325
382
|
:uid => 1000,
|
326
383
|
:gid => 22,
|
@@ -331,9 +388,9 @@ describe Puppet::Type.type(:user).provider(:directoryservice) do
|
|
331
388
|
before :each do
|
332
389
|
provider.class.stubs(:get_os_version).returns('10.7')
|
333
390
|
provider.class.stubs(:get_all_users).returns(testuser_hash)
|
334
|
-
provider.class.stubs(:get_attribute_from_dscl).with('Users', username, 'ShadowHashData').returns(sha512_shadowhashdata_hash)
|
335
391
|
provider.class.stubs(:get_list_of_groups).returns(group_plist_hash_guid)
|
336
392
|
provider.class.stubs(:convert_binary_to_hash).with(sha512_embedded_bplist).returns(sha512_embedded_bplist_hash)
|
393
|
+
provider.class.stubs(:convert_binary_to_hash).with(pbkdf2_embedded_plist).returns(pbkdf2_embedded_bplist_hash)
|
337
394
|
provider.class.prefetch({})
|
338
395
|
end
|
339
396
|
|
@@ -346,19 +403,21 @@ describe Puppet::Type.type(:user).provider(:directoryservice) do
|
|
346
403
|
end
|
347
404
|
|
348
405
|
it 'should return a hash of resource attributes' do
|
349
|
-
expect(provider.class.generate_attribute_hash(user_plist_hash)).to eq(user_plist_resource)
|
406
|
+
expect(provider.class.generate_attribute_hash(user_plist_hash.merge(sha512_shadowhashdata_hash))).to eq(user_plist_resource)
|
350
407
|
end
|
351
408
|
end
|
352
409
|
|
353
|
-
describe 'self#generate_attribute_hash
|
410
|
+
describe 'self#generate_attribute_hash with pbkdf2 and ssha512' do
|
354
411
|
let(:user_plist_resource) do
|
355
412
|
{
|
356
413
|
:ensure => :present,
|
357
414
|
:provider => :directoryservice,
|
358
415
|
:groups => 'testgroup,third',
|
359
416
|
:comment => username,
|
360
|
-
:password =>
|
361
|
-
:
|
417
|
+
:password => pbkdf2_password_hash,
|
418
|
+
:iterations => pbkdf2_iterations_value,
|
419
|
+
:salt => pbkdf2_salt_value,
|
420
|
+
:shadowhashdata => pbkdf2_and_ssha512_shadowhashdata_array,
|
362
421
|
:name => username,
|
363
422
|
:uid => 1000,
|
364
423
|
:gid => 22,
|
@@ -366,28 +425,41 @@ describe Puppet::Type.type(:user).provider(:directoryservice) do
|
|
366
425
|
}
|
367
426
|
end
|
368
427
|
|
369
|
-
|
428
|
+
before :each do
|
370
429
|
provider.class.stubs(:get_os_version).returns('10.7')
|
371
430
|
provider.class.stubs(:get_all_users).returns(testuser_hash)
|
372
|
-
provider.class.stubs(:get_attribute_from_dscl).with('Users', username, 'ShadowHashData').returns(nil)
|
373
431
|
provider.class.stubs(:get_list_of_groups).returns(group_plist_hash_guid)
|
374
|
-
provider.class.stubs(:convert_binary_to_hash).with(sha512_embedded_bplist).returns(sha512_embedded_bplist_hash)
|
375
432
|
provider.class.prefetch({})
|
376
|
-
expect(provider.class.generate_attribute_hash(user_plist_hash)).to eq(user_plist_resource)
|
377
433
|
end
|
434
|
+
|
435
|
+
it 'should return a hash of resource attributes' do
|
436
|
+
expect(provider.class.generate_attribute_hash(user_plist_hash.merge(pbkdf2_and_ssha512_shadowhashdata_hash))).to eq(user_plist_resource)
|
437
|
+
end
|
438
|
+
|
378
439
|
end
|
379
440
|
|
380
|
-
describe '#
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
441
|
+
describe 'self#generate_attribute_hash empty shadowhashdata' do
|
442
|
+
let(:user_plist_resource) do
|
443
|
+
{
|
444
|
+
:ensure => :present,
|
445
|
+
:provider => :directoryservice,
|
446
|
+
:groups => 'testgroup,third',
|
447
|
+
:comment => username,
|
448
|
+
:password => '*',
|
449
|
+
:shadowhashdata => nil,
|
450
|
+
:name => username,
|
451
|
+
:uid => 1000,
|
452
|
+
:gid => 22,
|
453
|
+
:home => user_path
|
454
|
+
}
|
386
455
|
end
|
387
456
|
|
388
|
-
it 'should
|
389
|
-
provider.
|
390
|
-
|
457
|
+
it 'should handle empty shadowhashdata' do
|
458
|
+
provider.class.stubs(:get_os_version).returns('10.7')
|
459
|
+
provider.class.stubs(:get_all_users).returns([testuser_base])
|
460
|
+
provider.class.stubs(:get_list_of_groups).returns(group_plist_hash_guid)
|
461
|
+
provider.class.prefetch({})
|
462
|
+
expect(provider.class.generate_attribute_hash(user_plist_hash)).to eq(user_plist_resource)
|
391
463
|
end
|
392
464
|
end
|
393
465
|
|
@@ -445,16 +517,17 @@ describe Puppet::Type.type(:user).provider(:directoryservice) do
|
|
445
517
|
|
446
518
|
before :each do
|
447
519
|
provider.class.stubs(:get_all_users).returns(testuser_hash)
|
448
|
-
provider.class.stubs(:get_attribute_from_dscl).with('Users', username, 'ShadowHashData').returns([])
|
449
520
|
provider.class.stubs(:get_os_version).returns('10.7')
|
450
521
|
end
|
451
522
|
|
452
523
|
it "should return a list of groups if the user's name matches GroupMembership" do
|
524
|
+
provider.class.expects(:get_list_of_groups).returns(group_plist_hash)
|
453
525
|
provider.class.expects(:get_list_of_groups).returns(group_plist_hash)
|
454
526
|
expect(provider.class.prefetch({}).first.groups).to eq('second,testgroup')
|
455
527
|
end
|
456
528
|
|
457
529
|
it "should return a list of groups if the user's GUID matches GroupMembers" do
|
530
|
+
provider.class.expects(:get_list_of_groups).returns(group_plist_hash_guid)
|
458
531
|
provider.class.expects(:get_list_of_groups).returns(group_plist_hash_guid)
|
459
532
|
expect(provider.class.prefetch({}).first.groups).to eq('testgroup,third')
|
460
533
|
end
|
@@ -505,7 +578,6 @@ describe Puppet::Type.type(:user).provider(:directoryservice) do
|
|
505
578
|
end
|
506
579
|
|
507
580
|
it 'should call dscl to add necessary groups' do
|
508
|
-
provider.class.expects(:get_attribute_from_dscl).with('Users', username, 'ShadowHashData').returns([])
|
509
581
|
provider.class.expects(:get_attribute_from_dscl).with('Users', username, 'GeneratedUID').returns({'dsAttrTypeStandard:GeneratedUID' => ['guidnonexistent_user']})
|
510
582
|
provider.expects(:groups).returns('two,three')
|
511
583
|
provider.expects(:dscl).with('.', '-merge', '/Groups/one', 'GroupMembership', 'nonexistent_user')
|
@@ -515,15 +587,15 @@ describe Puppet::Type.type(:user).provider(:directoryservice) do
|
|
515
587
|
end
|
516
588
|
|
517
589
|
it 'should call the get_salted_sha512 method on 10.7 and return the correct hash' do
|
518
|
-
provider.class.expects(:get_attribute_from_dscl).with('Users', username, 'ShadowHashData').returns(sha512_shadowhashdata_hash)
|
519
590
|
provider.class.expects(:convert_binary_to_hash).with(sha512_embedded_bplist).returns(sha512_embedded_bplist_hash)
|
591
|
+
provider.class.expects(:convert_binary_to_hash).with(pbkdf2_embedded_plist).returns(pbkdf2_embedded_bplist_hash)
|
520
592
|
expect(provider.class.prefetch({}).first.password).to eq(sha512_password_hash)
|
521
593
|
end
|
522
594
|
|
523
595
|
it 'should call the get_salted_sha512_pbkdf2 method on 10.8 and return the correct hash' do
|
524
|
-
provider.class.expects(:
|
596
|
+
provider.class.expects(:convert_binary_to_hash).with(sha512_embedded_bplist).returns(sha512_embedded_bplist_hash)
|
525
597
|
provider.class.expects(:convert_binary_to_hash).with(pbkdf2_embedded_plist).returns(pbkdf2_embedded_bplist_hash)
|
526
|
-
expect(provider.class.prefetch({}).
|
598
|
+
expect(provider.class.prefetch({}).last.password).to eq(pbkdf2_password_hash)
|
527
599
|
end
|
528
600
|
|
529
601
|
end
|
@@ -1057,7 +1129,6 @@ describe Puppet::Type.type(:user).provider(:directoryservice) do
|
|
1057
1129
|
before :each do
|
1058
1130
|
provider.class.stubs(:get_all_users).returns(all_users_hash)
|
1059
1131
|
provider.class.stubs(:get_list_of_groups).returns(group_plist_hash_guid)
|
1060
|
-
provider.class.stubs(:get_attribute_from_dscl).with('Users', 'testuser', 'ShadowHashData').returns({})
|
1061
1132
|
provider.class.prefetch({})
|
1062
1133
|
end
|
1063
1134
|
|