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
@@ -249,4 +249,159 @@ describe Chef::Resource::Link, :not_supported_on_win2k3 do
|
|
249
249
|
end
|
250
250
|
end
|
251
251
|
end
|
252
|
+
|
253
|
+
describe "action_delete" do
|
254
|
+
before(:each) do
|
255
|
+
stat = double("stats", :ino => 5)
|
256
|
+
allow(stat).to receive(:uid).and_return(501)
|
257
|
+
allow(stat).to receive(:gid).and_return(501)
|
258
|
+
allow(stat).to receive(:mode).and_return(0755)
|
259
|
+
allow(provider.file_class).to receive(:stat).with(
|
260
|
+
"#{CHEF_SPEC_DATA}/fofile-link").and_return(stat)
|
261
|
+
|
262
|
+
provider.load_current_resource
|
263
|
+
end
|
264
|
+
|
265
|
+
shared_context "delete link to directories on Windows" do
|
266
|
+
before do
|
267
|
+
allow(::File).to receive(:directory?).with(
|
268
|
+
"#{CHEF_SPEC_DATA}/fofile-link").and_return(true)
|
269
|
+
end
|
270
|
+
|
271
|
+
it "invokes Dir.delete method to delete the link" do
|
272
|
+
expect(::Dir).to receive(:delete).with(provider.new_resource.target_file)
|
273
|
+
expect(Chef::Log).to receive(:info).with("#{provider.new_resource} deleted")
|
274
|
+
provider.run_action(:delete)
|
275
|
+
end
|
276
|
+
end
|
277
|
+
|
278
|
+
shared_context "delete link to directories on Linux" do
|
279
|
+
before do
|
280
|
+
allow(::File).to receive(:directory?).with(
|
281
|
+
"#{CHEF_SPEC_DATA}/fofile-link").and_return(true)
|
282
|
+
end
|
283
|
+
|
284
|
+
it "invokes File.delete method to delete the link" do
|
285
|
+
expect(::File).to receive(:delete).with(provider.new_resource.target_file)
|
286
|
+
expect(Chef::Log).to receive(:info).with("#{provider.new_resource} deleted")
|
287
|
+
provider.run_action(:delete)
|
288
|
+
end
|
289
|
+
end
|
290
|
+
|
291
|
+
shared_context "delete link to files" do
|
292
|
+
before do
|
293
|
+
allow(::File).to receive(:directory?).with(
|
294
|
+
"#{CHEF_SPEC_DATA}/fofile-link").and_return(false)
|
295
|
+
end
|
296
|
+
|
297
|
+
it "invokes File.delete method to delete the link" do
|
298
|
+
expect(::File).to receive(:delete).with(provider.new_resource.target_file)
|
299
|
+
expect(Chef::Log).to receive(:info).with("#{provider.new_resource} deleted")
|
300
|
+
provider.run_action(:delete)
|
301
|
+
end
|
302
|
+
end
|
303
|
+
|
304
|
+
shared_context "soft links prerequisites" do
|
305
|
+
before(:each) do
|
306
|
+
allow(provider.file_class).to receive(:symlink?).with(
|
307
|
+
"#{CHEF_SPEC_DATA}/fofile-link").and_return(true)
|
308
|
+
allow(provider.file_class).to receive(:readlink).with(
|
309
|
+
"#{CHEF_SPEC_DATA}/fofile-link").and_return("#{CHEF_SPEC_DATA}/fofile")
|
310
|
+
end
|
311
|
+
end
|
312
|
+
|
313
|
+
shared_context "hard links prerequisites" do
|
314
|
+
let(:new_resource) do
|
315
|
+
result = Chef::Resource::Link.new("#{CHEF_SPEC_DATA}/fofile-link")
|
316
|
+
result.to "#{CHEF_SPEC_DATA}/fofile"
|
317
|
+
result.link_type :hard
|
318
|
+
result
|
319
|
+
end
|
320
|
+
|
321
|
+
before(:each) do
|
322
|
+
stat = double("stats", :ino => 5)
|
323
|
+
allow(stat).to receive(:uid).and_return(502)
|
324
|
+
allow(stat).to receive(:gid).and_return(502)
|
325
|
+
allow(stat).to receive(:mode).and_return(0644)
|
326
|
+
|
327
|
+
allow(provider.file_class).to receive(:symlink?).with(
|
328
|
+
"#{CHEF_SPEC_DATA}/fofile-link").and_return(false)
|
329
|
+
|
330
|
+
allow(File).to receive(:exists?).with(
|
331
|
+
"#{CHEF_SPEC_DATA}/fofile-link").and_return(true)
|
332
|
+
allow(File).to receive(:exists?).with(
|
333
|
+
"#{CHEF_SPEC_DATA}/fofile").and_return(true)
|
334
|
+
|
335
|
+
allow(provider.file_class).to receive(:stat).with(
|
336
|
+
"#{CHEF_SPEC_DATA}/fofile").and_return(stat)
|
337
|
+
end
|
338
|
+
end
|
339
|
+
|
340
|
+
context "on Windows platform" do
|
341
|
+
let(:resource_link) do
|
342
|
+
Chef::Resource::Link.new(provider.new_resource.name)
|
343
|
+
end
|
344
|
+
|
345
|
+
before(:each) do
|
346
|
+
allow(Chef::Resource::Link).to receive(:new).with(
|
347
|
+
provider.new_resource.name).and_return(resource_link)
|
348
|
+
allow(resource_link).to receive(:verify_links_supported!)
|
349
|
+
allow(Chef::Platform).to receive(:windows?).and_return(true)
|
350
|
+
end
|
351
|
+
|
352
|
+
context "soft links" do
|
353
|
+
include_context "soft links prerequisites"
|
354
|
+
|
355
|
+
context "to directories" do
|
356
|
+
include_context "delete link to directories on Windows"
|
357
|
+
end
|
358
|
+
|
359
|
+
context "to files" do
|
360
|
+
include_context "delete link to files"
|
361
|
+
end
|
362
|
+
end
|
363
|
+
|
364
|
+
context "hard links" do
|
365
|
+
include_context "hard links prerequisites"
|
366
|
+
|
367
|
+
context "to directories" do
|
368
|
+
include_context "delete link to directories on Windows"
|
369
|
+
end
|
370
|
+
|
371
|
+
context "to files" do
|
372
|
+
include_context "delete link to files"
|
373
|
+
end
|
374
|
+
end
|
375
|
+
end
|
376
|
+
|
377
|
+
context "on Linux platform" do
|
378
|
+
before(:each) do
|
379
|
+
allow(Chef::Platform).to receive(:windows?).and_return(false)
|
380
|
+
end
|
381
|
+
|
382
|
+
context "soft links" do
|
383
|
+
include_context "soft links prerequisites"
|
384
|
+
|
385
|
+
context "to directories" do
|
386
|
+
include_context "delete link to directories on Linux"
|
387
|
+
end
|
388
|
+
|
389
|
+
context "to files" do
|
390
|
+
include_context "delete link to files"
|
391
|
+
end
|
392
|
+
end
|
393
|
+
|
394
|
+
context "hard links" do
|
395
|
+
include_context "hard links prerequisites"
|
396
|
+
|
397
|
+
context "to directories" do
|
398
|
+
include_context "delete link to directories on Linux"
|
399
|
+
end
|
400
|
+
|
401
|
+
context "to files" do
|
402
|
+
include_context "delete link to files"
|
403
|
+
end
|
404
|
+
end
|
405
|
+
end
|
406
|
+
end
|
252
407
|
end
|
@@ -82,7 +82,7 @@ describe Chef::Provider::Mount::Mount do
|
|
82
82
|
|
83
83
|
it "should raise an error if the mount device does not exist" do
|
84
84
|
allow(::File).to receive(:exists?).with("/dev/sdz1").and_return false
|
85
|
-
expect { @provider.load_current_resource()
|
85
|
+
expect { @provider.load_current_resource(); @provider.mountable? }.to raise_error(Chef::Exceptions::Mount)
|
86
86
|
end
|
87
87
|
|
88
88
|
it "should not call mountable? with load_current_resource - CHEF-1565" do
|
@@ -99,25 +99,25 @@ describe Chef::Provider::Mount::Mount do
|
|
99
99
|
@new_resource.device "d21afe51-a0fe-4dc6-9152-ac733763ae0a"
|
100
100
|
expect(@provider).to receive(:shell_out).with("/sbin/findfs UUID=d21afe51-a0fe-4dc6-9152-ac733763ae0a").and_return(status)
|
101
101
|
expect(::File).to receive(:exists?).with("").and_return(false)
|
102
|
-
expect { @provider.load_current_resource()
|
102
|
+
expect { @provider.load_current_resource(); @provider.mountable? }.to raise_error(Chef::Exceptions::Mount)
|
103
103
|
end
|
104
104
|
|
105
105
|
it "should raise an error if the mount point does not exist" do
|
106
106
|
allow(::File).to receive(:exists?).with("/tmp/foo").and_return false
|
107
|
-
expect { @provider.load_current_resource()
|
107
|
+
expect { @provider.load_current_resource(); @provider.mountable? }.to raise_error(Chef::Exceptions::Mount)
|
108
108
|
end
|
109
109
|
|
110
110
|
%w{tmpfs fuse cgroup}.each do |fstype|
|
111
111
|
it "does not expect the device to exist for #{fstype}" do
|
112
112
|
@new_resource.fstype(fstype)
|
113
113
|
@new_resource.device("whatever")
|
114
|
-
expect { @provider.load_current_resource()
|
114
|
+
expect { @provider.load_current_resource(); @provider.mountable? }.not_to raise_error
|
115
115
|
end
|
116
116
|
end
|
117
117
|
|
118
118
|
it "does not expect the device to exist if it's none" do
|
119
119
|
@new_resource.device("none")
|
120
|
-
expect { @provider.load_current_resource()
|
120
|
+
expect { @provider.load_current_resource(); @provider.mountable? }.not_to raise_error
|
121
121
|
end
|
122
122
|
|
123
123
|
it "should set mounted true if the mount point is found in the mounts list" do
|
@@ -41,7 +41,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
|
|
41
41
|
|
42
42
|
let(:options) { nil }
|
43
43
|
|
44
|
-
let(:new_resource)
|
44
|
+
let(:new_resource) do
|
45
45
|
new_resource = Chef::Resource::Mount.new(mountpoint)
|
46
46
|
new_resource.device device
|
47
47
|
new_resource.device_type device_type
|
@@ -50,13 +50,13 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
|
|
50
50
|
new_resource.options options
|
51
51
|
new_resource.supports :remount => false
|
52
52
|
new_resource
|
53
|
-
|
53
|
+
end
|
54
54
|
|
55
|
-
let(:provider)
|
55
|
+
let(:provider) do
|
56
56
|
Chef::Provider::Mount::Solaris.new(new_resource, run_context)
|
57
|
-
|
57
|
+
end
|
58
58
|
|
59
|
-
let(:vfstab_file_contents)
|
59
|
+
let(:vfstab_file_contents) do
|
60
60
|
<<-EOF.gsub /^\s*/, ""
|
61
61
|
#device device mount FS fsck mount mount
|
62
62
|
#to mount to fsck point type pass at boot options
|
@@ -74,21 +74,21 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
|
|
74
74
|
# ufs
|
75
75
|
/dev/dsk/c0t2d0s7 /dev/rdsk/c0t2d0s7 /mnt/foo ufs 2 yes -
|
76
76
|
EOF
|
77
|
-
|
77
|
+
end
|
78
78
|
|
79
|
-
let(:vfstab_file)
|
79
|
+
let(:vfstab_file) do
|
80
80
|
t = Tempfile.new("rspec-vfstab")
|
81
81
|
t.write(vfstab_file_contents)
|
82
82
|
t.close
|
83
83
|
t
|
84
|
-
|
84
|
+
end
|
85
85
|
|
86
|
-
let(:mount_output)
|
86
|
+
let(:mount_output) do
|
87
87
|
<<-EOF.gsub /^\s*/, ""
|
88
88
|
/dev/dsk/c0t0d0s0 on / type ufs read/write/setuid/intr/largefiles/xattr/onerror=panic/dev=2200000 on Tue Jul 31 22:34:46 2012
|
89
89
|
/dev/dsk/c0t2d0s7 on /mnt/foo type ufs read/write/setuid/intr/largefiles/xattr/onerror=panic/dev=2200007 on Tue Jul 31 22:34:46 2012
|
90
90
|
EOF
|
91
|
-
|
91
|
+
end
|
92
92
|
|
93
93
|
before do
|
94
94
|
stub_const("Chef::Provider::Mount::Solaris::VFSTAB", vfstab_file.path )
|
@@ -214,7 +214,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
|
|
214
214
|
describe "#load_current_resource" do
|
215
215
|
context "when loading a normal UFS filesystem with noauto, don't mount at boot" do
|
216
216
|
|
217
|
-
let(:vfstab_file_contents)
|
217
|
+
let(:vfstab_file_contents) do
|
218
218
|
<<-EOF.gsub /^\s*/, ""
|
219
219
|
#device device mount FS fsck mount mount
|
220
220
|
#to mount to fsck point type pass at boot options
|
@@ -232,7 +232,7 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
|
|
232
232
|
# ufs
|
233
233
|
/dev/dsk/c0t2d0s7 /dev/rdsk/c0t2d0s7 /mnt/foo ufs 2 no -
|
234
234
|
EOF
|
235
|
-
|
235
|
+
end
|
236
236
|
|
237
237
|
before do
|
238
238
|
provider.load_current_resource
|
@@ -244,16 +244,16 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
|
|
244
244
|
end
|
245
245
|
|
246
246
|
context "when the device is an smbfs mount" do
|
247
|
-
let(:mount_output)
|
247
|
+
let(:mount_output) do
|
248
248
|
<<-EOF.gsub /^\s*/, ""
|
249
249
|
//solarsystem/tmp on /mnt type smbfs read/write/setuid/devices/dev=5080000 on Tue Mar 29 11:40:18 2011
|
250
250
|
EOF
|
251
|
-
|
252
|
-
let(:vfstab_file_contents)
|
251
|
+
end
|
252
|
+
let(:vfstab_file_contents) do
|
253
253
|
<<-EOF.gsub /^\s*/, ""
|
254
254
|
//WORKGROUP;username:password@host/share - /mountpoint smbfs - no fileperms=0777,dirperms=0777
|
255
255
|
EOF
|
256
|
-
|
256
|
+
end
|
257
257
|
|
258
258
|
let(:fsck_device) { "-" }
|
259
259
|
|
@@ -263,17 +263,17 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
|
|
263
263
|
end
|
264
264
|
|
265
265
|
context "when the device is an NFS mount" do
|
266
|
-
let(:mount_output)
|
266
|
+
let(:mount_output) do
|
267
267
|
<<-EOF.gsub /^\s*/, ""
|
268
268
|
cartman:/share2 on /cartman type nfs rsize=32768,wsize=32768,NFSv4,dev=4000004 on Tue Mar 29 11:40:18 2011
|
269
269
|
EOF
|
270
|
-
|
270
|
+
end
|
271
271
|
|
272
|
-
let(:vfstab_file_contents)
|
272
|
+
let(:vfstab_file_contents) do
|
273
273
|
<<-EOF.gsub /^\s*/, ""
|
274
274
|
cartman:/share2 - /cartman nfs - yes rw,soft
|
275
275
|
EOF
|
276
|
-
|
276
|
+
end
|
277
277
|
|
278
278
|
let(:fsck_device) { "-" }
|
279
279
|
|
@@ -334,17 +334,17 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
|
|
334
334
|
|
335
335
|
let(:target) { "/dev/mapper/target" }
|
336
336
|
|
337
|
-
let(:mount_output)
|
337
|
+
let(:mount_output) do
|
338
338
|
<<-EOF.gsub /^\s*/, ""
|
339
339
|
#{target} on /mnt/foo type ufs read/write/setuid/intr/largefiles/xattr/onerror=panic/dev=2200007 on Tue Jul 31 22:34:46 2012
|
340
340
|
EOF
|
341
|
-
|
341
|
+
end
|
342
342
|
|
343
|
-
let(:vfstab_file_contents)
|
343
|
+
let(:vfstab_file_contents) do
|
344
344
|
<<-EOF.gsub /^\s*/, ""
|
345
345
|
#{target} /dev/rdsk/c0t2d0s7 /mnt/foo ufs 2 yes -
|
346
346
|
EOF
|
347
|
-
|
347
|
+
end
|
348
348
|
|
349
349
|
before do
|
350
350
|
expect(File).to receive(:symlink?).with(device).at_least(:once).and_return(true)
|
@@ -371,17 +371,17 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
|
|
371
371
|
|
372
372
|
let(:absolute_target) { File.expand_path(target, File.dirname(device)) }
|
373
373
|
|
374
|
-
let(:mount_output)
|
374
|
+
let(:mount_output) do
|
375
375
|
<<-EOF.gsub /^\s*/, ""
|
376
376
|
#{absolute_target} on /mnt/foo type ufs read/write/setuid/intr/largefiles/xattr/onerror=panic/dev=2200007 on Tue Jul 31 22:34:46 2012
|
377
377
|
EOF
|
378
|
-
|
378
|
+
end
|
379
379
|
|
380
|
-
let(:vfstab_file_contents)
|
380
|
+
let(:vfstab_file_contents) do
|
381
381
|
<<-EOF.gsub /^\s*/, ""
|
382
382
|
#{absolute_target} /dev/rdsk/c0t2d0s7 /mnt/foo ufs 2 yes -
|
383
383
|
EOF
|
384
|
-
|
384
|
+
end
|
385
385
|
|
386
386
|
before do
|
387
387
|
expect(File).to receive(:symlink?).with(device).at_least(:once).and_return(true)
|
@@ -404,12 +404,12 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
|
|
404
404
|
end
|
405
405
|
|
406
406
|
context "when the matching mount point is last in the mounts list" do
|
407
|
-
let(:mount_output)
|
407
|
+
let(:mount_output) do
|
408
408
|
<<-EOF.gsub /^\s*/, ""
|
409
409
|
/dev/dsk/c0t0d0s0 on /mnt/foo type ufs read/write/setuid/intr/largefiles/xattr/onerror=panic/dev=2200000 on Tue Jul 31 22:34:46 2012
|
410
410
|
/dev/dsk/c0t2d0s7 on /mnt/foo type ufs read/write/setuid/intr/largefiles/xattr/onerror=panic/dev=2200007 on Tue Jul 31 22:34:46 2012
|
411
411
|
EOF
|
412
|
-
|
412
|
+
end
|
413
413
|
it "should set mounted true" do
|
414
414
|
provider.load_current_resource()
|
415
415
|
expect(provider.current_resource.mounted).to be_truthy
|
@@ -417,12 +417,12 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
|
|
417
417
|
end
|
418
418
|
|
419
419
|
context "when the matching mount point is not last in the mounts list" do
|
420
|
-
let(:mount_output)
|
420
|
+
let(:mount_output) do
|
421
421
|
<<-EOF.gsub /^\s*/, ""
|
422
422
|
/dev/dsk/c0t2d0s7 on /mnt/foo type ufs read/write/setuid/intr/largefiles/xattr/onerror=panic/dev=2200007 on Tue Jul 31 22:34:46 2012
|
423
423
|
/dev/dsk/c0t0d0s0 on /mnt/foo type ufs read/write/setuid/intr/largefiles/xattr/onerror=panic/dev=2200000 on Tue Jul 31 22:34:46 2012
|
424
424
|
EOF
|
425
|
-
|
425
|
+
end
|
426
426
|
it "should set mounted false" do
|
427
427
|
provider.load_current_resource()
|
428
428
|
expect(provider.current_resource.mounted).to be_falsey
|
@@ -430,11 +430,11 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
|
|
430
430
|
end
|
431
431
|
|
432
432
|
context "when the matching mount point is not in the mounts list (mountpoint wrong)" do
|
433
|
-
let(:mount_output)
|
433
|
+
let(:mount_output) do
|
434
434
|
<<-EOF.gsub /^\s*/, ""
|
435
435
|
/dev/dsk/c0t2d0s7 on /mnt/foob type ufs read/write/setuid/intr/largefiles/xattr/onerror=panic/dev=2200007 on Tue Jul 31 22:34:46 2012
|
436
436
|
EOF
|
437
|
-
|
437
|
+
end
|
438
438
|
it "should set mounted false" do
|
439
439
|
provider.load_current_resource()
|
440
440
|
expect(provider.current_resource.mounted).to be_falsey
|
@@ -442,11 +442,11 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
|
|
442
442
|
end
|
443
443
|
|
444
444
|
context "when the matching mount point is not in the mounts list (raw device wrong)" do
|
445
|
-
let(:mount_output)
|
445
|
+
let(:mount_output) do
|
446
446
|
<<-EOF.gsub /^\s*/, ""
|
447
447
|
/dev/dsk/c0t2d0s72 on /mnt/foo type ufs read/write/setuid/intr/largefiles/xattr/onerror=panic/dev=2200007 on Tue Jul 31 22:34:46 2012
|
448
448
|
EOF
|
449
|
-
|
449
|
+
end
|
450
450
|
it "should set mounted false" do
|
451
451
|
provider.load_current_resource()
|
452
452
|
expect(provider.current_resource.mounted).to be_falsey
|
@@ -454,12 +454,12 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
|
|
454
454
|
end
|
455
455
|
|
456
456
|
context "when the mount point is last in fstab" do
|
457
|
-
let(:vfstab_file_contents)
|
457
|
+
let(:vfstab_file_contents) do
|
458
458
|
<<-EOF.gsub /^\s*/, ""
|
459
459
|
/dev/dsk/c0t2d0s72 /dev/rdsk/c0t2d0s7 /mnt/foo ufs 2 yes -
|
460
460
|
/dev/dsk/c0t2d0s7 /dev/rdsk/c0t2d0s7 /mnt/foo ufs 2 yes -
|
461
461
|
EOF
|
462
|
-
|
462
|
+
end
|
463
463
|
|
464
464
|
it "should set enabled to true" do
|
465
465
|
provider.load_current_resource
|
@@ -468,12 +468,12 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
|
|
468
468
|
end
|
469
469
|
|
470
470
|
context "when the mount point is not last in fstab and is a substring of another mount" do
|
471
|
-
let(:vfstab_file_contents)
|
471
|
+
let(:vfstab_file_contents) do
|
472
472
|
<<-EOF.gsub /^\s*/, ""
|
473
473
|
/dev/dsk/c0t2d0s7 /dev/rdsk/c0t2d0s7 /mnt/foo ufs 2 yes -
|
474
474
|
/dev/dsk/c0t2d0s72 /dev/rdsk/c0t2d0s7 /mnt/foo/bar ufs 2 yes -
|
475
475
|
EOF
|
476
|
-
|
476
|
+
end
|
477
477
|
|
478
478
|
it "should set enabled to true" do
|
479
479
|
provider.load_current_resource
|
@@ -482,12 +482,12 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
|
|
482
482
|
end
|
483
483
|
|
484
484
|
context "when the mount point is not last in fstab" do
|
485
|
-
let(:vfstab_file_contents)
|
485
|
+
let(:vfstab_file_contents) do
|
486
486
|
<<-EOF.gsub /^\s*/, ""
|
487
487
|
/dev/dsk/c0t2d0s7 /dev/rdsk/c0t2d0s7 /mnt/foo ufs 2 yes -
|
488
488
|
/dev/dsk/c0t2d0s72 /dev/rdsk/c0t2d0s72 /mnt/foo ufs 2 yes -
|
489
489
|
EOF
|
490
|
-
|
490
|
+
end
|
491
491
|
|
492
492
|
it "should set enabled to false" do
|
493
493
|
provider.load_current_resource
|
@@ -496,11 +496,11 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
|
|
496
496
|
end
|
497
497
|
|
498
498
|
context "when the mount point is not in fstab, but the mountpoint is a substring of one that is" do
|
499
|
-
let(:vfstab_file_contents)
|
499
|
+
let(:vfstab_file_contents) do
|
500
500
|
<<-EOF.gsub /^\s*/, ""
|
501
501
|
/dev/dsk/c0t2d0s7 /dev/rdsk/c0t2d0s7 /mnt/foob ufs 2 yes -
|
502
502
|
EOF
|
503
|
-
|
503
|
+
end
|
504
504
|
|
505
505
|
it "should set enabled to false" do
|
506
506
|
provider.load_current_resource
|
@@ -509,11 +509,11 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
|
|
509
509
|
end
|
510
510
|
|
511
511
|
context "when the mount point is not in fstab, but the device is a substring of one that is" do
|
512
|
-
let(:vfstab_file_contents)
|
512
|
+
let(:vfstab_file_contents) do
|
513
513
|
<<-EOF.gsub /^\s*/, ""
|
514
514
|
/dev/dsk/c0t2d0s72 /dev/rdsk/c0t2d0s7 /mnt/foo ufs 2 yes -
|
515
515
|
EOF
|
516
|
-
|
516
|
+
end
|
517
517
|
|
518
518
|
it "should set enabled to false" do
|
519
519
|
provider.load_current_resource
|
@@ -522,11 +522,11 @@ describe Chef::Provider::Mount::Solaris, :unix_only do
|
|
522
522
|
end
|
523
523
|
|
524
524
|
context "when the mountpoint line is commented out" do
|
525
|
-
let(:vfstab_file_contents)
|
525
|
+
let(:vfstab_file_contents) do
|
526
526
|
<<-EOF.gsub /^\s*/, ""
|
527
527
|
#/dev/dsk/c0t2d0s7 /dev/rdsk/c0t2d0s7 /mnt/foo ufs 2 yes -
|
528
528
|
EOF
|
529
|
-
|
529
|
+
end
|
530
530
|
|
531
531
|
it "should set enabled to false" do
|
532
532
|
provider.load_current_resource
|