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
@@ -53,26 +53,26 @@ describe Chef::ResourceDefinition do
|
|
53
53
|
end
|
54
54
|
|
55
55
|
it "should accept a new definition with a symbol for a name" do
|
56
|
-
expect
|
56
|
+
expect do
|
57
57
|
defn.define :smoke do
|
58
58
|
end
|
59
|
-
|
60
|
-
expect
|
59
|
+
end.not_to raise_error
|
60
|
+
expect do
|
61
61
|
defn.define "george washington" do
|
62
62
|
end
|
63
|
-
|
63
|
+
end.to raise_error(ArgumentError)
|
64
64
|
expect(defn.name).to eql(:smoke)
|
65
65
|
end
|
66
66
|
|
67
67
|
it "should accept a new definition with a hash" do
|
68
|
-
expect
|
68
|
+
expect do
|
69
69
|
defn.define :smoke, :cigar => "cuban", :cigarette => "marlboro" do
|
70
70
|
end
|
71
|
-
|
71
|
+
end.not_to raise_error
|
72
72
|
end
|
73
73
|
|
74
74
|
it "should expose the prototype hash params in the params hash" do
|
75
|
-
defn.define
|
75
|
+
defn.define(:smoke, :cigar => "cuban", :cigarette => "marlboro") {}
|
76
76
|
expect(defn.params[:cigar]).to eql("cuban")
|
77
77
|
expect(defn.params[:cigarette]).to eql("marlboro")
|
78
78
|
end
|
@@ -91,16 +91,16 @@ describe Chef::ResourceDefinition do
|
|
91
91
|
end
|
92
92
|
|
93
93
|
it "should raise an exception if prototype_params is not a hash" do
|
94
|
-
expect
|
94
|
+
expect do
|
95
95
|
defn.define :monkey, Array.new do
|
96
96
|
end
|
97
|
-
|
97
|
+
end.to raise_error(ArgumentError)
|
98
98
|
end
|
99
99
|
|
100
100
|
it "should raise an exception if define is called without a block" do
|
101
|
-
expect
|
101
|
+
expect do
|
102
102
|
defn.define :monkey
|
103
|
-
|
103
|
+
end.to raise_error(ArgumentError)
|
104
104
|
end
|
105
105
|
|
106
106
|
it "should load a description from a file" do
|
@@ -664,9 +664,9 @@ describe Chef::ResourceReporter do
|
|
664
664
|
|
665
665
|
it "fails the run and prints an message about the error" do
|
666
666
|
expect(Chef::Log).to receive(:error).with(/500/)
|
667
|
-
expect
|
667
|
+
expect do
|
668
668
|
@resource_reporter.run_started(@run_status)
|
669
|
-
|
669
|
+
end.to raise_error(Net::HTTPServerException)
|
670
670
|
end
|
671
671
|
end
|
672
672
|
|
@@ -749,9 +749,9 @@ describe Chef::ResourceReporter do
|
|
749
749
|
it "should raise if an unkwown error happens" do
|
750
750
|
allow(@rest_client).to receive(:raw_request).and_raise(Exception.new)
|
751
751
|
|
752
|
-
expect
|
752
|
+
expect do
|
753
753
|
@resource_reporter.post_reporting_data
|
754
|
-
|
754
|
+
end.to raise_error(Exception)
|
755
755
|
end
|
756
756
|
end
|
757
757
|
end
|
@@ -20,11 +20,11 @@ require "spec_helper"
|
|
20
20
|
require "chef/resource_resolver"
|
21
21
|
|
22
22
|
describe Chef::ResourceResolver do
|
23
|
-
it
|
23
|
+
it "#resolve" do
|
24
24
|
expect(described_class.resolve(:execute)).to eq(Chef::Resource::Execute)
|
25
25
|
end
|
26
26
|
|
27
|
-
it
|
27
|
+
it "#list" do
|
28
28
|
expect(described_class.list(:package)).to_not be_empty
|
29
29
|
end
|
30
30
|
|
@@ -33,19 +33,19 @@ describe Chef::ResourceResolver do
|
|
33
33
|
described_class.new(Chef::Node.new, "execute")
|
34
34
|
end
|
35
35
|
|
36
|
-
it
|
36
|
+
it "#resolve" do
|
37
37
|
expect(resolver.resolve).to eq Chef::Resource::Execute
|
38
38
|
end
|
39
39
|
|
40
|
-
it
|
40
|
+
it "#list" do
|
41
41
|
expect(resolver.list).to eq [ Chef::Resource::Execute ]
|
42
42
|
end
|
43
43
|
|
44
|
-
it
|
44
|
+
it "#provided_by? returns true when resource class is in the list" do
|
45
45
|
expect(resolver.provided_by?(Chef::Resource::Execute)).to be_truthy
|
46
46
|
end
|
47
47
|
|
48
|
-
it
|
48
|
+
it "#provided_by? returns false when resource class is not in the list" do
|
49
49
|
expect(resolver.provided_by?(Chef::Resource::File)).to be_falsey
|
50
50
|
end
|
51
51
|
end
|
data/spec/unit/resource_spec.rb
CHANGED
@@ -95,7 +95,7 @@ describe Chef::Resource do
|
|
95
95
|
end
|
96
96
|
|
97
97
|
describe "when an identity attribute has been declared" do
|
98
|
-
let(:file_resource)
|
98
|
+
let(:file_resource) do
|
99
99
|
file_resource_class = Class.new(Chef::Resource) do
|
100
100
|
identity_attr :path
|
101
101
|
attr_accessor :path
|
@@ -104,7 +104,7 @@ describe Chef::Resource do
|
|
104
104
|
file_resource = file_resource_class.new("identity-attr-test")
|
105
105
|
file_resource.path = "/tmp/foo.txt"
|
106
106
|
file_resource
|
107
|
-
|
107
|
+
end
|
108
108
|
|
109
109
|
it "gives the value of its identity attribute" do
|
110
110
|
expect(file_resource.identity).to eq("/tmp/foo.txt")
|
@@ -140,7 +140,7 @@ describe Chef::Resource do
|
|
140
140
|
end
|
141
141
|
|
142
142
|
describe "when a set of state attributes has been declared" do
|
143
|
-
let(:file_resource)
|
143
|
+
let(:file_resource) do
|
144
144
|
file_resource_class = Class.new(Chef::Resource) do
|
145
145
|
|
146
146
|
state_attrs :checksum, :owner, :group, :mode
|
@@ -157,7 +157,7 @@ describe Chef::Resource do
|
|
157
157
|
file_resource.group = "wheel"
|
158
158
|
file_resource.mode = "0644"
|
159
159
|
file_resource
|
160
|
-
|
160
|
+
end
|
161
161
|
|
162
162
|
it "describes its state" do
|
163
163
|
resource_state = file_resource.state
|
@@ -169,15 +169,35 @@ describe Chef::Resource do
|
|
169
169
|
end
|
170
170
|
end
|
171
171
|
|
172
|
+
describe "#state_for_resource_reporter" do
|
173
|
+
context "when a property is marked as sensitive" do
|
174
|
+
it "suppresses the sensitive property's value" do
|
175
|
+
resource_class = Class.new(Chef::Resource) { property :foo, String, sensitive: true }
|
176
|
+
resource = resource_class.new("sensitive_property_tests")
|
177
|
+
resource.foo = "some value"
|
178
|
+
expect(resource.state_for_resource_reporter[:foo]).to eq("*sensitive value suppressed*")
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
context "when a property is not marked as sensitive" do
|
183
|
+
it "does not suppress the property's value" do
|
184
|
+
resource_class = Class.new(Chef::Resource) { property :foo, String }
|
185
|
+
resource = resource_class.new("sensitive_property_tests")
|
186
|
+
resource.foo = "some value"
|
187
|
+
expect(resource.state_for_resource_reporter[:foo]).to eq("some value")
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
172
192
|
describe "load_from" do
|
173
|
-
let(:prior_resource)
|
193
|
+
let(:prior_resource) do
|
174
194
|
prior_resource = Chef::Resource.new("funk")
|
175
195
|
prior_resource.supports(:funky => true)
|
176
196
|
prior_resource.source_line
|
177
197
|
prior_resource.allowed_actions << :funkytown
|
178
198
|
prior_resource.action(:funkytown)
|
179
199
|
prior_resource
|
180
|
-
|
200
|
+
end
|
181
201
|
before(:each) do
|
182
202
|
resource.allowed_actions << :funkytown
|
183
203
|
run_context.resource_collection << prior_resource
|
@@ -236,9 +256,9 @@ describe Chef::Resource do
|
|
236
256
|
|
237
257
|
it "should raise an exception if told to act in other than :delay or :immediate(ly)" do
|
238
258
|
run_context.resource_collection << Chef::Resource::ZenMaster.new("coffee")
|
239
|
-
expect
|
259
|
+
expect do
|
240
260
|
resource.notifies :reload, run_context.resource_collection.find(:zen_master => "coffee"), :someday
|
241
|
-
|
261
|
+
end.to raise_error(ArgumentError)
|
242
262
|
end
|
243
263
|
|
244
264
|
it "should allow multiple notified resources appear in the actions hash" do
|
@@ -503,12 +523,12 @@ describe Chef::Resource do
|
|
503
523
|
end
|
504
524
|
|
505
525
|
describe "retries" do
|
506
|
-
let(:retriable_resource)
|
526
|
+
let(:retriable_resource) do
|
507
527
|
retriable_resource = Chef::Resource::Cat.new("precious", run_context)
|
508
528
|
retriable_resource.provider = Chef::Provider::SnakeOil
|
509
529
|
retriable_resource.action = :purr
|
510
530
|
retriable_resource
|
511
|
-
|
531
|
+
end
|
512
532
|
|
513
533
|
before do
|
514
534
|
node.automatic_attrs[:platform] = "fubuntu"
|
@@ -563,11 +583,11 @@ describe Chef::Resource do
|
|
563
583
|
end
|
564
584
|
|
565
585
|
it "warns when setting provider_base" do
|
566
|
-
expect
|
586
|
+
expect do
|
567
587
|
class OverrideProviderBaseTest2 < Chef::Resource
|
568
588
|
provider_base Chef::Provider::Package
|
569
589
|
end
|
570
|
-
|
590
|
+
end.to raise_error(Chef::Exceptions::DeprecatedFeatureError)
|
571
591
|
end
|
572
592
|
|
573
593
|
end
|
@@ -607,11 +627,11 @@ describe Chef::Resource do
|
|
607
627
|
end
|
608
628
|
|
609
629
|
describe "when invoking its action" do
|
610
|
-
let(:resource)
|
630
|
+
let(:resource) do
|
611
631
|
resource = Chef::Resource.new("provided", run_context)
|
612
632
|
resource.provider = Chef::Provider::SnakeOil
|
613
633
|
resource
|
614
|
-
|
634
|
+
end
|
615
635
|
before do
|
616
636
|
node.automatic_attrs[:platform] = "fubuntu"
|
617
637
|
node.automatic_attrs[:platform_version] = "10.04"
|
@@ -797,11 +817,11 @@ describe Chef::Resource do
|
|
797
817
|
end
|
798
818
|
|
799
819
|
describe "when resource action is :nothing" do
|
800
|
-
let(:resource1)
|
820
|
+
let(:resource1) do
|
801
821
|
resource1 = Chef::Resource::Cat.new("sugar", run_context)
|
802
822
|
resource1.action = :nothing
|
803
823
|
resource1
|
804
|
-
|
824
|
+
end
|
805
825
|
before do
|
806
826
|
node.automatic_attrs[:platform] = "fubuntu"
|
807
827
|
node.automatic_attrs[:platform_version] = "10.04"
|
@@ -24,16 +24,16 @@ require "support/lib/library_load_order"
|
|
24
24
|
describe Chef::RunContext::ChildRunContext do
|
25
25
|
context "with a run context with stuff in it" do
|
26
26
|
let(:chef_repo_path) { File.expand_path(File.join(CHEF_SPEC_DATA, "run_context", "cookbooks")) }
|
27
|
-
let(:cookbook_collection)
|
27
|
+
let(:cookbook_collection) do
|
28
28
|
cl = Chef::CookbookLoader.new(chef_repo_path)
|
29
29
|
cl.load_cookbooks
|
30
30
|
Chef::CookbookCollection.new(cl)
|
31
|
-
|
32
|
-
let(:node)
|
31
|
+
end
|
32
|
+
let(:node) do
|
33
33
|
node = Chef::Node.new
|
34
34
|
node.run_list << "test" << "test::one" << "test::two"
|
35
35
|
node
|
36
|
-
|
36
|
+
end
|
37
37
|
let(:events) { Chef::EventDispatch::Dispatcher.new }
|
38
38
|
let(:run_context) { Chef::RunContext.new(node, cookbook_collection, events) }
|
39
39
|
|
@@ -158,7 +158,49 @@ describe Chef::RunContext::CookbookCompiler do
|
|
158
158
|
end
|
159
159
|
|
160
160
|
describe "loading recipes" do
|
161
|
-
#
|
161
|
+
# Additional tests for this behavior are in RunContext's tests
|
162
|
+
|
163
|
+
describe "event dispatch" do
|
164
|
+
let(:recipe) { "dependency1::default" }
|
165
|
+
let(:recipe_path) do
|
166
|
+
File.expand_path("../../../data/run_context/cookbooks/dependency1/recipes/default.rb", __FILE__).tap do |path|
|
167
|
+
path.gsub!(File::SEPARATOR, File::ALT_SEPARATOR) if File::ALT_SEPARATOR
|
168
|
+
end
|
169
|
+
end
|
170
|
+
before do
|
171
|
+
node.run_list(recipe)
|
172
|
+
end
|
173
|
+
subject { compiler.compile_recipes }
|
174
|
+
|
175
|
+
it "dispatches normally" do
|
176
|
+
allow(run_context).to receive(:load_recipe)
|
177
|
+
expect(events).to receive(:recipe_load_start).with(1)
|
178
|
+
expect(events).to receive(:recipe_file_loaded).with(recipe_path, "dependency1::default")
|
179
|
+
expect(events).to receive(:recipe_load_complete).with(no_args)
|
180
|
+
subject
|
181
|
+
end
|
182
|
+
|
183
|
+
it "dispatches when a recipe is not found" do
|
184
|
+
exc = Chef::Exceptions::RecipeNotFound.new
|
185
|
+
allow(run_context).to receive(:load_recipe).and_raise(exc)
|
186
|
+
expect(events).to receive(:recipe_load_start).with(1)
|
187
|
+
expect(events).to_not receive(:recipe_file_loaded)
|
188
|
+
expect(events).to receive(:recipe_not_found).with(exc)
|
189
|
+
expect(events).to_not receive(:recipe_load_complete)
|
190
|
+
expect { subject }.to raise_error(exc)
|
191
|
+
end
|
192
|
+
|
193
|
+
it "dispatches when a recipe has an error" do
|
194
|
+
exc = ArgumentError.new
|
195
|
+
allow(run_context).to receive(:load_recipe).and_raise(exc)
|
196
|
+
expect(events).to receive(:recipe_load_start).with(1)
|
197
|
+
expect(events).to_not receive(:recipe_file_loaded)
|
198
|
+
expect(events).to receive(:recipe_file_load_failed).with(recipe_path, exc, "dependency1::default")
|
199
|
+
expect(events).to_not receive(:recipe_load_complete)
|
200
|
+
expect { subject }.to raise_error(exc)
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
162
204
|
end
|
163
205
|
|
164
206
|
describe "listing cookbook order" do
|
@@ -23,16 +23,16 @@ require "support/lib/library_load_order"
|
|
23
23
|
|
24
24
|
describe Chef::RunContext do
|
25
25
|
let(:chef_repo_path) { File.expand_path(File.join(CHEF_SPEC_DATA, "run_context", "cookbooks")) }
|
26
|
-
let(:cookbook_collection)
|
26
|
+
let(:cookbook_collection) do
|
27
27
|
cl = Chef::CookbookLoader.new(chef_repo_path)
|
28
28
|
cl.load_cookbooks
|
29
29
|
Chef::CookbookCollection.new(cl)
|
30
|
-
|
31
|
-
let(:node)
|
30
|
+
end
|
31
|
+
let(:node) do
|
32
32
|
node = Chef::Node.new
|
33
33
|
node.run_list << "test" << "test::one" << "test::two"
|
34
34
|
node
|
35
|
-
|
35
|
+
end
|
36
36
|
let(:events) { Chef::EventDispatch::Dispatcher.new }
|
37
37
|
let(:run_context) { Chef::RunContext.new(node, cookbook_collection, events) }
|
38
38
|
|
@@ -151,13 +151,13 @@ describe Chef::RunContext do
|
|
151
151
|
|
152
152
|
describe "querying the contents of cookbooks" do
|
153
153
|
let(:chef_repo_path) { File.expand_path(File.join(CHEF_SPEC_DATA, "cookbooks")) }
|
154
|
-
let(:node)
|
154
|
+
let(:node) do
|
155
155
|
node = Chef::Node.new
|
156
156
|
node.normal[:platform] = "ubuntu"
|
157
157
|
node.normal[:platform_version] = "13.04"
|
158
158
|
node.name("testing")
|
159
159
|
node
|
160
|
-
|
160
|
+
end
|
161
161
|
|
162
162
|
it "queries whether a given cookbook has a specific template" do
|
163
163
|
expect(run_context).to have_template_in_cookbook("openldap", "test.erb")
|
@@ -212,11 +212,11 @@ describe Chef::RunContext do
|
|
212
212
|
|
213
213
|
shared_context "notifying resource is a subclass of Chef::Resource" do
|
214
214
|
let(:declared_type) { :alpaca }
|
215
|
-
let(:notifying_resource)
|
215
|
+
let(:notifying_resource) do
|
216
216
|
r = Class.new(Chef::Resource).new("guinea pig")
|
217
217
|
r.declared_type = declared_type
|
218
218
|
r
|
219
|
-
|
219
|
+
end
|
220
220
|
|
221
221
|
it "should be keyed off the resource declared key" do
|
222
222
|
run_context.send(setter, notification)
|
@@ -104,8 +104,8 @@ describe Chef::RunList::RunListExpansion do
|
|
104
104
|
end
|
105
105
|
|
106
106
|
it "produces json tree upon tracing expansion" do
|
107
|
-
|
108
|
-
expect(
|
107
|
+
json_run_list = @expansion.to_json
|
108
|
+
expect(json_run_list).to eq(@json)
|
109
109
|
end
|
110
110
|
|
111
111
|
it "has the ordered list of recipes" do
|
data/spec/unit/runner_spec.rb
CHANGED
@@ -392,12 +392,12 @@ Multiple failures occurred:
|
|
392
392
|
it "should resolve resource references in notifications when resources are defined lazily" do
|
393
393
|
first_resource.action = :nothing
|
394
394
|
|
395
|
-
lazy_resources = lambda
|
395
|
+
lazy_resources = lambda do
|
396
396
|
last_resource = Chef::Resource::Cat.new("peanut", run_context)
|
397
397
|
run_context.resource_collection << last_resource
|
398
398
|
last_resource.notifies(:purr, first_resource.to_s, :delayed)
|
399
399
|
last_resource.action = :purr
|
400
|
-
|
400
|
+
end
|
401
401
|
second_resource = Chef::Resource::RubyBlock.new("myblock", run_context)
|
402
402
|
run_context.resource_collection << second_resource
|
403
403
|
second_resource.block { lazy_resources.call }
|
@@ -27,13 +27,13 @@ describe Chef::Search::Query do
|
|
27
27
|
let(:query_string) { "search/node?q=platform:rhel&sort=X_CHEF_id_CHEF_X%20asc&start=0" }
|
28
28
|
let(:server_url) { "https://api.opscode.com/organizations/opscode/nodes" }
|
29
29
|
let(:args) { { filter_key => filter_hash } }
|
30
|
-
let(:filter_hash)
|
30
|
+
let(:filter_hash) do
|
31
31
|
{
|
32
32
|
"env" => [ "chef_environment" ],
|
33
33
|
"ruby_plat" => %w{languages ruby platform},
|
34
34
|
}
|
35
|
-
|
36
|
-
let(:response)
|
35
|
+
end
|
36
|
+
let(:response) do
|
37
37
|
{
|
38
38
|
"rows" => [
|
39
39
|
{ "url" => "#{server_url}/my-name-is-node",
|
@@ -64,15 +64,15 @@ describe Chef::Search::Query do
|
|
64
64
|
"start" => 0,
|
65
65
|
"total" => 4,
|
66
66
|
}
|
67
|
-
|
68
|
-
let(:response_rows)
|
67
|
+
end
|
68
|
+
let(:response_rows) do
|
69
69
|
[
|
70
70
|
{ "env" => "elysium", "ruby_plat" => "nudibranch" },
|
71
71
|
{ "env" => "hades", "ruby_plat" => "i386-mingw32" },
|
72
72
|
{ "env" => "elysium", "ruby_plat" => "centos" },
|
73
73
|
{ "env" => "moon", "ruby_plat" => "solaris2" },
|
74
74
|
]
|
75
|
-
|
75
|
+
end
|
76
76
|
end
|
77
77
|
|
78
78
|
before(:each) do
|
@@ -86,7 +86,8 @@ describe Chef::Search::Query do
|
|
86
86
|
let(:query_string_with_rows) { "search/node?q=platform:rhel&sort=X_CHEF_id_CHEF_X%20asc&start=0&rows=4" }
|
87
87
|
let(:query_string_continue_with_rows) { "search/node?q=platform:rhel&sort=X_CHEF_id_CHEF_X%20asc&start=4&rows=4" }
|
88
88
|
|
89
|
-
let(:response)
|
89
|
+
let(:response) do
|
90
|
+
{
|
90
91
|
"rows" => [
|
91
92
|
{ "name" => "my-name-is-node",
|
92
93
|
"chef_environment" => "elysium",
|
@@ -147,28 +148,28 @@ describe Chef::Search::Query do
|
|
147
148
|
],
|
148
149
|
"start" => 0,
|
149
150
|
"total" => 4,
|
150
|
-
}
|
151
|
+
} end
|
151
152
|
|
152
|
-
let(:big_response)
|
153
|
+
let(:big_response) do
|
153
154
|
r = response.dup
|
154
155
|
r["total"] = 8
|
155
156
|
r
|
156
|
-
|
157
|
+
end
|
157
158
|
|
158
|
-
let(:big_response_empty)
|
159
|
+
let(:big_response_empty) do
|
159
160
|
{
|
160
161
|
"start" => 0,
|
161
162
|
"total" => 8,
|
162
163
|
"rows" => [],
|
163
164
|
}
|
164
|
-
|
165
|
+
end
|
165
166
|
|
166
|
-
let(:big_response_end)
|
167
|
+
let(:big_response_end) do
|
167
168
|
r = response.dup
|
168
169
|
r["start"] = 4
|
169
170
|
r["total"] = 8
|
170
171
|
r
|
171
|
-
|
172
|
+
end
|
172
173
|
|
173
174
|
it "accepts a type as the first argument" do
|
174
175
|
expect { query.search("node") }.not_to raise_error
|