chef 12.13.37-universal-mingw32 → 12.14.60-universal-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +48 -95
- data/Gemfile +6 -1
- data/README.md +9 -11
- data/VERSION +1 -1
- data/acceptance/.shared/kitchen_acceptance/.kitchen.ec2.yml +0 -1
- data/acceptance/Gemfile +4 -7
- data/acceptance/Gemfile.lock +59 -92
- data/acceptance/basics/test/integration/helpers/serverspec/Gemfile +8 -0
- data/acceptance/data-collector/test/integration/helpers/serverspec/Gemfile +8 -0
- data/acceptance/fips/test/integration/fips-integration/serverspec/Gemfile +6 -0
- data/acceptance/fips/test/integration/fips-unit-functional/serverspec/Gemfile +4 -0
- data/chef.gemspec +3 -2
- data/lib/chef/application/client.rb +4 -4
- data/lib/chef/application/solo.rb +2 -2
- data/lib/chef/chef_fs/command_line.rb +36 -34
- data/lib/chef/chef_fs/data_handler/data_handler_base.rb +2 -2
- data/lib/chef/chef_fs/file_pattern.rb +1 -1
- data/lib/chef/chef_fs/file_system.rb +139 -137
- data/lib/chef/chef_fs/parallelizer/parallel_enumerable.rb +2 -6
- data/lib/chef/cookbook/cookbook_version_loader.rb +27 -22
- data/lib/chef/cookbook/metadata.rb +1 -1
- data/lib/chef/cookbook/synchronizer.rb +3 -3
- data/lib/chef/cookbook_site_streaming_uploader.rb +3 -3
- data/lib/chef/cookbook_uploader.rb +1 -1
- data/lib/chef/cookbook_version.rb +6 -6
- data/lib/chef/dsl/powershell.rb +1 -1
- data/lib/chef/event_dispatch/base.rb +2 -2
- data/lib/chef/exceptions.rb +1 -1
- data/lib/chef/file_cache.rb +1 -1
- data/lib/chef/formatters/base.rb +2 -2
- data/lib/chef/formatters/doc.rb +2 -2
- data/lib/chef/http.rb +48 -18
- data/lib/chef/http/auth_credentials.rb +1 -1
- data/lib/chef/http/basic_client.rb +11 -2
- data/lib/chef/http/socketless_chef_zero_client.rb +2 -2
- data/lib/chef/key.rb +55 -56
- data/lib/chef/knife.rb +70 -61
- data/lib/chef/knife/client_delete.rb +2 -2
- data/lib/chef/knife/cookbook_bulk_delete.rb +1 -1
- data/lib/chef/knife/cookbook_show.rb +1 -1
- data/lib/chef/knife/core/gem_glob_loader.rb +3 -3
- data/lib/chef/knife/search.rb +2 -2
- data/lib/chef/knife/ssh.rb +19 -21
- data/lib/chef/knife/status.rb +2 -2
- data/lib/chef/mixin/command/unix.rb +2 -2
- data/lib/chef/mixin/powershell_type_coercions.rb +1 -1
- data/lib/chef/mixin/properties.rb +3 -0
- data/lib/chef/mixin/securable.rb +2 -2
- data/lib/chef/mixin/shell_out.rb +30 -0
- data/lib/chef/mixin/uris.rb +2 -1
- data/lib/chef/mixin/windows_architecture_helper.rb +3 -4
- data/lib/chef/monkey_patches/webrick-utils.rb +2 -2
- data/lib/chef/monologger.rb +1 -1
- data/lib/chef/node.rb +2 -2
- data/lib/chef/node/attribute.rb +3 -3
- data/lib/chef/platform/provider_mapping.rb +5 -2
- data/lib/chef/property.rb +14 -3
- data/lib/chef/provider/apt_repository.rb +3 -7
- data/lib/chef/provider/apt_update.rb +4 -6
- data/lib/chef/provider/cron.rb +1 -2
- data/lib/chef/provider/dsc_script.rb +4 -4
- data/lib/chef/provider/group/usermod.rb +1 -1
- data/lib/chef/provider/link.rb +10 -3
- data/lib/chef/provider/osx_profile.rb +10 -10
- data/lib/chef/provider/package.rb +2 -12
- data/lib/chef/provider/package/rubygems.rb +17 -16
- data/lib/chef/provider/package/windows.rb +2 -0
- data/lib/chef/provider/package/windows/exe.rb +1 -1
- data/lib/chef/provider/package/windows/registry_uninstall_entry.rb +0 -2
- data/lib/chef/provider/package/yum/rpm_utils.rb +8 -8
- data/lib/chef/provider/package/yum/yum_cache.rb +1 -1
- data/lib/chef/provider/remote_file/ftp.rb +2 -2
- data/lib/chef/provider/remote_file/sftp.rb +2 -2
- data/lib/chef/provider/service/debian.rb +2 -2
- data/lib/chef/provider/service/simple.rb +4 -3
- data/lib/chef/provider/service/solaris.rb +1 -1
- data/lib/chef/provider/service/systemd.rb +2 -2
- data/lib/chef/provider/service/upstart.rb +8 -5
- data/lib/chef/provider/support/yum_repo.erb +125 -0
- data/lib/chef/provider/systemd_unit.rb +11 -2
- data/lib/chef/provider/template_finder.rb +1 -1
- data/lib/chef/provider/user.rb +20 -16
- data/lib/chef/provider/user/aix.rb +5 -2
- data/lib/chef/provider/user/dscl.rb +1 -0
- data/lib/chef/provider/user/linux.rb +128 -0
- data/lib/chef/provider/user/pw.rb +2 -1
- data/lib/chef/provider/user/solaris.rb +3 -2
- data/lib/chef/provider/user/useradd.rb +5 -4
- data/lib/chef/provider/user/windows.rb +1 -1
- data/lib/chef/provider/windows_script.rb +5 -2
- data/lib/chef/provider/yum_repository.rb +121 -0
- data/lib/chef/providers.rb +4 -2
- data/lib/chef/resource.rb +7 -9
- data/lib/chef/resource/conditional.rb +9 -1
- data/lib/chef/resource/launchd.rb +1 -1
- data/lib/chef/resource/user.rb +3 -3
- data/lib/chef/resource/user/aix_user.rb +31 -0
- data/lib/chef/resource/user/dscl_user.rb +31 -0
- data/lib/chef/resource/user/linux_user.rb +51 -0
- data/lib/chef/resource/user/pw_user.rb +31 -0
- data/lib/chef/resource/user/solaris_user.rb +31 -0
- data/lib/chef/resource/user/windows_user.rb +31 -0
- data/lib/chef/resource/yum_package.rb +13 -12
- data/lib/chef/resource/yum_repository.rb +76 -0
- data/lib/chef/resource_builder.rb +1 -1
- data/lib/chef/resource_collection/stepable_iterator.rb +1 -3
- data/lib/chef/resource_reporter.rb +5 -5
- data/lib/chef/resources.rb +7 -0
- data/lib/chef/run_context.rb +5 -3
- data/lib/chef/run_context/cookbook_compiler.rb +3 -2
- data/lib/chef/run_list.rb +2 -2
- data/lib/chef/search/query.rb +11 -8
- data/lib/chef/shell/ext.rb +2 -2
- data/lib/chef/shell/shell_session.rb +1 -1
- data/lib/chef/util/dsc/configuration_generator.rb +1 -1
- data/lib/chef/util/powershell/cmdlet.rb +5 -2
- data/lib/chef/util/selinux.rb +1 -1
- data/lib/chef/version.rb +1 -1
- data/lib/chef/version_class.rb +2 -2
- data/lib/chef/version_constraint.rb +2 -2
- data/lib/chef/win32/api/error.rb +2 -2
- data/lib/chef/win32/api/net.rb +1 -1
- data/lib/chef/win32/eventlog.rb +1 -1
- data/lib/chef/win32/net.rb +1 -1
- data/lib/chef/win32/security/sid.rb +1 -1
- data/spec/functional/assets/testchefsubsys +2 -3
- data/spec/functional/event_loggers/windows_eventlog_spec.rb +11 -8
- data/spec/functional/file_content_management/deploy_strategies_spec.rb +1 -1
- data/spec/functional/http/simple_spec.rb +2 -2
- data/spec/functional/knife/cookbook_delete_spec.rb +5 -5
- data/spec/functional/knife/exec_spec.rb +6 -6
- data/spec/functional/knife/ssh_spec.rb +4 -4
- data/spec/functional/notifications_spec.rb +2 -2
- data/spec/functional/provider/whyrun_safe_ruby_block_spec.rb +2 -2
- data/spec/functional/rebooter_spec.rb +5 -5
- data/spec/functional/resource/bash_spec.rb +2 -2
- data/spec/functional/resource/deploy_revision_spec.rb +1 -1
- data/spec/functional/resource/dpkg_package_spec.rb +2 -2
- data/spec/functional/resource/dsc_resource_spec.rb +5 -5
- data/spec/functional/resource/dsc_script_spec.rb +27 -22
- data/spec/functional/resource/env_spec.rb +4 -4
- data/spec/functional/resource/execute_spec.rb +4 -4
- data/spec/functional/resource/group_spec.rb +20 -8
- data/spec/functional/resource/link_spec.rb +34 -0
- data/spec/functional/resource/ohai_spec.rb +6 -6
- data/spec/functional/resource/reboot_spec.rb +2 -2
- data/spec/functional/resource/remote_file_spec.rb +16 -7
- data/spec/functional/resource/user/dscl_spec.rb +3 -3
- data/spec/functional/resource/user/useradd_spec.rb +32 -26
- data/spec/functional/resource/windows_service_spec.rb +15 -15
- data/spec/functional/rest_spec.rb +2 -2
- data/spec/functional/run_lock_spec.rb +9 -9
- data/spec/functional/tiny_server_spec.rb +9 -8
- data/spec/functional/win32/crypto_spec.rb +1 -1
- data/spec/functional/win32/security_spec.rb +8 -8
- data/spec/integration/client/client_spec.rb +6 -4
- data/spec/integration/knife/chef_repo_path_spec.rb +70 -1
- data/spec/integration/knife/upload_spec.rb +1 -1
- data/spec/integration/recipes/lwrp_inline_resources_spec.rb +6 -6
- data/spec/integration/recipes/noop_resource_spec.rb +4 -4
- data/spec/integration/recipes/provider_choice.rb +3 -3
- data/spec/integration/recipes/recipe_dsl_spec.rb +318 -317
- data/spec/integration/recipes/resource_action_spec.rb +50 -54
- data/spec/integration/recipes/resource_converge_if_changed_spec.rb +34 -34
- data/spec/integration/recipes/resource_load_spec.rb +24 -24
- data/spec/integration/solo/solo_spec.rb +21 -30
- data/spec/scripts/ssl-serve.rb +1 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/stress/win32/security_spec.rb +4 -4
- data/spec/support/chef_helpers.rb +22 -0
- data/spec/support/platform_helpers.rb +5 -1
- data/spec/support/shared/context/client.rb +3 -2
- data/spec/support/shared/functional/file_resource.rb +5 -4
- data/spec/support/shared/functional/http.rb +16 -16
- data/spec/support/shared/functional/securable_resource.rb +5 -5
- data/spec/support/shared/functional/win32_service.rb +5 -7
- data/spec/support/shared/integration/app_server_support.rb +1 -3
- data/spec/support/shared/integration/knife_support.rb +0 -2
- data/spec/support/shared/shared_examples.rb +2 -2
- data/spec/support/shared/unit/api_versioning.rb +2 -2
- data/spec/support/shared/unit/application_dot_d.rb +9 -6
- data/spec/support/shared/unit/provider/file.rb +2 -2
- data/spec/support/shared/unit/provider/useradd_based_user_provider.rb +49 -80
- data/spec/support/shared/unit/resource/static_provider_resolution.rb +2 -2
- data/spec/support/shared/unit/script_resource.rb +4 -4
- data/spec/support/shared/unit/user_and_client_shared.rb +4 -4
- data/spec/tiny_server.rb +51 -66
- data/spec/unit/api_client_v1_spec.rb +2 -2
- data/spec/unit/application_spec.rb +1 -1
- data/spec/unit/audit/audit_event_proxy_spec.rb +34 -27
- data/spec/unit/audit/audit_reporter_spec.rb +32 -23
- data/spec/unit/audit/control_group_data_spec.rb +19 -14
- data/spec/unit/chef_class_spec.rb +1 -1
- data/spec/unit/chef_fs/data_handler/group_handler_spec.rb +1 -1
- data/spec/unit/chef_fs/diff_spec.rb +4 -4
- data/spec/unit/chef_fs/file_system/operation_failed_error_spec.rb +4 -4
- data/spec/unit/chef_fs/file_system_spec.rb +2 -2
- data/spec/unit/chef_fs/parallelizer.rb +5 -7
- data/spec/unit/cookbook/metadata_spec.rb +98 -98
- data/spec/unit/cookbook/synchronizer_spec.rb +7 -0
- data/spec/unit/cookbook_loader_spec.rb +24 -24
- data/spec/unit/cookbook_version_file_specificity_spec.rb +8 -8
- data/spec/unit/daemon_spec.rb +1 -1
- data/spec/unit/data_bag_item_spec.rb +18 -18
- data/spec/unit/data_bag_spec.rb +2 -2
- data/spec/unit/data_collector/messages/helpers_spec.rb +9 -9
- data/spec/unit/data_collector/messages_spec.rb +2 -2
- data/spec/unit/data_collector_spec.rb +19 -19
- data/spec/unit/dsl/audit_spec.rb +3 -3
- data/spec/unit/dsl/data_query_spec.rb +3 -2
- data/spec/unit/dsl/declare_resource_spec.rb +10 -10
- data/spec/unit/encrypted_data_bag_item/check_encrypted_spec.rb +3 -2
- data/spec/unit/encrypted_data_bag_item_spec.rb +3 -2
- data/spec/unit/environment_spec.rb +6 -6
- data/spec/unit/event_dispatch/dispatcher_spec.rb +2 -2
- data/spec/unit/file_access_control_spec.rb +3 -3
- data/spec/unit/file_content_management/tempfile_spec.rb +2 -2
- data/spec/unit/formatters/error_inspectors/api_error_formatting_spec.rb +2 -2
- data/spec/unit/guard_interpreter/resource_guard_interpreter_spec.rb +2 -2
- data/spec/unit/http/basic_client_spec.rb +20 -0
- data/spec/unit/http/validate_content_length_spec.rb +8 -8
- data/spec/unit/http_spec.rb +14 -0
- data/spec/unit/knife/bootstrap/chef_vault_handler_spec.rb +2 -2
- data/spec/unit/knife/bootstrap/client_builder_spec.rb +2 -2
- data/spec/unit/knife/bootstrap_spec.rb +8 -6
- data/spec/unit/knife/client_bulk_delete_spec.rb +8 -8
- data/spec/unit/knife/client_edit_spec.rb +2 -2
- data/spec/unit/knife/configure_client_spec.rb +2 -2
- data/spec/unit/knife/cookbook_metadata_spec.rb +4 -4
- data/spec/unit/knife/cookbook_site_install_spec.rb +6 -5
- data/spec/unit/knife/cookbook_site_share_spec.rb +2 -2
- data/spec/unit/knife/core/hashed_command_loader_spec.rb +5 -4
- data/spec/unit/knife/core/node_editor_spec.rb +3 -3
- data/spec/unit/knife/core/ui_spec.rb +2 -2
- data/spec/unit/knife/data_bag_from_file_spec.rb +4 -3
- data/spec/unit/knife/data_bag_show_spec.rb +3 -2
- data/spec/unit/knife/key_create_spec.rb +14 -14
- data/spec/unit/knife/key_delete_spec.rb +2 -2
- data/spec/unit/knife/key_edit_spec.rb +16 -16
- data/spec/unit/knife/key_list_spec.rb +6 -6
- data/spec/unit/knife/key_show_spec.rb +4 -4
- data/spec/unit/knife/status_spec.rb +3 -2
- data/spec/unit/knife/user_create_spec.rb +4 -4
- data/spec/unit/knife_spec.rb +7 -6
- data/spec/unit/lwrp_spec.rb +6 -6
- data/spec/unit/mixin/api_version_request_handling_spec.rb +2 -2
- data/spec/unit/mixin/command_spec.rb +17 -14
- data/spec/unit/mixin/deprecation_spec.rb +1 -1
- data/spec/unit/mixin/homebrew_user_spec.rb +2 -2
- data/spec/unit/mixin/params_validate_spec.rb +53 -52
- data/spec/unit/mixin/powershell_out_spec.rb +2 -2
- data/spec/unit/mixin/powershell_type_coercions_spec.rb +2 -2
- data/spec/unit/mixin/shell_out_spec.rb +1 -1
- data/spec/unit/mixin/xml_escape_spec.rb +3 -3
- data/spec/unit/node_spec.rb +2 -2
- data/spec/unit/platform/query_helpers_spec.rb +3 -3
- data/spec/unit/property_spec.rb +4 -4
- data/spec/unit/provider/cookbook_file_spec.rb +4 -4
- data/spec/unit/provider/cron/unix_spec.rb +4 -4
- data/spec/unit/provider/cron_spec.rb +2 -2
- data/spec/unit/provider/deploy_spec.rb +8 -8
- data/spec/unit/provider/dsc_resource_spec.rb +11 -10
- data/spec/unit/provider/dsc_script_spec.rb +9 -9
- data/spec/unit/provider/env/windows_spec.rb +8 -8
- data/spec/unit/provider/file/content_spec.rb +6 -6
- data/spec/unit/provider/file_spec.rb +4 -4
- data/spec/unit/provider/launchd_spec.rb +2 -1
- data/spec/unit/provider/link_spec.rb +155 -0
- data/spec/unit/provider/mount/mount_spec.rb +5 -5
- data/spec/unit/provider/mount/solaris_spec.rb +48 -48
- data/spec/unit/provider/osx_profile_spec.rb +6 -0
- data/spec/unit/provider/package/chocolatey_spec.rb +4 -4
- data/spec/unit/provider/package/freebsd/port_spec.rb +4 -4
- data/spec/unit/provider/package/rubygems_spec.rb +50 -44
- data/spec/unit/provider/package/windows/exe_spec.rb +9 -0
- data/spec/unit/provider/package/yum_spec.rb +61 -60
- data/spec/unit/provider/package_spec.rb +2 -2
- data/spec/unit/provider/powershell_script_spec.rb +4 -4
- data/spec/unit/provider/remote_directory_spec.rb +1 -1
- data/spec/unit/provider/remote_file/ftp_spec.rb +4 -4
- data/spec/unit/provider/remote_file/local_file_spec.rb +4 -2
- data/spec/unit/provider/remote_file/sftp_spec.rb +4 -4
- data/spec/unit/provider/remote_file_spec.rb +4 -4
- data/spec/unit/provider/script_spec.rb +4 -4
- data/spec/unit/provider/service/debian_service_spec.rb +4 -4
- data/spec/unit/provider/service/freebsd_service_spec.rb +12 -8
- data/spec/unit/provider/service/openbsd_service_spec.rb +12 -8
- data/spec/unit/provider/service/systemd_service_spec.rb +4 -4
- data/spec/unit/provider/service/upstart_service_spec.rb +27 -12
- data/spec/unit/provider/service/windows_spec.rb +10 -10
- data/spec/unit/provider/systemd_unit_spec.rb +2 -2
- data/spec/unit/provider/template/content_spec.rb +8 -8
- data/spec/unit/provider/template_spec.rb +8 -8
- data/spec/unit/provider/user/dscl_spec.rb +51 -51
- data/spec/unit/provider/user/linux_spec.rb +76 -0
- data/spec/unit/provider/user/pw_spec.rb +3 -6
- data/spec/unit/provider/user/solaris_spec.rb +5 -5
- data/spec/unit/provider/user/windows_spec.rb +3 -3
- data/spec/unit/provider/user_spec.rb +2 -2
- data/spec/unit/provider/yum_repository_spec.rb +35 -0
- data/spec/unit/provider_resolver_spec.rb +306 -264
- data/spec/unit/recipe_spec.rb +8 -7
- data/spec/unit/resource/apt_repository_spec.rb +4 -4
- data/spec/unit/resource/apt_update_spec.rb +4 -4
- data/spec/unit/resource/conditional_spec.rb +46 -0
- data/spec/unit/resource/dsc_resource_spec.rb +8 -8
- data/spec/unit/resource/dsc_script_spec.rb +4 -4
- data/spec/unit/resource/freebsd_package_spec.rb +6 -6
- data/spec/unit/resource/launchd_spec.rb +3 -2
- data/spec/unit/resource/osx_profile_spec.rb +3 -2
- data/spec/unit/resource/remote_file_spec.rb +6 -6
- data/spec/unit/resource/service_spec.rb +14 -14
- data/spec/unit/resource/user_spec.rb +1 -1
- data/spec/unit/resource/yum_repository_spec.rb +49 -0
- data/spec/unit/resource_collection_spec.rb +4 -4
- data/spec/unit/resource_definition_spec.rb +11 -11
- data/spec/unit/resource_reporter_spec.rb +4 -4
- data/spec/unit/resource_resolver_spec.rb +6 -6
- data/spec/unit/resource_spec.rb +36 -16
- data/spec/unit/run_context/child_run_context_spec.rb +4 -4
- data/spec/unit/run_context/cookbook_compiler_spec.rb +43 -1
- data/spec/unit/run_context_spec.rb +8 -8
- data/spec/unit/run_list/run_list_expansion_spec.rb +2 -2
- data/spec/unit/runner_spec.rb +2 -2
- data/spec/unit/search/query_spec.rb +15 -14
- data/spec/unit/user_v1_spec.rb +8 -8
- data/spec/unit/util/dsc/configuration_generator_spec.rb +12 -12
- data/spec/unit/util/dsc/local_configuration_manager_spec.rb +12 -9
- data/spec/unit/util/dsc/resource_store.rb +8 -6
- data/spec/unit/util/editor_spec.rb +6 -6
- data/spec/unit/util/powershell/cmdlet_spec.rb +10 -10
- data/tasks/bin/bundle-platform +1 -0
- data/tasks/bin/bundler_patch.rb +27 -0
- data/tasks/cbgb.rb +2 -2
- data/tasks/maintainers.rb +2 -2
- metadata +37 -8
- data/spec/unit/provider/user/useradd_spec.rb +0 -51
@@ -20,13 +20,13 @@ require "spec_helper"
|
|
20
20
|
|
21
21
|
describe Chef::Provider::Template::Content do
|
22
22
|
|
23
|
-
let(:enclosing_directory)
|
23
|
+
let(:enclosing_directory) do
|
24
24
|
canonicalize_path(Dir.mktmpdir)
|
25
|
-
|
25
|
+
end
|
26
26
|
|
27
|
-
let(:resource_path)
|
27
|
+
let(:resource_path) do
|
28
28
|
canonicalize_path(File.expand_path(File.join(enclosing_directory, "openldap_stuff.conf")))
|
29
|
-
|
29
|
+
end
|
30
30
|
|
31
31
|
let(:new_resource) do
|
32
32
|
double("Chef::Resource::Template (new)",
|
@@ -46,10 +46,10 @@ describe Chef::Provider::Template::Content do
|
|
46
46
|
:helper_modules => [])
|
47
47
|
end
|
48
48
|
|
49
|
-
let(:rendered_file_locations)
|
49
|
+
let(:rendered_file_locations) do
|
50
50
|
[Dir.tmpdir + "/openldap_stuff.conf",
|
51
51
|
enclosing_directory + "/openldap_stuff.conf"]
|
52
|
-
|
52
|
+
end
|
53
53
|
|
54
54
|
let(:run_context) do
|
55
55
|
cookbook_repo = File.expand_path(File.join(CHEF_SPEC_DATA, "cookbooks"))
|
@@ -101,9 +101,9 @@ describe Chef::Provider::Template::Content do
|
|
101
101
|
end
|
102
102
|
|
103
103
|
context "when creating a tempfile in destdir fails" do
|
104
|
-
let(:enclosing_directory)
|
104
|
+
let(:enclosing_directory) do
|
105
105
|
canonicalize_path("/nonexisting/path")
|
106
|
-
|
106
|
+
end
|
107
107
|
|
108
108
|
it "returns a tempfile in the tempdir when :file_deployment_uses_destdir is set to :auto" do
|
109
109
|
Chef::Config[:file_staging_uses_destdir] = :auto
|
@@ -27,12 +27,12 @@ describe Chef::Provider::Template do
|
|
27
27
|
let(:node) { double("Chef::Node") }
|
28
28
|
let(:events) { double("Chef::Events").as_null_object } # mock all the methods
|
29
29
|
let(:run_context) { double("Chef::RunContext", :node => node, :events => events) }
|
30
|
-
let(:enclosing_directory)
|
30
|
+
let(:enclosing_directory) do
|
31
31
|
canonicalize_path(File.expand_path(File.join(CHEF_SPEC_DATA, "templates")))
|
32
|
-
|
33
|
-
let(:resource_path)
|
32
|
+
end
|
33
|
+
let(:resource_path) do
|
34
34
|
canonicalize_path(File.expand_path(File.join(enclosing_directory, "seattle.txt")))
|
35
|
-
|
35
|
+
end
|
36
36
|
|
37
37
|
# Subject
|
38
38
|
|
@@ -61,12 +61,12 @@ describe Chef::Provider::Template do
|
|
61
61
|
let(:node) { double("Chef::Node") }
|
62
62
|
let(:events) { double("Chef::Events").as_null_object } # mock all the methods
|
63
63
|
let(:run_context) { double("Chef::RunContext", :node => node, :events => events) }
|
64
|
-
let(:enclosing_directory)
|
64
|
+
let(:enclosing_directory) do
|
65
65
|
canonicalize_path(File.expand_path(File.join(CHEF_SPEC_DATA, "templates")))
|
66
|
-
|
67
|
-
let(:resource_path)
|
66
|
+
end
|
67
|
+
let(:resource_path) do
|
68
68
|
canonicalize_path(File.expand_path(File.join(enclosing_directory, "seattle.txt")))
|
69
|
-
|
69
|
+
end
|
70
70
|
|
71
71
|
# Subject
|
72
72
|
|
@@ -24,52 +24,52 @@ describe Chef::Provider::User::Dscl do
|
|
24
24
|
before do
|
25
25
|
allow(ChefConfig).to receive(:windows?) { false }
|
26
26
|
end
|
27
|
-
let(:shellcmdresult)
|
27
|
+
let(:shellcmdresult) do
|
28
28
|
Struct.new(:stdout, :stderr, :exitstatus)
|
29
|
-
|
30
|
-
let(:node)
|
29
|
+
end
|
30
|
+
let(:node) do
|
31
31
|
node = Chef::Node.new
|
32
32
|
allow(node).to receive(:[]).with(:platform_version).and_return(mac_version)
|
33
33
|
allow(node).to receive(:[]).with(:platform).and_return("mac_os_x")
|
34
34
|
node
|
35
|
-
|
35
|
+
end
|
36
36
|
|
37
|
-
let(:events)
|
37
|
+
let(:events) do
|
38
38
|
Chef::EventDispatch::Dispatcher.new
|
39
|
-
|
39
|
+
end
|
40
40
|
|
41
|
-
let(:run_context)
|
41
|
+
let(:run_context) do
|
42
42
|
Chef::RunContext.new(node, {}, events)
|
43
|
-
|
43
|
+
end
|
44
44
|
|
45
|
-
let(:new_resource)
|
46
|
-
r = Chef::Resource::User.new("toor")
|
45
|
+
let(:new_resource) do
|
46
|
+
r = Chef::Resource::User::DsclUser.new("toor")
|
47
47
|
r.password(password)
|
48
48
|
r.salt(salt)
|
49
49
|
r.iterations(iterations)
|
50
50
|
r
|
51
|
-
|
51
|
+
end
|
52
52
|
|
53
|
-
let(:provider)
|
53
|
+
let(:provider) do
|
54
54
|
Chef::Provider::User::Dscl.new(new_resource, run_context)
|
55
|
-
|
55
|
+
end
|
56
56
|
|
57
|
-
let(:mac_version)
|
57
|
+
let(:mac_version) do
|
58
58
|
"10.9.1"
|
59
|
-
|
59
|
+
end
|
60
60
|
|
61
61
|
let(:password) { nil }
|
62
62
|
let(:salt) { nil }
|
63
63
|
let(:iterations) { nil }
|
64
64
|
|
65
|
-
let(:salted_sha512_password)
|
65
|
+
let(:salted_sha512_password) do
|
66
66
|
"0f543f021c63255e64e121a3585601b8ecfedf6d2\
|
67
67
|
705ddac69e682a33db5dbcdb9b56a2520bc8fff63a\
|
68
68
|
2ba6b7984c0737ff0b7949455071581f7affcd536d\
|
69
69
|
402b6cdb097"
|
70
|
-
|
70
|
+
end
|
71
71
|
|
72
|
-
let(:salted_sha512_pbkdf2_password)
|
72
|
+
let(:salted_sha512_pbkdf2_password) do
|
73
73
|
"c734b6e4787c3727bb35e29fdd92b97c\
|
74
74
|
1de12df509577a045728255ec7c6c5f5\
|
75
75
|
c18efa05ed02b682ffa7ebc05119900e\
|
@@ -78,24 +78,24 @@ b1d4880833aa7a190afc13e2bf0936b8\
|
|
78
78
|
9464a8c234f3919082400b4f939bb77b\
|
79
79
|
c5adbbac718b7eb99463a7b679571e0f\
|
80
80
|
1c9fef2ef08d0b9e9c2bcf644eed2ffc"
|
81
|
-
|
81
|
+
end
|
82
82
|
|
83
|
-
let(:salted_sha512_pbkdf2_salt)
|
83
|
+
let(:salted_sha512_pbkdf2_salt) do
|
84
84
|
"2d942d8364a9ccf2b8e5cb7ed1ff58f78\
|
85
85
|
e29dbfee7f9db58859144d061fd0058"
|
86
|
-
|
86
|
+
end
|
87
87
|
|
88
|
-
let(:salted_sha512_pbkdf2_iterations)
|
88
|
+
let(:salted_sha512_pbkdf2_iterations) do
|
89
89
|
25000
|
90
|
-
|
90
|
+
end
|
91
91
|
|
92
|
-
let(:vagrant_sha_512)
|
92
|
+
let(:vagrant_sha_512) do
|
93
93
|
"6f75d7190441facc34291ebbea1fc756b242d4f\
|
94
94
|
e9bcff141bccb84f1979e27e539539aa31f9f7dcc92c0cea959\
|
95
95
|
ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30"
|
96
|
-
|
96
|
+
end
|
97
97
|
|
98
|
-
let(:vagrant_sha_512_pbkdf2)
|
98
|
+
let(:vagrant_sha_512_pbkdf2) do
|
99
99
|
"12601a90db17cbf\
|
100
100
|
8ba4808e6382fb0d3b9d8a6c1a190477bf680ab21afb\
|
101
101
|
6065467136e55cc208a6f74156e3daf20fb13369ef4b\
|
@@ -103,15 +103,15 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30"
|
|
103
103
|
47cca84341a7f93a27147343f89fb843fb46c0017d2\
|
104
104
|
64afa4976baacf941b915bd1ec1ca24c30b3e759e02\
|
105
105
|
403e02f59fe7ff5938a7636c"
|
106
|
-
|
106
|
+
end
|
107
107
|
|
108
|
-
let(:vagrant_sha_512_pbkdf2_salt)
|
108
|
+
let(:vagrant_sha_512_pbkdf2_salt) do
|
109
109
|
"ee954be472fdc60ddf89484781433993625f006af6ec810c08f49a7e413946a1"
|
110
|
-
|
110
|
+
end
|
111
111
|
|
112
|
-
let(:vagrant_sha_512_pbkdf2_iterations)
|
112
|
+
let(:vagrant_sha_512_pbkdf2_iterations) do
|
113
113
|
34482
|
114
|
-
|
114
|
+
end
|
115
115
|
|
116
116
|
describe "when shelling out to dscl" do
|
117
117
|
it "should run dscl with the supplied cmd /Path args" do
|
@@ -214,9 +214,9 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30"
|
|
214
214
|
end
|
215
215
|
|
216
216
|
describe "when modifying the home directory" do
|
217
|
-
let(:current_resource)
|
217
|
+
let(:current_resource) do
|
218
218
|
new_resource.dup
|
219
|
-
|
219
|
+
end
|
220
220
|
|
221
221
|
before do
|
222
222
|
new_resource.supports({ :manage_home => true })
|
@@ -307,9 +307,9 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30"
|
|
307
307
|
end
|
308
308
|
|
309
309
|
describe "when on Mac 10.6" do
|
310
|
-
let(:mac_version)
|
310
|
+
let(:mac_version) do
|
311
311
|
"10.6.5"
|
312
|
-
|
312
|
+
end
|
313
313
|
|
314
314
|
it "should raise an error" do
|
315
315
|
expect { run_requirements }.to raise_error(Chef::Exceptions::User)
|
@@ -317,9 +317,9 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30"
|
|
317
317
|
end
|
318
318
|
|
319
319
|
describe "when on Mac 10.7" do
|
320
|
-
let(:mac_version)
|
320
|
+
let(:mac_version) do
|
321
321
|
"10.7.5"
|
322
|
-
|
322
|
+
end
|
323
323
|
|
324
324
|
describe "when password is SALTED-SHA512" do
|
325
325
|
let(:password) { salted_sha512_password }
|
@@ -340,9 +340,9 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30"
|
|
340
340
|
|
341
341
|
[ "10.9", "10.10"].each do |version|
|
342
342
|
describe "when on Mac #{version}" do
|
343
|
-
let(:mac_version)
|
343
|
+
let(:mac_version) do
|
344
344
|
"#{version}.2"
|
345
|
-
|
345
|
+
end
|
346
346
|
|
347
347
|
describe "when password is SALTED-SHA512" do
|
348
348
|
let(:password) { salted_sha512_password }
|
@@ -413,9 +413,9 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30"
|
|
413
413
|
let(:password) { "something" } # Load password during load_current_resource
|
414
414
|
|
415
415
|
describe "on 10.7" do
|
416
|
-
let(:mac_version)
|
416
|
+
let(:mac_version) do
|
417
417
|
"10.7.5"
|
418
|
-
|
418
|
+
end
|
419
419
|
|
420
420
|
let(:user_plist_file) { "10.7" }
|
421
421
|
|
@@ -478,9 +478,9 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30"
|
|
478
478
|
end
|
479
479
|
|
480
480
|
describe "on 10.8" do
|
481
|
-
let(:mac_version)
|
481
|
+
let(:mac_version) do
|
482
482
|
"10.8.3"
|
483
|
-
|
483
|
+
end
|
484
484
|
|
485
485
|
let(:user_plist_file) { "10.8" }
|
486
486
|
|
@@ -504,9 +504,9 @@ e68d1f9821b26689312366")
|
|
504
504
|
|
505
505
|
describe "on 10.7 upgraded to 10.8" do
|
506
506
|
# In this scenario user password is still in 10.7 format
|
507
|
-
let(:mac_version)
|
507
|
+
let(:mac_version) do
|
508
508
|
"10.8.3"
|
509
|
-
|
509
|
+
end
|
510
510
|
|
511
511
|
let(:user_plist_file) { "10.7-8" }
|
512
512
|
|
@@ -542,9 +542,9 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30")
|
|
542
542
|
end
|
543
543
|
|
544
544
|
describe "on 10.9" do
|
545
|
-
let(:mac_version)
|
545
|
+
let(:mac_version) do
|
546
546
|
"10.9.1"
|
547
|
-
|
547
|
+
end
|
548
548
|
|
549
549
|
let(:user_plist_file) { "10.9" }
|
550
550
|
|
@@ -646,9 +646,9 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30")
|
|
646
646
|
|
647
647
|
describe "prepare_password_shadow_info" do
|
648
648
|
describe "when on Mac 10.7" do
|
649
|
-
let(:mac_version)
|
649
|
+
let(:mac_version) do
|
650
650
|
"10.7.1"
|
651
|
-
|
651
|
+
end
|
652
652
|
|
653
653
|
describe "when the password is plain text" do
|
654
654
|
let(:password) { "vagrant" }
|
@@ -676,9 +676,9 @@ ea18e18b720e358e7fbe3cfbeaa561456f6ba008937a30")
|
|
676
676
|
|
677
677
|
["10.8", "10.9", "10.10"].each do |version|
|
678
678
|
describe "when on Mac #{version}" do
|
679
|
-
let(:mac_version)
|
679
|
+
let(:mac_version) do
|
680
680
|
"#{version}.1"
|
681
|
-
|
681
|
+
end
|
682
682
|
|
683
683
|
describe "when the password is plain text" do
|
684
684
|
let(:password) { "vagrant" }
|
@@ -0,0 +1,76 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Adam Jacob (<adam@chef.io>)
|
3
|
+
# Author:: Daniel DeLeo (<dan@chef.io>)
|
4
|
+
# Copyright:: Copyright 2008-2016, Chef Software Inc.
|
5
|
+
#
|
6
|
+
# License:: Apache License, Version 2.0
|
7
|
+
#
|
8
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
9
|
+
# you may not use this file except in compliance with the License.
|
10
|
+
# You may obtain a copy of the License at
|
11
|
+
#
|
12
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
13
|
+
#
|
14
|
+
# Unless required by applicable law or agreed to in writing, software
|
15
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
16
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
17
|
+
# See the License for the specific language governing permissions and
|
18
|
+
# limitations under the License.
|
19
|
+
#
|
20
|
+
|
21
|
+
require "spec_helper"
|
22
|
+
require "chef/provider/user/useradd"
|
23
|
+
|
24
|
+
describe Chef::Provider::User::Linux do
|
25
|
+
|
26
|
+
subject(:provider) do
|
27
|
+
p = described_class.new(@new_resource, @run_context)
|
28
|
+
p.current_resource = @current_resource
|
29
|
+
p
|
30
|
+
end
|
31
|
+
|
32
|
+
supported_useradd_options = {
|
33
|
+
"comment" => "-c",
|
34
|
+
"gid" => "-g",
|
35
|
+
"uid" => "-u",
|
36
|
+
"shell" => "-s",
|
37
|
+
"password" => "-p",
|
38
|
+
}
|
39
|
+
|
40
|
+
include_examples "a useradd-based user provider", supported_useradd_options
|
41
|
+
|
42
|
+
describe "manage_home behavior" do
|
43
|
+
before(:each) do
|
44
|
+
@new_resource = Chef::Resource::User::LinuxUser.new("adam", @run_context)
|
45
|
+
@current_resource = Chef::Resource::User::LinuxUser.new("adam", @run_context)
|
46
|
+
end
|
47
|
+
|
48
|
+
it "sets supports manage_home to true" do
|
49
|
+
Chef::Config[:treat_deprecation_warnings_as_errors] = false
|
50
|
+
expect( @new_resource.supports[:manage_home] ).to be true
|
51
|
+
end
|
52
|
+
|
53
|
+
it "sets supports non-unique to true" do
|
54
|
+
Chef::Config[:treat_deprecation_warnings_as_errors] = false
|
55
|
+
expect( @new_resource.supports[:non_unique] ).to be true
|
56
|
+
end
|
57
|
+
|
58
|
+
it "defaults manage_home to true" do
|
59
|
+
expect( @new_resource.manage_home ).to be false
|
60
|
+
end
|
61
|
+
|
62
|
+
it "by default manage_home is false and we use -M" do
|
63
|
+
expect( provider.useradd_options ).to eql(["-M"])
|
64
|
+
end
|
65
|
+
|
66
|
+
it "setting manage_home to false includes -M" do
|
67
|
+
@new_resource.manage_home false
|
68
|
+
expect( provider.useradd_options ).to eql(["-M"])
|
69
|
+
end
|
70
|
+
|
71
|
+
it "setting manage_home to true includes -m" do
|
72
|
+
@new_resource.manage_home true
|
73
|
+
expect( provider.useradd_options ).to eql(["-m"])
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -24,7 +24,7 @@ describe Chef::Provider::User::Pw do
|
|
24
24
|
@events = Chef::EventDispatch::Dispatcher.new
|
25
25
|
@run_context = Chef::RunContext.new(@node, {}, @events)
|
26
26
|
|
27
|
-
@new_resource = Chef::Resource::User.new("adam")
|
27
|
+
@new_resource = Chef::Resource::User::PwUser.new("adam")
|
28
28
|
@new_resource.comment "Adam Jacob"
|
29
29
|
@new_resource.uid 1000
|
30
30
|
@new_resource.gid 1000
|
@@ -34,7 +34,7 @@ describe Chef::Provider::User::Pw do
|
|
34
34
|
|
35
35
|
@new_resource.supports :manage_home => true
|
36
36
|
|
37
|
-
@current_resource = Chef::Resource::User.new("adam")
|
37
|
+
@current_resource = Chef::Resource::User::PwUser.new("adam")
|
38
38
|
@current_resource.comment "Adam Jacob"
|
39
39
|
@current_resource.uid 1000
|
40
40
|
@current_resource.gid 1000
|
@@ -170,7 +170,6 @@ describe Chef::Provider::User::Pw do
|
|
170
170
|
end
|
171
171
|
|
172
172
|
it "logs an appropriate message" do
|
173
|
-
expect(Chef::Log).to receive(:debug).with("user[adam] no change needed to password")
|
174
173
|
@provider.modify_password
|
175
174
|
end
|
176
175
|
end
|
@@ -194,7 +193,6 @@ describe Chef::Provider::User::Pw do
|
|
194
193
|
end
|
195
194
|
|
196
195
|
it "logs an appropriate message" do
|
197
|
-
expect(Chef::Log).to receive(:debug).with("user[adam] no change needed to password")
|
198
196
|
@provider.modify_password
|
199
197
|
end
|
200
198
|
end
|
@@ -206,7 +204,6 @@ describe Chef::Provider::User::Pw do
|
|
206
204
|
end
|
207
205
|
|
208
206
|
it "should log an appropriate message" do
|
209
|
-
expect(Chef::Log).to receive(:debug).with("user[adam] updating password")
|
210
207
|
@provider.modify_password
|
211
208
|
end
|
212
209
|
|
@@ -236,7 +233,7 @@ describe Chef::Provider::User::Pw do
|
|
236
233
|
|
237
234
|
describe "when loading the current state" do
|
238
235
|
before do
|
239
|
-
@provider.new_resource = Chef::Resource::User.new("adam")
|
236
|
+
@provider.new_resource = Chef::Resource::User::PwUser.new("adam")
|
240
237
|
end
|
241
238
|
|
242
239
|
it "should raise an error if the required binary /usr/sbin/pw doesn't exist" do
|
@@ -25,9 +25,9 @@ require "spec_helper"
|
|
25
25
|
|
26
26
|
describe Chef::Provider::User::Solaris do
|
27
27
|
|
28
|
-
let(:shellcmdresult)
|
28
|
+
let(:shellcmdresult) do
|
29
29
|
Struct.new(:stdout, :stderr, :exitstatus)
|
30
|
-
|
30
|
+
end
|
31
31
|
|
32
32
|
subject(:provider) do
|
33
33
|
p = described_class.new(@new_resource, @run_context)
|
@@ -44,8 +44,8 @@ describe Chef::Provider::User::Solaris do
|
|
44
44
|
@events = Chef::EventDispatch::Dispatcher.new
|
45
45
|
@run_context = Chef::RunContext.new(@node, {}, @events)
|
46
46
|
|
47
|
-
@new_resource = Chef::Resource::User.new("adam", @run_context)
|
48
|
-
@current_resource = Chef::Resource::User.new("adam", @run_context)
|
47
|
+
@new_resource = Chef::Resource::User::SolarisUser.new("adam", @run_context)
|
48
|
+
@current_resource = Chef::Resource::User::SolarisUser.new("adam", @run_context)
|
49
49
|
|
50
50
|
@new_resource.password "hocus-pocus"
|
51
51
|
|
@@ -81,7 +81,7 @@ describe Chef::Provider::User::Solaris do
|
|
81
81
|
@events = Chef::EventDispatch::Dispatcher.new
|
82
82
|
@run_context = Chef::RunContext.new(@node, {}, @events)
|
83
83
|
|
84
|
-
@new_resource = Chef::Resource::User.new("dave")
|
84
|
+
@new_resource = Chef::Resource::User::SolarisUser.new("dave")
|
85
85
|
@current_resource = @new_resource.dup
|
86
86
|
|
87
87
|
@provider = Chef::Provider::User::Solaris.new(@new_resource, @run_context)
|