chef 12.13.37-universal-mingw32 → 12.14.60-universal-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
@@ -22,9 +22,9 @@ describe Chef::Mixin::PowershellOut do
|
|
22
22
|
let(:shell_out_class) { Class.new { include Chef::Mixin::PowershellOut } }
|
23
23
|
subject(:object) { shell_out_class.new }
|
24
24
|
let(:architecture) { "something" }
|
25
|
-
let(:flags)
|
25
|
+
let(:flags) do
|
26
26
|
"-NoLogo -NonInteractive -NoProfile -ExecutionPolicy Unrestricted -InputFormat None"
|
27
|
-
|
27
|
+
end
|
28
28
|
|
29
29
|
describe "#powershell_out" do
|
30
30
|
it "runs a command and returns the shell_out object" do
|
@@ -27,12 +27,12 @@ end
|
|
27
27
|
describe Chef::Mixin::PowershellTypeCoercions do
|
28
28
|
let (:test_class) { Chef::PSTypeTester.new }
|
29
29
|
|
30
|
-
describe
|
30
|
+
describe "#translate_type" do
|
31
31
|
it "single quotes a string" do
|
32
32
|
expect(test_class.translate_type("foo")).to eq("'foo'")
|
33
33
|
end
|
34
34
|
|
35
|
-
["'", '"',
|
35
|
+
["'", '"', "#", "`"].each do |c|
|
36
36
|
it "base64 encodes a string that contains #{c}" do
|
37
37
|
expect(test_class.translate_type("#{c}")).to match(Base64.strict_encode64(c))
|
38
38
|
end
|
@@ -25,7 +25,7 @@ require "spec_helper"
|
|
25
25
|
describe Chef::Mixin::ShellOut do
|
26
26
|
let(:shell_out_class) { Class.new { include Chef::Mixin::ShellOut } }
|
27
27
|
subject(:shell_out_obj) { shell_out_class.new }
|
28
|
-
describe
|
28
|
+
describe "#run_command_compatible_options" do
|
29
29
|
subject { shell_out_obj.run_command_compatible_options(command_args) }
|
30
30
|
let(:command_args) { [ cmd, options ] }
|
31
31
|
let(:cmd) { "echo '#{rand(1000)}'" }
|
@@ -37,7 +37,7 @@ describe Chef::Mixin::XMLEscape do
|
|
37
37
|
end
|
38
38
|
|
39
39
|
it "does not modify ASCII strings" do
|
40
|
-
expect(@escaper.xml_escape(
|
40
|
+
expect(@escaper.xml_escape("foobarbaz!@\#$%^*()")).to eq("foobarbaz!@\#$%^*()")
|
41
41
|
end
|
42
42
|
|
43
43
|
it "converts invalid bytes to asterisks" do
|
@@ -45,10 +45,10 @@ describe Chef::Mixin::XMLEscape do
|
|
45
45
|
end
|
46
46
|
|
47
47
|
it "converts UTF-8 correctly" do
|
48
|
-
expect(@escaper.xml_escape("\xC2\xA9")).to eq(
|
48
|
+
expect(@escaper.xml_escape("\xC2\xA9")).to eq("©")
|
49
49
|
end
|
50
50
|
|
51
51
|
it "converts win 1252 characters correctly" do
|
52
|
-
expect(@escaper.xml_escape("#{0x80.chr}")).to eq(
|
52
|
+
expect(@escaper.xml_escape("#{0x80.chr}")).to eq("€")
|
53
53
|
end
|
54
54
|
end
|
data/spec/unit/node_spec.rb
CHANGED
@@ -1359,10 +1359,10 @@ describe Chef::Node do
|
|
1359
1359
|
end
|
1360
1360
|
|
1361
1361
|
include_examples "to_json equivalent to Chef::JSONCompat.to_json" do
|
1362
|
-
let(:jsonable)
|
1362
|
+
let(:jsonable) do
|
1363
1363
|
node.from_file(File.expand_path("nodes/test.example.com.rb", CHEF_SPEC_DATA))
|
1364
1364
|
node
|
1365
|
-
|
1365
|
+
end
|
1366
1366
|
end
|
1367
1367
|
end
|
1368
1368
|
|
@@ -151,7 +151,7 @@ describe "Chef::Platform#supports_msi?" do
|
|
151
151
|
end
|
152
152
|
end
|
153
153
|
|
154
|
-
describe
|
154
|
+
describe "Chef::Platform#supports_dsc?" do
|
155
155
|
it "returns false if powershell is not present" do
|
156
156
|
node = Chef::Node.new
|
157
157
|
expect(Chef::Platform.supports_dsc?(node)).to be_falsey
|
@@ -174,7 +174,7 @@ describe 'Chef::Platform#supports_dsc?' do
|
|
174
174
|
end
|
175
175
|
end
|
176
176
|
|
177
|
-
describe
|
177
|
+
describe "Chef::Platform#supports_dsc_invoke_resource?" do
|
178
178
|
it "returns false if powershell is not present" do
|
179
179
|
node = Chef::Node.new
|
180
180
|
expect(Chef::Platform.supports_dsc_invoke_resource?(node)).to be_falsey
|
@@ -195,7 +195,7 @@ describe 'Chef::Platform#supports_dsc_invoke_resource?' do
|
|
195
195
|
end
|
196
196
|
end
|
197
197
|
|
198
|
-
describe
|
198
|
+
describe "Chef::Platform#dsc_refresh_mode_disabled?" do
|
199
199
|
let(:node) { instance_double("Chef::Node") }
|
200
200
|
let(:cmdlet) { instance_double("Chef::Util::Powershell::Cmdlet") }
|
201
201
|
let(:cmdlet_result) { instance_double("Chef::Util::Powershell::CmdletResult") }
|
data/spec/unit/property_spec.rb
CHANGED
@@ -1103,18 +1103,18 @@ describe "Chef::Resource.property" do
|
|
1103
1103
|
|
1104
1104
|
context "property_type" do
|
1105
1105
|
it "property_types validate their defaults" do
|
1106
|
-
expect
|
1106
|
+
expect do
|
1107
1107
|
module ::PropertySpecPropertyTypes
|
1108
1108
|
include Chef::Mixin::Properties
|
1109
1109
|
property_type(is: [:a, :b], default: :c)
|
1110
1110
|
end
|
1111
|
-
|
1112
|
-
expect
|
1111
|
+
end.to raise_error(Chef::Exceptions::DeprecatedFeatureError, /Default value :c is invalid for property <property type>./)
|
1112
|
+
expect do
|
1113
1113
|
module ::PropertySpecPropertyTypes
|
1114
1114
|
include Chef::Mixin::Properties
|
1115
1115
|
property_type(is: [:a, :b], default: :b)
|
1116
1116
|
end
|
1117
|
-
|
1117
|
+
end.not_to raise_error
|
1118
1118
|
end
|
1119
1119
|
|
1120
1120
|
context "With property_type ABType (is: [:a, :b]) and CDType (is: [:c, :d])" do
|
@@ -26,12 +26,12 @@ describe Chef::Provider::CookbookFile do
|
|
26
26
|
let(:node) { double("Chef::Node") }
|
27
27
|
let(:events) { double("Chef::Events").as_null_object } # mock all the methods
|
28
28
|
let(:run_context) { double("Chef::RunContext", :node => node, :events => events) }
|
29
|
-
let(:enclosing_directory)
|
29
|
+
let(:enclosing_directory) do
|
30
30
|
canonicalize_path(File.expand_path(File.join(CHEF_SPEC_DATA, "templates")))
|
31
|
-
|
32
|
-
let(:resource_path)
|
31
|
+
end
|
32
|
+
let(:resource_path) do
|
33
33
|
canonicalize_path(File.expand_path(File.join(enclosing_directory, "seattle.txt")))
|
34
|
-
|
34
|
+
end
|
35
35
|
|
36
36
|
# Subject
|
37
37
|
|
@@ -91,9 +91,9 @@ describe Chef::Provider::Cron::Unix do
|
|
91
91
|
let (:exitstatus) { 2 }
|
92
92
|
|
93
93
|
it "should raise an exception if another error occurs" do
|
94
|
-
expect
|
94
|
+
expect do
|
95
95
|
provider.send(:read_crontab)
|
96
|
-
|
96
|
+
end.to raise_error(Chef::Exceptions::Cron, "Error determining state of #{new_resource.name}, exit: 2")
|
97
97
|
end
|
98
98
|
|
99
99
|
it "logs the crontab output to debug" do
|
@@ -130,9 +130,9 @@ describe Chef::Provider::Cron::Unix do
|
|
130
130
|
context "when writing the crontab fails" do
|
131
131
|
let(:exitstatus) { 1 }
|
132
132
|
it "should raise an exception if the command returns non-zero" do
|
133
|
-
expect
|
133
|
+
expect do
|
134
134
|
provider.send(:write_crontab, "Foo")
|
135
|
-
|
135
|
+
end.to raise_error(Chef::Exceptions::Cron, /Error updating state of #{new_resource.name}, exit: 1/)
|
136
136
|
end
|
137
137
|
end
|
138
138
|
end
|
@@ -167,9 +167,9 @@ describe Chef::Provider::Deploy do
|
|
167
167
|
allow(@provider).to receive(:deploy) { raise "Unexpected error" }
|
168
168
|
allow(@provider).to receive(:previous_release_path).and_return("previous_release")
|
169
169
|
expect(@provider).not_to receive(:rollback)
|
170
|
-
expect
|
170
|
+
expect do
|
171
171
|
@provider.run_action(:deploy)
|
172
|
-
|
172
|
+
end.to raise_exception(RuntimeError, "Unexpected error")
|
173
173
|
end
|
174
174
|
|
175
175
|
it "rollbacks to previous release if error happens on deploy" do
|
@@ -178,9 +178,9 @@ describe Chef::Provider::Deploy do
|
|
178
178
|
allow(@provider).to receive(:deploy) { raise "Unexpected error" }
|
179
179
|
allow(@provider).to receive(:previous_release_path).and_return("previous_release")
|
180
180
|
expect(@provider).to receive(:rollback)
|
181
|
-
expect
|
181
|
+
expect do
|
182
182
|
@provider.run_action(:deploy)
|
183
|
-
|
183
|
+
end.to raise_exception(RuntimeError, "Unexpected error")
|
184
184
|
end
|
185
185
|
|
186
186
|
describe "on systems without broken Dir.glob results" do
|
@@ -232,17 +232,17 @@ describe Chef::Provider::Deploy do
|
|
232
232
|
#FileUtils.should_receive(:rm_rf).with("/my/deploy/dir/releases/20040815162342")
|
233
233
|
#@provider.run_action(:rollback)
|
234
234
|
#@provider.release_path.should eql(NIL) -- no check needed since assertions will fail
|
235
|
-
expect
|
235
|
+
expect do
|
236
236
|
@provider.run_action(:rollback)
|
237
|
-
|
237
|
+
end.to raise_exception(RuntimeError, "There is no release to rollback to!")
|
238
238
|
end
|
239
239
|
|
240
240
|
it "an exception is raised when there are no releases" do
|
241
241
|
all_releases = []
|
242
242
|
allow(Dir).to receive(:glob).with("/my/deploy/dir/releases/*").and_return(all_releases)
|
243
|
-
expect
|
243
|
+
expect do
|
244
244
|
@provider.run_action(:rollback)
|
245
|
-
|
245
|
+
end.to raise_exception(RuntimeError, "There is no release to rollback to!")
|
246
246
|
end
|
247
247
|
end
|
248
248
|
end
|
@@ -28,11 +28,11 @@ describe Chef::Provider::DscResource do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
context "when Powershell does not support Invoke-DscResource" do
|
31
|
-
let (:node)
|
31
|
+
let (:node) do
|
32
32
|
node = Chef::Node.new
|
33
33
|
node.automatic[:languages][:powershell][:version] = "4.0"
|
34
34
|
node
|
35
|
-
|
35
|
+
end
|
36
36
|
it "raises a ProviderNotFound exception" do
|
37
37
|
expect(provider).not_to receive(:meta_configuration)
|
38
38
|
expect { provider.run_action(:run) }.to raise_error(
|
@@ -44,11 +44,11 @@ describe Chef::Provider::DscResource do
|
|
44
44
|
|
45
45
|
context "when RefreshMode is not set to Disabled" do
|
46
46
|
context "and the WMF 5 is a preview release" do
|
47
|
-
let (:node)
|
47
|
+
let (:node) do
|
48
48
|
node = Chef::Node.new
|
49
49
|
node.automatic[:languages][:powershell][:version] = "5.0.10018.0"
|
50
50
|
node
|
51
|
-
|
51
|
+
end
|
52
52
|
it "raises an exception" do
|
53
53
|
expect(provider).to receive(:dsc_refresh_mode_disabled?).and_return(false)
|
54
54
|
expect { provider.run_action(:run) }.to raise_error(
|
@@ -56,11 +56,11 @@ describe Chef::Provider::DscResource do
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
context "and the WMF is 5 RTM or newer" do
|
59
|
-
let (:node)
|
59
|
+
let (:node) do
|
60
60
|
node = Chef::Node.new
|
61
61
|
node.automatic[:languages][:powershell][:version] = "5.0.10586.0"
|
62
62
|
node
|
63
|
-
|
63
|
+
end
|
64
64
|
it "does not raises an exception" do
|
65
65
|
expect(provider).to receive(:test_resource)
|
66
66
|
expect(provider).to receive(:set_resource)
|
@@ -72,11 +72,11 @@ describe Chef::Provider::DscResource do
|
|
72
72
|
end
|
73
73
|
|
74
74
|
context "when the LCM supports Invoke-DscResource" do
|
75
|
-
let (:node)
|
75
|
+
let (:node) do
|
76
76
|
node = Chef::Node.new
|
77
77
|
node.automatic[:languages][:powershell][:version] = "5.0.10018.0"
|
78
78
|
node
|
79
|
-
|
79
|
+
end
|
80
80
|
let (:resource_result) { double("CmdletResult", return_value: { "InDesiredState" => true }, stream: "description") }
|
81
81
|
let (:invoke_dsc_resource) { double("cmdlet", run!: resource_result) }
|
82
82
|
let (:store) { double("ResourceStore", find: resource_records) }
|
@@ -153,10 +153,11 @@ describe Chef::Provider::DscResource do
|
|
153
153
|
end
|
154
154
|
|
155
155
|
context "multiple resource are found" do
|
156
|
-
let (:resource_records)
|
156
|
+
let (:resource_records) do
|
157
|
+
[
|
157
158
|
{ "Module" => { "Name" => "ModuleName1" } },
|
158
159
|
{ "Module" => { "Name" => "ModuleName2" } },
|
159
|
-
]
|
160
|
+
] end
|
160
161
|
|
161
162
|
it "raises MultipleDscResourcesFound" do
|
162
163
|
expect { provider.run_action(:run) }.to raise_error(Chef::Exceptions::MultipleDscResourcesFound)
|
@@ -23,11 +23,11 @@ require "spec_helper"
|
|
23
23
|
|
24
24
|
describe Chef::Provider::DscScript do
|
25
25
|
context "when DSC is available" do
|
26
|
-
let (:node)
|
26
|
+
let (:node) do
|
27
27
|
node = Chef::Node.new
|
28
28
|
node.automatic[:languages][:powershell][:version] = "4.0"
|
29
29
|
node
|
30
|
-
|
30
|
+
end
|
31
31
|
let (:events) { Chef::EventDispatch::Dispatcher.new }
|
32
32
|
let (:run_context) { Chef::RunContext.new(node, {}, events) }
|
33
33
|
let (:resource) { Chef::Resource::DscScript.new("script", run_context) }
|
@@ -35,7 +35,7 @@ describe Chef::Provider::DscScript do
|
|
35
35
|
Chef::Provider::DscScript.new(resource, run_context)
|
36
36
|
end
|
37
37
|
|
38
|
-
describe
|
38
|
+
describe "#load_current_resource" do
|
39
39
|
it "describes the resource as converged if there were 0 DSC resources" do
|
40
40
|
allow(provider).to receive(:run_configuration).with(:test).and_return([])
|
41
41
|
provider.load_current_resource
|
@@ -75,7 +75,7 @@ describe Chef::Provider::DscScript do
|
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
|
-
describe
|
78
|
+
describe "#generate_configuration_document" do
|
79
79
|
# I think integration tests should cover these cases
|
80
80
|
|
81
81
|
it "uses configuration_document_from_script_path when a dsc script file is given" do
|
@@ -123,7 +123,7 @@ describe Chef::Provider::DscScript do
|
|
123
123
|
end
|
124
124
|
end
|
125
125
|
|
126
|
-
describe
|
126
|
+
describe "#generate_description" do
|
127
127
|
it "removes the resource name from the beginning of any log line from the LCM" do
|
128
128
|
dsc_resource_info = Chef::Util::DSC::ResourceInfo.new("resourcename", true, ["resourcename doing something", "lastline"])
|
129
129
|
provider.instance_variable_set("@dsc_resources_info", [dsc_resource_info])
|
@@ -156,16 +156,16 @@ describe Chef::Provider::DscScript do
|
|
156
156
|
it "raises an exception for powershell version '#{version}'" do
|
157
157
|
node.automatic[:languages][:powershell][:version] = version
|
158
158
|
|
159
|
-
expect
|
159
|
+
expect do
|
160
160
|
provider.run_action(:run)
|
161
|
-
|
161
|
+
end.to raise_error(Chef::Exceptions::ProviderNotFound)
|
162
162
|
end
|
163
163
|
end
|
164
164
|
|
165
165
|
it "raises an exception if Powershell is not present" do
|
166
|
-
expect
|
166
|
+
expect do
|
167
167
|
provider.run_action(:run)
|
168
|
-
|
168
|
+
end.to raise_error(Chef::Exceptions::ProviderNotFound)
|
169
169
|
end
|
170
170
|
|
171
171
|
end
|
@@ -24,16 +24,16 @@ describe Chef::Provider::Env::Windows, :windows_only do
|
|
24
24
|
let(:run_context) { Chef::RunContext.new(node, {}, events) }
|
25
25
|
|
26
26
|
context "when environment variable is not PATH" do
|
27
|
-
let(:new_resource)
|
27
|
+
let(:new_resource) do
|
28
28
|
new_resource = Chef::Resource::Env.new("CHEF_WINDOWS_ENV_TEST")
|
29
29
|
new_resource.value("foo")
|
30
30
|
new_resource
|
31
|
-
|
32
|
-
let(:provider)
|
31
|
+
end
|
32
|
+
let(:provider) do
|
33
33
|
provider = Chef::Provider::Env::Windows.new(new_resource, run_context)
|
34
34
|
allow(provider).to receive(:env_obj).and_return(double("null object").as_null_object)
|
35
35
|
provider
|
36
|
-
|
36
|
+
end
|
37
37
|
|
38
38
|
describe "action_create" do
|
39
39
|
before do
|
@@ -76,16 +76,16 @@ describe Chef::Provider::Env::Windows, :windows_only do
|
|
76
76
|
describe "for PATH" do
|
77
77
|
let(:system_root) { "%SystemRoot%" }
|
78
78
|
let(:system_root_value) { 'D:\Windows' }
|
79
|
-
let(:new_resource)
|
79
|
+
let(:new_resource) do
|
80
80
|
new_resource = Chef::Resource::Env.new("PATH")
|
81
81
|
new_resource.value(system_root)
|
82
82
|
new_resource
|
83
|
-
|
84
|
-
let(:provider)
|
83
|
+
end
|
84
|
+
let(:provider) do
|
85
85
|
provider = Chef::Provider::Env::Windows.new(new_resource, run_context)
|
86
86
|
allow(provider).to receive(:env_obj).and_return(double("null object").as_null_object)
|
87
87
|
provider
|
88
|
-
|
88
|
+
end
|
89
89
|
|
90
90
|
before do
|
91
91
|
stub_const("ENV", { "PATH" => "" })
|
@@ -28,12 +28,12 @@ describe Chef::Provider::File::Content do
|
|
28
28
|
double("Chef::Provider::File::Resource (current)")
|
29
29
|
end
|
30
30
|
|
31
|
-
let(:enclosing_directory)
|
31
|
+
let(:enclosing_directory) do
|
32
32
|
canonicalize_path(File.expand_path(File.join(CHEF_SPEC_DATA, "templates")))
|
33
|
-
|
34
|
-
let(:resource_path)
|
33
|
+
end
|
34
|
+
let(:resource_path) do
|
35
35
|
canonicalize_path(File.expand_path(File.join(enclosing_directory, "seattle.txt")))
|
36
|
-
|
36
|
+
end
|
37
37
|
|
38
38
|
let(:new_resource) do
|
39
39
|
double("Chef::Provider::File::Resource (new)", :name => "seattle.txt", :path => resource_path)
|
@@ -77,9 +77,9 @@ describe Chef::Provider::File::Content do
|
|
77
77
|
end
|
78
78
|
|
79
79
|
context "when creating a tempfiles in destdir fails" do
|
80
|
-
let(:enclosing_directory)
|
80
|
+
let(:enclosing_directory) do
|
81
81
|
canonicalize_path("/nonexisting/path")
|
82
|
-
|
82
|
+
end
|
83
83
|
|
84
84
|
it "returns a tempfile in the tempdir when :file_deployment_uses_destdir is set to :auto" do
|
85
85
|
Chef::Config[:file_staging_uses_destdir] = :auto
|
@@ -35,12 +35,12 @@ describe Chef::Provider::File do
|
|
35
35
|
let(:node) { double("Chef::Node") }
|
36
36
|
let(:events) { double("Chef::Events").as_null_object } # mock all the methods
|
37
37
|
let(:run_context) { double("Chef::RunContext", :node => node, :events => events) }
|
38
|
-
let(:enclosing_directory)
|
38
|
+
let(:enclosing_directory) do
|
39
39
|
canonicalize_path(File.expand_path(File.join(CHEF_SPEC_DATA, "templates")))
|
40
|
-
|
41
|
-
let(:resource_path)
|
40
|
+
end
|
41
|
+
let(:resource_path) do
|
42
42
|
canonicalize_path(File.expand_path(File.join(enclosing_directory, "seattle.txt")))
|
43
|
-
|
43
|
+
end
|
44
44
|
|
45
45
|
# Subject
|
46
46
|
|