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
@@ -81,7 +81,7 @@ shared_context "use Windows permissions", :windows_only do
|
|
81
81
|
SID ||= Chef::ReservedNames::Win32::Security::SID
|
82
82
|
ACE ||= Chef::ReservedNames::Win32::Security::ACE
|
83
83
|
ACL ||= Chef::ReservedNames::Win32::Security::ACL
|
84
|
-
SecurableObject ||= Chef::ReservedNames::Win32::Security::SecurableObject
|
84
|
+
SecurableObject ||= Chef::ReservedNames::Win32::Security::SecurableObject # rubocop:disable Style/ConstantName
|
85
85
|
end
|
86
86
|
|
87
87
|
def get_security_descriptor(path)
|
@@ -138,9 +138,9 @@ shared_context "use Windows permissions", :windows_only do
|
|
138
138
|
|
139
139
|
RSpec::Matchers.define :have_expected_properties do |mask, type, flags|
|
140
140
|
match do |ace|
|
141
|
-
ace.mask == mask
|
142
|
-
|
143
|
-
|
141
|
+
ace.mask == mask &&
|
142
|
+
ace.type == type &&
|
143
|
+
ace.flags == flags
|
144
144
|
end
|
145
145
|
end
|
146
146
|
|
@@ -439,7 +439,7 @@ shared_examples_for "a securable resource without existing target" do
|
|
439
439
|
|
440
440
|
context "with a mode attribute" do
|
441
441
|
if windows?
|
442
|
-
Security ||= Chef::ReservedNames::Win32::API::Security
|
442
|
+
Security ||= Chef::ReservedNames::Win32::API::Security # rubocop:disable Style/ConstantName
|
443
443
|
end
|
444
444
|
|
445
445
|
it "respects mode in string form as an octal number" do
|
@@ -23,9 +23,7 @@ shared_context "using Win32::Service" do
|
|
23
23
|
# We can only uninstall when the service is stopped.
|
24
24
|
if test_service_state != "stopped"
|
25
25
|
::Win32::Service.send("stop", "spec-service")
|
26
|
-
while test_service_state != "stopped"
|
27
|
-
sleep 1
|
28
|
-
end
|
26
|
+
sleep 1 while test_service_state != "stopped"
|
29
27
|
end
|
30
28
|
|
31
29
|
::Win32::Service.delete("spec-service")
|
@@ -39,7 +37,7 @@ shared_context "using Win32::Service" do
|
|
39
37
|
|
40
38
|
# Definition for the test-service
|
41
39
|
|
42
|
-
let(:test_service)
|
40
|
+
let(:test_service) do
|
43
41
|
{
|
44
42
|
:service_name => "spec-service",
|
45
43
|
:service_display_name => "Spec Test Service",
|
@@ -47,13 +45,13 @@ shared_context "using Win32::Service" do
|
|
47
45
|
:service_file_path => File.expand_path(File.join(File.dirname(__FILE__), "../../platforms/win32/spec_service.rb")),
|
48
46
|
:delayed_start => true,
|
49
47
|
}
|
50
|
-
|
48
|
+
end
|
51
49
|
|
52
50
|
# Test service creates a file for us to verify that it is running.
|
53
51
|
# Since our test service is running as Local System we should look
|
54
52
|
# for the file it creates under SYSTEM temp directory
|
55
53
|
|
56
|
-
let(:test_service_file)
|
54
|
+
let(:test_service_file) do
|
57
55
|
"#{ENV['SystemDrive']}\\windows\\temp\\spec_service_file"
|
58
|
-
|
56
|
+
end
|
59
57
|
end
|
@@ -3,9 +3,9 @@
|
|
3
3
|
# Any object which defines a .to_json should import this test
|
4
4
|
shared_examples "to_json equivalent to Chef::JSONCompat.to_json" do
|
5
5
|
|
6
|
-
let(:jsonable)
|
6
|
+
let(:jsonable) do
|
7
7
|
raise "You must define the subject when including this test"
|
8
|
-
|
8
|
+
end
|
9
9
|
|
10
10
|
it "should allow consumers to call #to_json or Chef::JSONCompat.to_json" do
|
11
11
|
expect(jsonable.to_json).to eq(Chef::JSONCompat.to_json(jsonable))
|
@@ -43,13 +43,13 @@ shared_examples_for "user and client reregister" do
|
|
43
43
|
let(:generic_exception) { Exception.new }
|
44
44
|
let(:min_version) { "2" }
|
45
45
|
let(:max_version) { "5" }
|
46
|
-
let(:return_hash_406)
|
46
|
+
let(:return_hash_406) do
|
47
47
|
{
|
48
48
|
"min_version" => min_version,
|
49
49
|
"max_version" => max_version,
|
50
50
|
"request_version" => "30",
|
51
51
|
}
|
52
|
-
|
52
|
+
end
|
53
53
|
|
54
54
|
context "when V0 is not supported by the server" do
|
55
55
|
context "when the exception is 406 and returns x-ops-server-api-version header" do
|
@@ -31,8 +31,9 @@ shared_examples_for "an application that loads a dot d" do
|
|
31
31
|
context "when client_d_dir is set to a directory with configuration" do
|
32
32
|
# We're not going to mock out globbing the directory. We want to
|
33
33
|
# make sure that we are correctly globbing.
|
34
|
-
let(:client_d_dir)
|
35
|
-
|
34
|
+
let(:client_d_dir) do
|
35
|
+
Chef::Util::PathHelper.cleanpath(
|
36
|
+
File.join(File.dirname(__FILE__), "../../../data/client.d_00")) end
|
36
37
|
|
37
38
|
it "loads the configuration in order" do
|
38
39
|
expect(IO).to receive(:read).with(Pathname.new("#{client_d_dir}/00-foo.rb").cleanpath.to_s).and_return("foo 0")
|
@@ -45,8 +46,9 @@ shared_examples_for "an application that loads a dot d" do
|
|
45
46
|
end
|
46
47
|
|
47
48
|
context "when client_d_dir is set to a directory without configuration" do
|
48
|
-
let(:client_d_dir)
|
49
|
-
|
49
|
+
let(:client_d_dir) do
|
50
|
+
Chef::Util::PathHelper.cleanpath(
|
51
|
+
File.join(File.dirname(__FILE__), "../../data/client.d_01")) end
|
50
52
|
|
51
53
|
# client.d_01 has a nested folder with a rb file that if
|
52
54
|
# executed, would raise an exception. If it is executed,
|
@@ -60,8 +62,9 @@ shared_examples_for "an application that loads a dot d" do
|
|
60
62
|
|
61
63
|
context "when client_d_dir is set to a directory containing a directory named foo.rb" do
|
62
64
|
# foo.rb as a directory should be ignored
|
63
|
-
let(:client_d_dir)
|
64
|
-
|
65
|
+
let(:client_d_dir) do
|
66
|
+
Chef::Util::PathHelper.cleanpath(
|
67
|
+
File.join(File.dirname(__FILE__), "../../data/client.d_02")) end
|
65
68
|
|
66
69
|
it "does not raise an exception" do
|
67
70
|
expect { app.reconfigure }.not_to raise_error
|
@@ -459,11 +459,11 @@ shared_examples_for Chef::Provider::File do
|
|
459
459
|
context "do_validate_content" do
|
460
460
|
before { setup_normal_file }
|
461
461
|
|
462
|
-
let(:tempfile)
|
462
|
+
let(:tempfile) do
|
463
463
|
t = double("Tempfile", :path => "/tmp/foo-bar-baz", :closed? => true)
|
464
464
|
allow(content).to receive(:tempfile).and_return(t)
|
465
465
|
t
|
466
|
-
|
466
|
+
end
|
467
467
|
|
468
468
|
context "with user-supplied verifications" do
|
469
469
|
it "calls #verify on each verification with tempfile path" do
|
@@ -18,13 +18,18 @@
|
|
18
18
|
# limitations under the License.
|
19
19
|
#
|
20
20
|
|
21
|
+
# XXX: this used to be shared by solaris and linux classes, but at some
|
22
|
+
# point became linux-specific. it is now a misnomer to call these 'shared'
|
23
|
+
# examples and they should either realy get turned into shared examples or
|
24
|
+
# should be copypasta'd back directly into the linux tests.
|
25
|
+
|
21
26
|
shared_examples_for "a useradd-based user provider" do |supported_useradd_options|
|
22
27
|
before(:each) do
|
23
28
|
@node = Chef::Node.new
|
24
29
|
@events = Chef::EventDispatch::Dispatcher.new
|
25
30
|
@run_context = Chef::RunContext.new(@node, {}, @events)
|
26
31
|
|
27
|
-
@new_resource = Chef::Resource::User.new("adam", @run_context)
|
32
|
+
@new_resource = Chef::Resource::User::LinuxUser.new("adam", @run_context)
|
28
33
|
@new_resource.comment "Adam Jacob"
|
29
34
|
@new_resource.uid 1000
|
30
35
|
@new_resource.gid 1000
|
@@ -35,7 +40,7 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
|
|
35
40
|
@new_resource.manage_home false
|
36
41
|
@new_resource.force false
|
37
42
|
@new_resource.non_unique false
|
38
|
-
@current_resource = Chef::Resource::User.new("adam", @run_context)
|
43
|
+
@current_resource = Chef::Resource::User::LinuxUser.new("adam", @run_context)
|
39
44
|
@current_resource.comment "Adam Jacob"
|
40
45
|
@current_resource.uid 1000
|
41
46
|
@current_resource.gid 1000
|
@@ -46,7 +51,6 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
|
|
46
51
|
@current_resource.manage_home false
|
47
52
|
@current_resource.force false
|
48
53
|
@current_resource.non_unique false
|
49
|
-
@current_resource.supports({ :manage_home => false, :non_unique => false })
|
50
54
|
end
|
51
55
|
|
52
56
|
describe "when setting option" do
|
@@ -96,62 +100,49 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
|
|
96
100
|
|
97
101
|
it "should set useradd -r" do
|
98
102
|
@new_resource.system(true)
|
99
|
-
expect(provider.useradd_options).to eq([ "-r" ])
|
103
|
+
expect(provider.useradd_options).to eq([ "-r", "-m" ])
|
100
104
|
end
|
101
105
|
end
|
102
106
|
|
103
107
|
describe "when the resource has a different home directory and supports home directory management" do
|
104
108
|
before do
|
105
|
-
|
106
|
-
|
107
|
-
:non_unique => false })
|
109
|
+
@new_resource.home "/wowaweea"
|
110
|
+
@new_resource.manage_home true
|
108
111
|
end
|
109
112
|
|
110
113
|
it "should set -m -d /homedir" do
|
111
|
-
expect(provider.universal_options).to eq(%w{-d /wowaweea
|
112
|
-
expect(provider.
|
114
|
+
expect(provider.universal_options).to eq(%w{-d /wowaweea})
|
115
|
+
expect(provider.usermod_options).to eq(%w{-m})
|
113
116
|
end
|
114
117
|
end
|
115
118
|
|
116
119
|
describe "when the resource has a different home directory and supports home directory management (using real attributes)" do
|
117
120
|
before do
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
+
@new_resource.home("/wowaweea")
|
122
|
+
@new_resource.manage_home true
|
123
|
+
@new_resource.non_unique false
|
121
124
|
end
|
122
125
|
|
123
126
|
it "should set -m -d /homedir" do
|
124
|
-
expect(provider.universal_options).to
|
125
|
-
expect(provider.
|
127
|
+
expect(provider.universal_options).to eq(%w{-d /wowaweea})
|
128
|
+
expect(provider.usermod_options).to eq(%w{-m})
|
126
129
|
end
|
127
130
|
end
|
128
131
|
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
:non_unique => true })
|
133
|
-
end
|
134
|
-
|
135
|
-
it "should set -m -o" do
|
136
|
-
expect(provider.universal_options).to eql([ "-o" ])
|
137
|
-
end
|
132
|
+
it "when non_unique is false should not set -m" do
|
133
|
+
@new_resource.non_unique false
|
134
|
+
expect(provider.universal_options).to eql([ ])
|
138
135
|
end
|
139
136
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
allow(@new_resource).to receive(:non_unique).and_return(true)
|
144
|
-
end
|
145
|
-
|
146
|
-
it "should set -m -o" do
|
147
|
-
expect(provider.universal_options).to eql([ "-o" ])
|
148
|
-
end
|
137
|
+
it "when non_unique is true should set -o" do
|
138
|
+
@new_resource.non_unique true
|
139
|
+
expect(provider.universal_options).to eql([ "-o" ])
|
149
140
|
end
|
150
141
|
end
|
151
142
|
|
152
143
|
describe "when creating a user" do
|
153
144
|
before(:each) do
|
154
|
-
@current_resource = Chef::Resource::User.new(@new_resource.name, @run_context)
|
145
|
+
@current_resource = Chef::Resource::User::LinuxUser.new(@new_resource.name, @run_context)
|
155
146
|
@current_resource.username(@new_resource.username)
|
156
147
|
provider.current_resource = @current_resource
|
157
148
|
provider.new_resource.manage_home true
|
@@ -188,7 +179,7 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
|
|
188
179
|
command.concat(["-p", "abracadabra"]) if supported_useradd_options.key?("password")
|
189
180
|
command.concat([ "-s", "/usr/bin/zsh",
|
190
181
|
"-u", "1000",
|
191
|
-
"-r",
|
182
|
+
"-r", "-m",
|
192
183
|
"adam" ])
|
193
184
|
expect(provider).to receive(:shell_out!).with(*command).and_return(true)
|
194
185
|
provider.create_user
|
@@ -229,7 +220,7 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
|
|
229
220
|
end
|
230
221
|
|
231
222
|
it "CHEF-3429: does not set -m if we aren't changing the home directory" do
|
232
|
-
expect(provider).to receive(:updating_home?).and_return(false)
|
223
|
+
expect(provider).to receive(:updating_home?).at_least(:once).and_return(false)
|
233
224
|
command = ["usermod",
|
234
225
|
"-g", "23",
|
235
226
|
"adam" ]
|
@@ -246,15 +237,12 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
|
|
246
237
|
end
|
247
238
|
|
248
239
|
it "should run userdel with the new resources user name and -r if manage_home is true" do
|
249
|
-
@new_resource.
|
250
|
-
:non_unique => false })
|
240
|
+
@new_resource.manage_home true
|
251
241
|
expect(provider).to receive(:shell_out!).with("userdel", "-r", @new_resource.username).and_return(true)
|
252
242
|
provider.remove_user
|
253
243
|
end
|
254
244
|
|
255
245
|
it "should run userdel with the new resources user name if non_unique is true" do
|
256
|
-
@new_resource.supports({ :manage_home => false,
|
257
|
-
:non_unique => true })
|
258
246
|
expect(provider).to receive(:shell_out!).with("userdel", @new_resource.username).and_return(true)
|
259
247
|
provider.remove_user
|
260
248
|
end
|
@@ -269,7 +257,7 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
|
|
269
257
|
describe "when checking the lock" do
|
270
258
|
# lazy initialize so we can modify stdout and stderr strings
|
271
259
|
let(:passwd_s_status) do
|
272
|
-
double("Mixlib::ShellOut command", :exitstatus => 0, :stdout => @stdout, :stderr => @stderr)
|
260
|
+
double("Mixlib::ShellOut command", :exitstatus => 0, :stdout => @stdout, :stderr => @stderr, :error! => nil)
|
273
261
|
end
|
274
262
|
|
275
263
|
before(:each) do
|
@@ -284,7 +272,7 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
|
|
284
272
|
end
|
285
273
|
|
286
274
|
it "should return false if status begins with P" do
|
287
|
-
expect(provider).to receive(:shell_out
|
275
|
+
expect(provider).to receive(:shell_out).
|
288
276
|
with("passwd", "-S", @new_resource.username, { :returns => [0, 1] }).
|
289
277
|
and_return(passwd_s_status)
|
290
278
|
expect(provider.check_lock).to eql(false)
|
@@ -292,7 +280,7 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
|
|
292
280
|
|
293
281
|
it "should return false if status begins with N" do
|
294
282
|
@stdout = "root N"
|
295
|
-
expect(provider).to receive(:shell_out
|
283
|
+
expect(provider).to receive(:shell_out).
|
296
284
|
with("passwd", "-S", @new_resource.username, { :returns => [0, 1] }).
|
297
285
|
and_return(passwd_s_status)
|
298
286
|
expect(provider.check_lock).to eql(false)
|
@@ -300,57 +288,38 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
|
|
300
288
|
|
301
289
|
it "should return true if status begins with L" do
|
302
290
|
@stdout = "root L"
|
303
|
-
expect(provider).to receive(:shell_out
|
291
|
+
expect(provider).to receive(:shell_out).
|
304
292
|
with("passwd", "-S", @new_resource.username, { :returns => [0, 1] }).
|
305
293
|
and_return(passwd_s_status)
|
306
294
|
expect(provider.check_lock).to eql(true)
|
307
295
|
end
|
308
296
|
|
309
|
-
it "should raise a
|
310
|
-
|
311
|
-
expect(provider).to receive(:shell_out
|
297
|
+
it "should raise a ShellCommandFailed exception if passwd -S exits with something other than 0 or 1" do
|
298
|
+
expect(passwd_s_status).to receive(:error!).and_raise(Mixlib::ShellOut::ShellCommandFailed)
|
299
|
+
expect(provider).to receive(:shell_out).
|
312
300
|
with("passwd", "-S", @new_resource.username, { :returns => [0, 1] }).
|
313
301
|
and_return(passwd_s_status)
|
314
|
-
expect
|
315
|
-
expect { provider.check_lock }.to raise_error(Chef::Exceptions::User)
|
302
|
+
expect { provider.check_lock }.to raise_error(Mixlib::ShellOut::ShellCommandFailed)
|
316
303
|
end
|
317
304
|
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
rpm_status = double("Mixlib::ShellOut command", :exitstatus => 0, :stdout => "passwd-0.73-1\n", :stderr => "")
|
326
|
-
expect(provider).to receive(:shell_out!).with("rpm -q passwd").and_return(rpm_status)
|
327
|
-
expect { provider.check_lock }.not_to raise_error
|
328
|
-
end
|
329
|
-
|
330
|
-
it "should raise a Chef::Exceptions::User if passwd -S exits with 1 on #{os} and the passwd package is not version 0.73-1" do
|
331
|
-
@node.automatic_attrs[:platform] = os
|
332
|
-
expect(passwd_s_status).to receive(:exitstatus).and_return(1)
|
333
|
-
expect(provider).to receive(:shell_out!).
|
334
|
-
with("passwd", "-S", @new_resource.username, { :returns => [0, 1] }).
|
335
|
-
and_return(passwd_s_status)
|
336
|
-
rpm_status = double("Mixlib::ShellOut command", :exitstatus => 0, :stdout => "passwd-0.73-2\n", :stderr => "")
|
337
|
-
expect(provider).to receive(:shell_out!).with("rpm -q passwd").and_return(rpm_status)
|
338
|
-
expect { provider.check_lock }.to raise_error(Chef::Exceptions::User)
|
339
|
-
end
|
340
|
-
|
341
|
-
it "should raise a ShellCommandFailed exception if passwd -S exits with something other than 0 or 1 on #{os}" do
|
342
|
-
@node.automatic_attrs[:platform] = os
|
343
|
-
expect(provider).to receive(:shell_out!).and_raise(Mixlib::ShellOut::ShellCommandFailed)
|
344
|
-
expect { provider.check_lock }.to raise_error(Mixlib::ShellOut::ShellCommandFailed)
|
345
|
-
end
|
305
|
+
it "should raise an error if the output isn't parsable" do
|
306
|
+
expect(passwd_s_status).to receive(:stdout).and_return("")
|
307
|
+
expect(passwd_s_status).to receive(:stderr).and_return("")
|
308
|
+
expect(provider).to receive(:shell_out).
|
309
|
+
with("passwd", "-S", @new_resource.username, { :returns => [0, 1] }).
|
310
|
+
and_return(passwd_s_status)
|
311
|
+
expect { provider.check_lock }.to raise_error(Chef::Exceptions::User)
|
346
312
|
end
|
347
313
|
|
348
314
|
context "when in why run mode" do
|
349
315
|
before do
|
350
316
|
passwd_status = double("Mixlib::ShellOut command", :exitstatus => 0, :stdout => "", :stderr => "passwd: user 'chef-test' does not exist\n")
|
351
|
-
expect(provider).to receive(:shell_out
|
317
|
+
expect(provider).to receive(:shell_out).
|
352
318
|
with("passwd", "-S", @new_resource.username, { :returns => [0, 1] }).
|
353
319
|
and_return(passwd_status)
|
320
|
+
# ubuntu returns 252 on user-does-not-exist so will raise if #error! is called or if
|
321
|
+
# shell_out! is used
|
322
|
+
allow(passwd_status).to receive(:error!).and_raise(Mixlib::ShellOut::ShellCommandFailed)
|
354
323
|
Chef::Config[:why_run] = true
|
355
324
|
end
|
356
325
|
|
@@ -420,9 +389,9 @@ shared_examples_for "a useradd-based user provider" do |supported_useradd_option
|
|
420
389
|
end
|
421
390
|
end
|
422
391
|
it "should return true if the current home does not exist but a home is specified by the new resource" do
|
423
|
-
@new_resource = Chef::Resource::User.new("adam", @run_context)
|
424
|
-
@current_resource = Chef::Resource::User.new("adam", @run_context)
|
425
|
-
provider = Chef::Provider::User::
|
392
|
+
@new_resource = Chef::Resource::User::LinuxUser.new("adam", @run_context)
|
393
|
+
@current_resource = Chef::Resource::User::LinuxUser.new("adam", @run_context)
|
394
|
+
provider = Chef::Provider::User::Linux.new(@new_resource, @run_context)
|
426
395
|
provider.current_resource = @current_resource
|
427
396
|
@current_resource.home nil
|
428
397
|
@new_resource.home "/home/kitten"
|
@@ -33,13 +33,13 @@ def static_provider_resolution(opts = {})
|
|
33
33
|
platform_version = opts[:platform_version]
|
34
34
|
|
35
35
|
describe resource_class, "static provider initialization" do
|
36
|
-
let(:node)
|
36
|
+
let(:node) do
|
37
37
|
node = Chef::Node.new
|
38
38
|
node.automatic_attrs[:os] = os
|
39
39
|
node.automatic_attrs[:platform_family] = platform_family
|
40
40
|
node.automatic_attrs[:platform_version] = platform_version
|
41
41
|
node
|
42
|
-
|
42
|
+
end
|
43
43
|
let(:events) { Chef::EventDispatch::Dispatcher.new }
|
44
44
|
let(:run_context) { Chef::RunContext.new(node, {}, events) }
|
45
45
|
let(:resource) { resource_class.new("foo", run_context) }
|
@@ -57,18 +57,18 @@ shared_examples_for "a script resource" do
|
|
57
57
|
end
|
58
58
|
|
59
59
|
describe "when executing guards" do
|
60
|
-
let(:resource)
|
60
|
+
let(:resource) do
|
61
61
|
resource = script_resource
|
62
62
|
resource.run_context = run_context
|
63
63
|
resource.code "echo hi"
|
64
64
|
resource
|
65
|
-
|
66
|
-
let(:node)
|
65
|
+
end
|
66
|
+
let(:node) do
|
67
67
|
node = Chef::Node.new
|
68
68
|
node.automatic[:platform] = "debian"
|
69
69
|
node.automatic[:platform_version] = "6.0"
|
70
70
|
node
|
71
|
-
|
71
|
+
end
|
72
72
|
let(:events) { Chef::EventDispatch::Dispatcher.new }
|
73
73
|
let(:run_context) { Chef::RunContext.new(node, {}, events) }
|
74
74
|
|