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
data/spec/unit/dsl/audit_spec.rb
CHANGED
@@ -21,14 +21,14 @@ describe Chef::DSL::Audit do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
it "raises an error when no audit name is given" do
|
24
|
-
expect { auditor.control_group
|
24
|
+
expect { auditor.control_group {} }.to raise_error(Chef::Exceptions::AuditNameMissing)
|
25
25
|
end
|
26
26
|
|
27
27
|
context "audits already populated" do
|
28
28
|
let(:audits) { { "unique" => {} } }
|
29
29
|
|
30
30
|
it "raises an error if the audit name is a duplicate" do
|
31
|
-
expect { auditor.control_group
|
31
|
+
expect { auditor.control_group("unique") {} }.to raise_error(Chef::Exceptions::AuditControlGroupDuplicate)
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
@@ -36,7 +36,7 @@ describe Chef::DSL::Audit do
|
|
36
36
|
let(:auditor) { BadAuditDSLTester.new }
|
37
37
|
|
38
38
|
it "fails because it relies on the recipe DSL existing" do
|
39
|
-
expect { auditor.control_group
|
39
|
+
expect { auditor.control_group("unique") {} }.to raise_error(NoMethodError, /undefined method `cookbook_name'/)
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
@@ -60,14 +60,15 @@ describe Chef::DSL::DataQuery do
|
|
60
60
|
|
61
61
|
let(:item_name) { "item_name" }
|
62
62
|
|
63
|
-
let(:raw_data)
|
63
|
+
let(:raw_data) do
|
64
|
+
{
|
64
65
|
"id" => item_name,
|
65
66
|
"greeting" => "hello",
|
66
67
|
"nested" => {
|
67
68
|
"a1" => [1, 2, 3],
|
68
69
|
"a2" => { "b1" => true },
|
69
70
|
},
|
70
|
-
}
|
71
|
+
} end
|
71
72
|
|
72
73
|
let(:item) do
|
73
74
|
item = Chef::DataBagItem.new
|
@@ -50,17 +50,17 @@ describe Chef::ResourceCollection do
|
|
50
50
|
|
51
51
|
describe "#edit_resource!" do
|
52
52
|
it "raises if nothing is found" do
|
53
|
-
expect
|
53
|
+
expect do
|
54
54
|
recipe.edit_resource!(:zen_master, "monkey") do
|
55
55
|
something true
|
56
56
|
end
|
57
|
-
|
57
|
+
end.to raise_error(Chef::Exceptions::ResourceNotFound)
|
58
58
|
end
|
59
59
|
|
60
60
|
it "raises if nothing is found and no block is given" do
|
61
|
-
expect
|
61
|
+
expect do
|
62
62
|
recipe.edit_resource!(:zen_master, "monkey")
|
63
|
-
|
63
|
+
end.to raise_error(Chef::Exceptions::ResourceNotFound)
|
64
64
|
end
|
65
65
|
|
66
66
|
it "edits the resource if it finds one" do
|
@@ -131,20 +131,20 @@ describe Chef::ResourceCollection do
|
|
131
131
|
|
132
132
|
describe "#find_resource!" do
|
133
133
|
it "raises if nothing is found" do
|
134
|
-
expect
|
134
|
+
expect do
|
135
135
|
recipe.find_resource!(:zen_master, "monkey")
|
136
|
-
|
136
|
+
end.to raise_error(Chef::Exceptions::ResourceNotFound)
|
137
137
|
end
|
138
138
|
|
139
139
|
it "raises if given a block" do
|
140
140
|
resource = recipe.declare_resource(:zen_master, "monkey") do
|
141
141
|
something false
|
142
142
|
end
|
143
|
-
expect
|
143
|
+
expect do
|
144
144
|
recipe.find_resource!(:zen_master, "monkey") do
|
145
145
|
something false
|
146
146
|
end
|
147
|
-
|
147
|
+
end.to raise_error(ArgumentError)
|
148
148
|
end
|
149
149
|
|
150
150
|
it "returns the resource if it finds one" do
|
@@ -221,9 +221,9 @@ describe Chef::ResourceCollection do
|
|
221
221
|
|
222
222
|
describe "#delete_resource!" do
|
223
223
|
it "raises if nothing is found" do
|
224
|
-
expect
|
224
|
+
expect do
|
225
225
|
recipe.delete_resource!(:zen_master, "monkey")
|
226
|
-
|
226
|
+
end.to raise_error(Chef::Exceptions::ResourceNotFound)
|
227
227
|
end
|
228
228
|
|
229
229
|
it "deletes and returns the resource if it finds one" do
|
@@ -39,14 +39,15 @@ describe Chef::EncryptedDataBagItem::CheckEncrypted do
|
|
39
39
|
|
40
40
|
let(:default_secret) { "abc123SECRET" }
|
41
41
|
let(:item_name) { "item_name" }
|
42
|
-
let(:raw_data)
|
42
|
+
let(:raw_data) do
|
43
|
+
{
|
43
44
|
"id" => item_name,
|
44
45
|
"greeting" => "hello",
|
45
46
|
"nested" => {
|
46
47
|
"a1" => [1, 2, 3],
|
47
48
|
"a2" => { "b1" => true },
|
48
49
|
},
|
49
|
-
}
|
50
|
+
} end
|
50
51
|
|
51
52
|
let(:version) { 1 }
|
52
53
|
let(:encoded_data) do
|
@@ -320,11 +320,12 @@ end
|
|
320
320
|
describe Chef::EncryptedDataBagItem do
|
321
321
|
subject { described_class }
|
322
322
|
let(:encrypted_data_bag_item) { subject.new(encoded_data, secret) }
|
323
|
-
let(:plaintext_data)
|
323
|
+
let(:plaintext_data) do
|
324
|
+
{
|
324
325
|
"id" => "item_name",
|
325
326
|
"greeting" => "hello",
|
326
327
|
"nested" => { "a1" => [1, 2, 3], "a2" => { "b1" => true } },
|
327
|
-
}
|
328
|
+
} end
|
328
329
|
let(:secret) { "abc123SECRET" }
|
329
330
|
let(:encoded_data) { subject.encrypt_data_bag_item(plaintext_data, secret) }
|
330
331
|
|
@@ -296,9 +296,9 @@ describe Chef::Environment do
|
|
296
296
|
end
|
297
297
|
|
298
298
|
it "should raise and exception" do
|
299
|
-
expect
|
299
|
+
expect do
|
300
300
|
Chef::Environment.validate_cookbook_version("= 1.2.3.4")
|
301
|
-
|
301
|
+
end.to raise_error Chef::Exceptions::IllegalVersionConstraint,
|
302
302
|
"Environment cookbook version constraints not allowed in chef-solo"
|
303
303
|
end
|
304
304
|
end
|
@@ -450,9 +450,9 @@ describe Chef::Environment do
|
|
450
450
|
it "should raise an error if the configured environment_path is invalid" do
|
451
451
|
expect(File).to receive(:directory?).with(Chef::Config[:environment_path]).and_return(false)
|
452
452
|
|
453
|
-
expect
|
453
|
+
expect do
|
454
454
|
Chef::Environment.load("foo")
|
455
|
-
|
455
|
+
end.to raise_error Chef::Exceptions::InvalidEnvironmentPath, "Environment path '/var/chef/environments' is invalid"
|
456
456
|
end
|
457
457
|
|
458
458
|
it "should raise an error if the file does not exist" do
|
@@ -460,9 +460,9 @@ describe Chef::Environment do
|
|
460
460
|
expect(File).to receive(:exists?).with(File.join(Chef::Config[:environment_path], "foo.json")).and_return(false)
|
461
461
|
expect(File).to receive(:exists?).with(File.join(Chef::Config[:environment_path], "foo.rb")).and_return(false)
|
462
462
|
|
463
|
-
expect
|
463
|
+
expect do
|
464
464
|
Chef::Environment.load("foo")
|
465
|
-
|
465
|
+
end.to raise_error Chef::Exceptions::EnvironmentNotFound, "Environment 'foo' could not be loaded from disk"
|
466
466
|
end
|
467
467
|
end
|
468
468
|
end
|
@@ -52,8 +52,8 @@ describe Chef::EventDispatch::Dispatcher do
|
|
52
52
|
dispatcher.synchronized_cookbook("apache2", cookbook_version)
|
53
53
|
|
54
54
|
exception = StandardError.new("foo")
|
55
|
-
expect(event_sink).to receive(:recipe_file_load_failed).with("/path/to/file.rb", exception)
|
56
|
-
dispatcher.recipe_file_load_failed("/path/to/file.rb", exception)
|
55
|
+
expect(event_sink).to receive(:recipe_file_load_failed).with("/path/to/file.rb", exception, "myrecipe")
|
56
|
+
dispatcher.recipe_file_load_failed("/path/to/file.rb", exception, "myrecipe")
|
57
57
|
end
|
58
58
|
|
59
59
|
context "when an event sink has fewer arguments for an event" do
|
@@ -43,7 +43,7 @@ describe Chef::FileAccessControl do
|
|
43
43
|
end
|
44
44
|
|
45
45
|
describe "class methods" do
|
46
|
-
it
|
46
|
+
it "responds to #writable?" do
|
47
47
|
expect(Chef::FileAccessControl).to respond_to(:writable?)
|
48
48
|
end
|
49
49
|
end
|
@@ -67,7 +67,7 @@ describe Chef::FileAccessControl do
|
|
67
67
|
|
68
68
|
it "raises a Chef::Exceptions::UserIDNotFound error when Etc can't find the user's name" do
|
69
69
|
expect(Etc).to receive(:getpwnam).with("toor").and_raise(ArgumentError)
|
70
|
-
expect { @fac.target_uid
|
70
|
+
expect { @fac.target_uid; @provider_requirements.run(:create) }.to raise_error(Chef::Exceptions::UserIDNotFound, "cannot determine user id for 'toor', does the user exist on this system?")
|
71
71
|
end
|
72
72
|
|
73
73
|
it "does not attempt to resolve the uid if the user is not specified" do
|
@@ -84,7 +84,7 @@ describe Chef::FileAccessControl do
|
|
84
84
|
|
85
85
|
it "raises an ArgumentError if the resource's owner is set to something wack" do
|
86
86
|
@resource.instance_variable_set(:@owner, :diaf)
|
87
|
-
expect { @fac.target_uid
|
87
|
+
expect { @fac.target_uid; @provider_requirements.run(:create) }.to raise_error(ArgumentError)
|
88
88
|
end
|
89
89
|
|
90
90
|
it "uses the resource's uid for the target uid when the resource's owner is specified by an integer" do
|
@@ -19,11 +19,11 @@
|
|
19
19
|
require "spec_helper"
|
20
20
|
|
21
21
|
describe Chef::FileContentManagement::Tempfile do
|
22
|
-
let(:resource)
|
22
|
+
let(:resource) do
|
23
23
|
r = Chef::Resource::File.new("new_file")
|
24
24
|
r.path "/foo/bar/new_file"
|
25
25
|
r
|
26
|
-
|
26
|
+
end
|
27
27
|
|
28
28
|
subject { described_class.new(resource) }
|
29
29
|
|
@@ -32,13 +32,13 @@ describe Chef::Formatters::APIErrorFormatting do
|
|
32
32
|
let(:min_version) { "2" }
|
33
33
|
let(:max_version) { "5" }
|
34
34
|
let(:request_version) { "30" }
|
35
|
-
let(:return_hash)
|
35
|
+
let(:return_hash) do
|
36
36
|
{
|
37
37
|
"min_version" => min_version,
|
38
38
|
"max_version" => max_version,
|
39
39
|
"request_version" => request_version,
|
40
40
|
}
|
41
|
-
|
41
|
+
end
|
42
42
|
|
43
43
|
before do
|
44
44
|
# mock out the header
|
@@ -105,9 +105,9 @@ describe Chef::GuardInterpreter::ResourceGuardInterpreter do
|
|
105
105
|
parent_resource
|
106
106
|
end
|
107
107
|
|
108
|
-
let(:shell_out)
|
108
|
+
let(:shell_out) do
|
109
109
|
instance_double(Mixlib::ShellOut, :live_stream => true, :run_command => true, :error! => nil)
|
110
|
-
|
110
|
+
end
|
111
111
|
|
112
112
|
before do
|
113
113
|
# TODO for some reason Windows is failing on executing a ruby script
|
@@ -29,6 +29,26 @@ describe "HTTP Connection" do
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
+
describe "#initialize" do
|
33
|
+
it "calls .start when doing keepalives" do
|
34
|
+
basic_client = Chef::HTTP::BasicClient.new(uri, keepalives: true)
|
35
|
+
expect(basic_client).to receive(:configure_ssl)
|
36
|
+
net_http_mock = instance_double(Net::HTTP, proxy_address: nil, "proxy_port=" => nil, "read_timeout=" => nil, "open_timeout=" => nil)
|
37
|
+
expect(net_http_mock).to receive(:start).and_return(net_http_mock)
|
38
|
+
expect(Net::HTTP).to receive(:new).and_return(net_http_mock)
|
39
|
+
expect(basic_client.http_client).to eql(net_http_mock)
|
40
|
+
end
|
41
|
+
|
42
|
+
it "does not call .start when not doing keepalives" do
|
43
|
+
basic_client = Chef::HTTP::BasicClient.new(uri)
|
44
|
+
expect(basic_client).to receive(:configure_ssl)
|
45
|
+
net_http_mock = instance_double(Net::HTTP, proxy_address: nil, "proxy_port=" => nil, "read_timeout=" => nil, "open_timeout=" => nil)
|
46
|
+
expect(net_http_mock).not_to receive(:start)
|
47
|
+
expect(Net::HTTP).to receive(:new).and_return(net_http_mock)
|
48
|
+
expect(basic_client.http_client).to eql(net_http_mock)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
32
52
|
describe "#build_http_client" do
|
33
53
|
it "should build an http client" do
|
34
54
|
subject.build_http_client
|
@@ -37,25 +37,25 @@ describe Chef::HTTP::ValidateContentLength do
|
|
37
37
|
let(:content_length_value) { 23 }
|
38
38
|
let(:streaming_length) { 23 }
|
39
39
|
let(:response_body) { "Thanks for checking in." }
|
40
|
-
let(:response_headers)
|
40
|
+
let(:response_headers) do
|
41
41
|
{
|
42
42
|
"content-length" => content_length_value,
|
43
43
|
}
|
44
|
-
|
44
|
+
end
|
45
45
|
|
46
|
-
let(:response)
|
46
|
+
let(:response) do
|
47
47
|
m = double("HttpResponse", :body => response_body)
|
48
48
|
allow(m).to receive(:[]) do |key|
|
49
49
|
response_headers[key]
|
50
50
|
end
|
51
51
|
|
52
52
|
m
|
53
|
-
|
53
|
+
end
|
54
54
|
|
55
|
-
let(:middleware)
|
55
|
+
let(:middleware) do
|
56
56
|
client = TestClient.new(url)
|
57
57
|
client.middlewares[0]
|
58
|
-
|
58
|
+
end
|
59
59
|
|
60
60
|
def run_content_length_validation
|
61
61
|
stream_handler = middleware.stream_response_handler(response)
|
@@ -169,12 +169,12 @@ describe Chef::HTTP::ValidateContentLength do
|
|
169
169
|
end
|
170
170
|
|
171
171
|
describe "when Transfer-Encoding & Content-Length is set" do
|
172
|
-
let(:response_headers)
|
172
|
+
let(:response_headers) do
|
173
173
|
{
|
174
174
|
"content-length" => content_length_value,
|
175
175
|
"transfer-encoding" => "chunked",
|
176
176
|
}
|
177
|
-
|
177
|
+
end
|
178
178
|
|
179
179
|
%w{direct streaming}.each do |req_type|
|
180
180
|
describe "when running #{req_type} request" do
|
data/spec/unit/http_spec.rb
CHANGED
@@ -43,6 +43,20 @@ describe Chef::HTTP do
|
|
43
43
|
|
44
44
|
end
|
45
45
|
|
46
|
+
describe "#intialize" do
|
47
|
+
it "accepts a keepalive option and passes it to the http_client" do
|
48
|
+
http = Chef::HTTP.new(uri, keepalives: true)
|
49
|
+
expect(Chef::HTTP::BasicClient).to receive(:new).with(uri, ssl_policy: Chef::HTTP::APISSLPolicy, keepalives: true).and_call_original
|
50
|
+
expect(http.http_client).to be_a_kind_of(Chef::HTTP::BasicClient)
|
51
|
+
end
|
52
|
+
|
53
|
+
it "the default is not to use keepalives" do
|
54
|
+
http = Chef::HTTP.new(uri)
|
55
|
+
expect(Chef::HTTP::BasicClient).to receive(:new).with(uri, ssl_policy: Chef::HTTP::APISSLPolicy, keepalives: false).and_call_original
|
56
|
+
expect(http.http_client).to be_a_kind_of(Chef::HTTP::BasicClient)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
46
60
|
describe "create_url" do
|
47
61
|
|
48
62
|
it "should return a correctly formatted url 1/3 CHEF-5261" do
|
@@ -29,10 +29,10 @@ describe Chef::Knife::Bootstrap::ChefVaultHandler do
|
|
29
29
|
|
30
30
|
let(:client) { Chef::ApiClient.new }
|
31
31
|
|
32
|
-
let(:chef_vault_handler)
|
32
|
+
let(:chef_vault_handler) do
|
33
33
|
chef_vault_handler = Chef::Knife::Bootstrap::ChefVaultHandler.new(knife_config: knife_config, ui: ui)
|
34
34
|
chef_vault_handler
|
35
|
-
|
35
|
+
end
|
36
36
|
|
37
37
|
context "when there's no vault option" do
|
38
38
|
it "should report its not doing anything" do
|
@@ -33,12 +33,12 @@ describe Chef::Knife::Bootstrap::ClientBuilder do
|
|
33
33
|
|
34
34
|
let(:rest) { double("Chef::ServerAPI") }
|
35
35
|
|
36
|
-
let(:client_builder)
|
36
|
+
let(:client_builder) do
|
37
37
|
client_builder = Chef::Knife::Bootstrap::ClientBuilder.new(knife_config: knife_config, chef_config: chef_config, ui: ui)
|
38
38
|
allow(client_builder).to receive(:rest).and_return(rest)
|
39
39
|
allow(client_builder).to receive(:node_name).and_return(node_name)
|
40
40
|
client_builder
|
41
|
-
|
41
|
+
end
|
42
42
|
|
43
43
|
context "#sanity_check!" do
|
44
44
|
let(:response_404) { OpenStruct.new(:code => "404") }
|
@@ -236,11 +236,11 @@ describe Chef::Knife::Bootstrap do
|
|
236
236
|
end
|
237
237
|
|
238
238
|
context "with bootstrap_attribute options" do
|
239
|
-
let(:jsonfile)
|
239
|
+
let(:jsonfile) do
|
240
240
|
file = Tempfile.new (["node", ".json"])
|
241
241
|
File.open(file.path, "w") { |f| f.puts '{"foo":{"bar":"baz"}}' }
|
242
242
|
file
|
243
|
-
|
243
|
+
end
|
244
244
|
|
245
245
|
it "should have foo => {bar => baz} in the first_boot from cli" do
|
246
246
|
knife.parse_options(["-j", '{"foo":{"bar":"baz"}}'])
|
@@ -478,8 +478,9 @@ describe Chef::Knife::Bootstrap do
|
|
478
478
|
end
|
479
479
|
|
480
480
|
context "when client_d_dir is set" do
|
481
|
-
let(:client_d_dir)
|
482
|
-
|
481
|
+
let(:client_d_dir) do
|
482
|
+
Chef::Util::PathHelper.cleanpath(
|
483
|
+
File.join(File.dirname(__FILE__), "../../data/client.d_00")) end
|
483
484
|
|
484
485
|
it "creates /etc/chef/client.d" do
|
485
486
|
expect(rendered_template).to match("mkdir -p /etc/chef/client\.d")
|
@@ -497,8 +498,9 @@ describe Chef::Knife::Bootstrap do
|
|
497
498
|
end
|
498
499
|
|
499
500
|
context "a nested directory structure" do
|
500
|
-
let(:client_d_dir)
|
501
|
-
|
501
|
+
let(:client_d_dir) do
|
502
|
+
Chef::Util::PathHelper.cleanpath(
|
503
|
+
File.join(File.dirname(__FILE__), "../../data/client.d_01")) end
|
502
504
|
it "creates a file foo/bar.rb" do
|
503
505
|
expect(rendered_template).to match("cat > /etc/chef/client.d/foo/bar.rb <<'EOP'")
|
504
506
|
expect(rendered_template).to match("1 / 0")
|
@@ -24,7 +24,7 @@ describe Chef::Knife::ClientBulkDelete do
|
|
24
24
|
let(:stderr_io) { StringIO.new }
|
25
25
|
let(:stderr) { stderr_io.string }
|
26
26
|
|
27
|
-
let(:knife)
|
27
|
+
let(:knife) do
|
28
28
|
k = Chef::Knife::ClientBulkDelete.new
|
29
29
|
k.name_args = name_args
|
30
30
|
k.config = option_args
|
@@ -33,7 +33,7 @@ describe Chef::Knife::ClientBulkDelete do
|
|
33
33
|
allow(k.ui).to receive(:confirm).and_return(knife_confirm)
|
34
34
|
allow(k.ui).to receive(:confirm_without_exit).and_return(knife_confirm)
|
35
35
|
k
|
36
|
-
|
36
|
+
end
|
37
37
|
|
38
38
|
let(:name_args) { [ "." ] }
|
39
39
|
let(:option_args) { {} }
|
@@ -41,7 +41,7 @@ describe Chef::Knife::ClientBulkDelete do
|
|
41
41
|
let(:knife_confirm) { true }
|
42
42
|
|
43
43
|
let(:nonvalidator_client_names) { %w{tim dan stephen} }
|
44
|
-
let(:nonvalidator_clients)
|
44
|
+
let(:nonvalidator_clients) do
|
45
45
|
clients = Hash.new
|
46
46
|
|
47
47
|
nonvalidator_client_names.each do |client_name|
|
@@ -52,10 +52,10 @@ describe Chef::Knife::ClientBulkDelete do
|
|
52
52
|
end
|
53
53
|
|
54
54
|
clients
|
55
|
-
|
55
|
+
end
|
56
56
|
|
57
57
|
let(:validator_client_names) { %w{myorg-validator} }
|
58
|
-
let(:validator_clients)
|
58
|
+
let(:validator_clients) do
|
59
59
|
clients = Hash.new
|
60
60
|
|
61
61
|
validator_client_names.each do |validator_client_name|
|
@@ -67,12 +67,12 @@ describe Chef::Knife::ClientBulkDelete do
|
|
67
67
|
end
|
68
68
|
|
69
69
|
clients
|
70
|
-
|
70
|
+
end
|
71
71
|
|
72
72
|
let(:client_names) { nonvalidator_client_names + validator_client_names }
|
73
|
-
let(:clients)
|
73
|
+
let(:clients) do
|
74
74
|
nonvalidator_clients.merge(validator_clients)
|
75
|
-
|
75
|
+
end
|
76
76
|
|
77
77
|
before(:each) do
|
78
78
|
allow(Chef::ApiClientV1).to receive(:list).and_return(clients)
|