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
@@ -32,7 +32,7 @@ describe "diff", :uses_diff => true do
|
|
32
32
|
include FileSystemSupport
|
33
33
|
|
34
34
|
context "with two filesystems with all types of difference" do
|
35
|
-
let(:a)
|
35
|
+
let(:a) do
|
36
36
|
memory_fs("a", {
|
37
37
|
:both_dirs => {
|
38
38
|
:sub_both_dirs => { :subsub => nil },
|
@@ -58,8 +58,8 @@ describe "diff", :uses_diff => true do
|
|
58
58
|
:dir_in_a_file_in_b => {},
|
59
59
|
:file_in_a_dir_in_b => nil,
|
60
60
|
}, /cannot_be_in_a/)
|
61
|
-
|
62
|
-
let(:b)
|
61
|
+
end
|
62
|
+
let(:b) do
|
63
63
|
memory_fs("b", {
|
64
64
|
:both_dirs => {
|
65
65
|
:sub_both_dirs => { :subsub => nil },
|
@@ -85,7 +85,7 @@ describe "diff", :uses_diff => true do
|
|
85
85
|
:dir_in_a_file_in_b => nil,
|
86
86
|
:file_in_a_dir_in_b => {},
|
87
87
|
}, /cannot_be_in_b/)
|
88
|
-
|
88
|
+
end
|
89
89
|
it "Chef::ChefFS::CommandLine.diff_print(/)" do
|
90
90
|
results = []
|
91
91
|
Chef::ChefFS::CommandLine.diff_print(pattern("/"), a, b, nil, nil) do |diff|
|
@@ -30,17 +30,17 @@ describe Chef::ChefFS::FileSystem::OperationFailedError do
|
|
30
30
|
allow(@response).to receive(:code).and_return("400")
|
31
31
|
allow(@response).to receive(:body).and_return(response_body)
|
32
32
|
exception = Net::HTTPServerException.new("(exception) unauthorized", @response)
|
33
|
-
expect
|
33
|
+
expect do
|
34
34
|
raise Chef::ChefFS::FileSystem::OperationFailedError.new(:write, self, exception), error_message
|
35
|
-
|
35
|
+
end.to raise_error(Chef::ChefFS::FileSystem::OperationFailedError, "#{error_message} cause: #{response_body}")
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
39
|
context "does not have a cause attribute" do
|
40
40
|
it "does not include error cause" do
|
41
|
-
expect
|
41
|
+
expect do
|
42
42
|
raise Chef::ChefFS::FileSystem::OperationFailedError.new(:write, self), error_message
|
43
|
-
|
43
|
+
end.to raise_error(Chef::ChefFS::FileSystem::OperationFailedError, error_message)
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
@@ -55,7 +55,7 @@ describe Chef::ChefFS::FileSystem do
|
|
55
55
|
end
|
56
56
|
|
57
57
|
context "with a populated filesystem" do
|
58
|
-
let(:fs)
|
58
|
+
let(:fs) do
|
59
59
|
memory_fs("", {
|
60
60
|
:a => {
|
61
61
|
:aa => {
|
@@ -69,7 +69,7 @@ describe Chef::ChefFS::FileSystem do
|
|
69
69
|
:x => "",
|
70
70
|
:y => {},
|
71
71
|
})
|
72
|
-
|
72
|
+
end
|
73
73
|
context "list" do
|
74
74
|
it "/**" do
|
75
75
|
list_should_yield_paths(fs, "/**", "/", "/a", "/x", "/y", "/a/aa", "/a/aa/c", "/a/aa/zz", "/a/ab", "/a/ab/c")
|
@@ -35,9 +35,9 @@ describe Chef::ChefFS::Parallelizer do
|
|
35
35
|
|
36
36
|
context "With :ordered => false (unordered output)" do
|
37
37
|
it "An empty input produces an empty output" do
|
38
|
-
parallelize([], :ordered => false) do
|
38
|
+
expect(parallelize([], :ordered => false) do
|
39
39
|
sleep 10
|
40
|
-
end.to_a
|
40
|
+
end.to_a).to eql([])
|
41
41
|
expect(elapsed_time).to be < 0.1
|
42
42
|
end
|
43
43
|
|
@@ -107,9 +107,9 @@ describe Chef::ChefFS::Parallelizer do
|
|
107
107
|
|
108
108
|
context "With :ordered => true (ordered output)" do
|
109
109
|
it "An empty input produces an empty output" do
|
110
|
-
parallelize([]) do
|
110
|
+
expect(parallelize([]) do
|
111
111
|
sleep 10
|
112
|
-
end.to_a
|
112
|
+
end.to_a).to eql([])
|
113
113
|
expect(elapsed_time).to be < 0.1
|
114
114
|
end
|
115
115
|
|
@@ -211,9 +211,7 @@ describe Chef::ChefFS::Parallelizer do
|
|
211
211
|
occupying_job_finished[0] = true
|
212
212
|
end.wait
|
213
213
|
end
|
214
|
-
until started
|
215
|
-
sleep(0.01)
|
216
|
-
end
|
214
|
+
sleep(0.01) until started
|
217
215
|
end
|
218
216
|
|
219
217
|
after :each do
|
@@ -461,21 +461,21 @@ describe Chef::Cookbook::Metadata do
|
|
461
461
|
expect(metadata.grouping("/db/mysql/databases/tuning", group)).to eq(group)
|
462
462
|
end
|
463
463
|
it "should not accept anything but a string for display_name" do
|
464
|
-
expect
|
464
|
+
expect do
|
465
465
|
metadata.grouping("db/mysql/databases", :title => "foo")
|
466
|
-
|
467
|
-
expect
|
466
|
+
end.not_to raise_error
|
467
|
+
expect do
|
468
468
|
metadata.grouping("db/mysql/databases", :title => Hash.new)
|
469
|
-
|
469
|
+
end.to raise_error(ArgumentError)
|
470
470
|
end
|
471
471
|
|
472
472
|
it "should not accept anything but a string for the description" do
|
473
|
-
expect
|
473
|
+
expect do
|
474
474
|
metadata.grouping("db/mysql/databases", :description => "foo")
|
475
|
-
|
476
|
-
expect
|
475
|
+
end.not_to raise_error
|
476
|
+
expect do
|
477
477
|
metadata.grouping("db/mysql/databases", :description => Hash.new)
|
478
|
-
|
478
|
+
end.to raise_error(ArgumentError)
|
479
479
|
end
|
480
480
|
end
|
481
481
|
|
@@ -498,63 +498,63 @@ describe Chef::Cookbook::Metadata do
|
|
498
498
|
end
|
499
499
|
|
500
500
|
it "should not accept anything but a string for display_name" do
|
501
|
-
expect
|
501
|
+
expect do
|
502
502
|
metadata.attribute("db/mysql/databases", :display_name => "foo")
|
503
|
-
|
504
|
-
expect
|
503
|
+
end.not_to raise_error
|
504
|
+
expect do
|
505
505
|
metadata.attribute("db/mysql/databases", :display_name => Hash.new)
|
506
|
-
|
506
|
+
end.to raise_error(ArgumentError)
|
507
507
|
end
|
508
508
|
|
509
509
|
it "should not accept anything but a string for the description" do
|
510
|
-
expect
|
510
|
+
expect do
|
511
511
|
metadata.attribute("db/mysql/databases", :description => "foo")
|
512
|
-
|
513
|
-
expect
|
512
|
+
end.not_to raise_error
|
513
|
+
expect do
|
514
514
|
metadata.attribute("db/mysql/databases", :description => Hash.new)
|
515
|
-
|
515
|
+
end.to raise_error(ArgumentError)
|
516
516
|
end
|
517
517
|
|
518
518
|
it "should not accept anything but a string for the source_url" do
|
519
|
-
expect
|
519
|
+
expect do
|
520
520
|
metadata.attribute("db/mysql/databases", :source_url => "foo")
|
521
|
-
|
522
|
-
expect
|
521
|
+
end.not_to raise_error
|
522
|
+
expect do
|
523
523
|
metadata.attribute("db/mysql/databases", :source_url => Hash.new)
|
524
|
-
|
524
|
+
end.to raise_error(ArgumentError)
|
525
525
|
end
|
526
526
|
|
527
527
|
it "should not accept anything but a string for the issues_url" do
|
528
|
-
expect
|
528
|
+
expect do
|
529
529
|
metadata.attribute("db/mysql/databases", :issues_url => "foo")
|
530
|
-
|
531
|
-
expect
|
530
|
+
end.not_to raise_error
|
531
|
+
expect do
|
532
532
|
metadata.attribute("db/mysql/databases", :issues_url => Hash.new)
|
533
|
-
|
533
|
+
end.to raise_error(ArgumentError)
|
534
534
|
end
|
535
535
|
|
536
536
|
it "should not accept anything but true or false for the privacy flag" do
|
537
|
-
expect
|
537
|
+
expect do
|
538
538
|
metadata.attribute("db/mysql/databases", :privacy => true)
|
539
|
-
|
540
|
-
expect
|
539
|
+
end.not_to raise_error
|
540
|
+
expect do
|
541
541
|
metadata.attribute("db/mysql/databases", :privacy => false)
|
542
|
-
|
543
|
-
expect
|
542
|
+
end.not_to raise_error
|
543
|
+
expect do
|
544
544
|
metadata.attribute("db/mysql/databases", :privacy => "true")
|
545
|
-
|
545
|
+
end.to raise_error(ArgumentError)
|
546
546
|
end
|
547
547
|
|
548
548
|
it "should not accept anything but an array of strings for choice" do
|
549
|
-
expect
|
549
|
+
expect do
|
550
550
|
metadata.attribute("db/mysql/databases", :choice => %w{dedicated shared})
|
551
|
-
|
552
|
-
expect
|
551
|
+
end.not_to raise_error
|
552
|
+
expect do
|
553
553
|
metadata.attribute("db/mysql/databases", :choice => [10, "shared"])
|
554
|
-
|
555
|
-
expect
|
554
|
+
end.to raise_error(ArgumentError)
|
555
|
+
expect do
|
556
556
|
metadata.attribute("db/mysql/databases", :choice => Hash.new)
|
557
|
-
|
557
|
+
end.to raise_error(ArgumentError)
|
558
558
|
end
|
559
559
|
|
560
560
|
it "should set choice to empty array by default" do
|
@@ -563,15 +563,15 @@ describe Chef::Cookbook::Metadata do
|
|
563
563
|
end
|
564
564
|
|
565
565
|
it "should let calculated be true or false" do
|
566
|
-
expect
|
566
|
+
expect do
|
567
567
|
metadata.attribute("db/mysql/databases", :calculated => true)
|
568
|
-
|
569
|
-
expect
|
568
|
+
end.not_to raise_error
|
569
|
+
expect do
|
570
570
|
metadata.attribute("db/mysql/databases", :calculated => false)
|
571
|
-
|
572
|
-
expect
|
571
|
+
end.not_to raise_error
|
572
|
+
expect do
|
573
573
|
metadata.attribute("db/mysql/databases", :calculated => Hash.new)
|
574
|
-
|
574
|
+
end.to raise_error(ArgumentError)
|
575
575
|
end
|
576
576
|
|
577
577
|
it "should set calculated to false by default" do
|
@@ -580,55 +580,55 @@ describe Chef::Cookbook::Metadata do
|
|
580
580
|
end
|
581
581
|
|
582
582
|
it "accepts String for the attribute type" do
|
583
|
-
expect
|
583
|
+
expect do
|
584
584
|
metadata.attribute("db/mysql/databases", :type => "string")
|
585
|
-
|
585
|
+
end.not_to raise_error
|
586
586
|
end
|
587
587
|
|
588
588
|
it "accepts Array for the attribute type" do
|
589
|
-
expect
|
589
|
+
expect do
|
590
590
|
metadata.attribute("db/mysql/databases", :type => "array")
|
591
|
-
|
592
|
-
expect
|
591
|
+
end.not_to raise_error
|
592
|
+
expect do
|
593
593
|
metadata.attribute("db/mysql/databases", :type => Array.new)
|
594
|
-
|
594
|
+
end.to raise_error(ArgumentError)
|
595
595
|
end
|
596
596
|
|
597
597
|
it "accepts symbol for the attribute type" do
|
598
|
-
expect
|
598
|
+
expect do
|
599
599
|
metadata.attribute("db/mysql/databases", :type => "symbol")
|
600
|
-
|
600
|
+
end.not_to raise_error
|
601
601
|
end
|
602
602
|
|
603
603
|
it "should let type be hash (backwards compatibility only)" do
|
604
|
-
expect
|
604
|
+
expect do
|
605
605
|
metadata.attribute("db/mysql/databases", :type => "hash")
|
606
|
-
|
606
|
+
end.not_to raise_error
|
607
607
|
end
|
608
608
|
|
609
609
|
it "should let required be required, recommended or optional" do
|
610
|
-
expect
|
610
|
+
expect do
|
611
611
|
metadata.attribute("db/mysql/databases", :required => "required")
|
612
|
-
|
613
|
-
expect
|
612
|
+
end.not_to raise_error
|
613
|
+
expect do
|
614
614
|
metadata.attribute("db/mysql/databases", :required => "recommended")
|
615
|
-
|
616
|
-
expect
|
615
|
+
end.not_to raise_error
|
616
|
+
expect do
|
617
617
|
metadata.attribute("db/mysql/databases", :required => "optional")
|
618
|
-
|
618
|
+
end.not_to raise_error
|
619
619
|
end
|
620
620
|
|
621
621
|
it "should convert required true to required" do
|
622
|
-
expect
|
622
|
+
expect do
|
623
623
|
metadata.attribute("db/mysql/databases", :required => true)
|
624
|
-
|
624
|
+
end.not_to raise_error
|
625
625
|
#attrib = metadata.attributes["db/mysql/databases"][:required].should == "required"
|
626
626
|
end
|
627
627
|
|
628
628
|
it "should convert required false to optional" do
|
629
|
-
expect
|
629
|
+
expect do
|
630
630
|
metadata.attribute("db/mysql/databases", :required => false)
|
631
|
-
|
631
|
+
end.not_to raise_error
|
632
632
|
#attrib = metadata.attributes["db/mysql/databases"][:required].should == "optional"
|
633
633
|
end
|
634
634
|
|
@@ -638,12 +638,12 @@ describe Chef::Cookbook::Metadata do
|
|
638
638
|
end
|
639
639
|
|
640
640
|
it "should make sure recipes is an array" do
|
641
|
-
expect
|
641
|
+
expect do
|
642
642
|
metadata.attribute("db/mysql/databases", :recipes => [])
|
643
|
-
|
644
|
-
expect
|
643
|
+
end.not_to raise_error
|
644
|
+
expect do
|
645
645
|
metadata.attribute("db/mysql/databases", :required => Hash.new)
|
646
|
-
|
646
|
+
end.to raise_error(ArgumentError)
|
647
647
|
end
|
648
648
|
|
649
649
|
it "should set recipes to an empty array by default" do
|
@@ -652,24 +652,24 @@ describe Chef::Cookbook::Metadata do
|
|
652
652
|
end
|
653
653
|
|
654
654
|
it "should allow the default value to be a string, array, hash, boolean or numeric" do
|
655
|
-
expect
|
655
|
+
expect do
|
656
656
|
metadata.attribute("db/mysql/databases", :default => [])
|
657
|
-
|
658
|
-
expect
|
657
|
+
end.not_to raise_error
|
658
|
+
expect do
|
659
659
|
metadata.attribute("db/mysql/databases", :default => {})
|
660
|
-
|
661
|
-
expect
|
660
|
+
end.not_to raise_error
|
661
|
+
expect do
|
662
662
|
metadata.attribute("db/mysql/databases", :default => "alice in chains")
|
663
|
-
|
664
|
-
expect
|
663
|
+
end.not_to raise_error
|
664
|
+
expect do
|
665
665
|
metadata.attribute("db/mysql/databases", :default => 1337)
|
666
|
-
|
667
|
-
expect
|
666
|
+
end.not_to raise_error
|
667
|
+
expect do
|
668
668
|
metadata.attribute("db/mysql/databases", :default => true)
|
669
|
-
|
670
|
-
expect
|
669
|
+
end.not_to raise_error
|
670
|
+
expect do
|
671
671
|
metadata.attribute("db/mysql/databases", :required => :not_gonna_do_it)
|
672
|
-
|
672
|
+
end.to raise_error(ArgumentError)
|
673
673
|
end
|
674
674
|
|
675
675
|
it "should limit the types allowed in the choice array" do
|
@@ -678,87 +678,87 @@ describe Chef::Cookbook::Metadata do
|
|
678
678
|
:choice => %w{test1 test2},
|
679
679
|
:default => "test1",
|
680
680
|
}
|
681
|
-
expect
|
681
|
+
expect do
|
682
682
|
metadata.attribute("test_cookbook/test", options)
|
683
|
-
|
683
|
+
end.not_to raise_error
|
684
684
|
|
685
685
|
options = {
|
686
686
|
:type => "boolean",
|
687
687
|
:choice => [ true, false ],
|
688
688
|
:default => true,
|
689
689
|
}
|
690
|
-
expect
|
690
|
+
expect do
|
691
691
|
metadata.attribute("test_cookbook/test", options)
|
692
|
-
|
692
|
+
end.not_to raise_error
|
693
693
|
|
694
694
|
options = {
|
695
695
|
:type => "numeric",
|
696
696
|
:choice => [ 1337, 420 ],
|
697
697
|
:default => 1337,
|
698
698
|
}
|
699
|
-
expect
|
699
|
+
expect do
|
700
700
|
metadata.attribute("test_cookbook/test", options)
|
701
|
-
|
701
|
+
end.not_to raise_error
|
702
702
|
|
703
703
|
options = {
|
704
704
|
:type => "numeric",
|
705
705
|
:choice => [ true, "false" ],
|
706
706
|
:default => false,
|
707
707
|
}
|
708
|
-
expect
|
708
|
+
expect do
|
709
709
|
metadata.attribute("test_cookbook/test", options)
|
710
|
-
|
710
|
+
end.to raise_error(Chef::Exceptions::ValidationFailed)
|
711
711
|
end
|
712
712
|
|
713
713
|
it "should error if default used with calculated" do
|
714
|
-
expect
|
714
|
+
expect do
|
715
715
|
attrs = {
|
716
716
|
:calculated => true,
|
717
717
|
:default => [ "I thought you said calculated" ],
|
718
718
|
}
|
719
719
|
metadata.attribute("db/mysql/databases", attrs)
|
720
|
-
|
721
|
-
expect
|
720
|
+
end.to raise_error(ArgumentError)
|
721
|
+
expect do
|
722
722
|
attrs = {
|
723
723
|
:calculated => true,
|
724
724
|
:default => "I thought you said calculated",
|
725
725
|
}
|
726
726
|
metadata.attribute("db/mysql/databases", attrs)
|
727
|
-
|
727
|
+
end.to raise_error(ArgumentError)
|
728
728
|
end
|
729
729
|
|
730
730
|
it "should allow a default that is a choice" do
|
731
|
-
expect
|
731
|
+
expect do
|
732
732
|
attrs = {
|
733
733
|
:choice => %w{a b c},
|
734
734
|
:default => "b",
|
735
735
|
}
|
736
736
|
metadata.attribute("db/mysql/databases", attrs)
|
737
|
-
|
738
|
-
expect
|
737
|
+
end.not_to raise_error
|
738
|
+
expect do
|
739
739
|
attrs = {
|
740
740
|
:choice => %w{a b c d e},
|
741
741
|
:default => %w{b d},
|
742
742
|
}
|
743
743
|
metadata.attribute("db/mysql/databases", attrs)
|
744
|
-
|
744
|
+
end.not_to raise_error
|
745
745
|
end
|
746
746
|
|
747
747
|
it "should error if default is not a choice" do
|
748
|
-
expect
|
748
|
+
expect do
|
749
749
|
attrs = {
|
750
750
|
:choice => %w{a b c},
|
751
751
|
:default => "d",
|
752
752
|
}
|
753
753
|
metadata.attribute("db/mysql/databases", attrs)
|
754
|
-
|
755
|
-
expect
|
754
|
+
end.to raise_error(ArgumentError)
|
755
|
+
expect do
|
756
756
|
attrs = {
|
757
757
|
:choice => %w{a b c d e},
|
758
758
|
:default => %w{b z},
|
759
759
|
}
|
760
760
|
metadata.attribute("db/mysql/databases", attrs)
|
761
|
-
|
761
|
+
end.to raise_error(ArgumentError)
|
762
762
|
end
|
763
763
|
end
|
764
764
|
|