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
@@ -27,11 +27,11 @@ describe Chef::Resource::DpkgPackage, :requires_root, :debian_family_only, arch:
|
|
27
27
|
let(:test1_1) { File.join(apt_data, "chef-integration-test_1.1-1_amd64.deb") }
|
28
28
|
let(:test2_0) { File.join(apt_data, "chef-integration-test2_1.0-1_amd64.deb") }
|
29
29
|
|
30
|
-
let(:run_context)
|
30
|
+
let(:run_context) do
|
31
31
|
node = TEST_NODE.dup
|
32
32
|
events = Chef::EventDispatch::Dispatcher.new
|
33
33
|
Chef::RunContext.new(node, {}, events)
|
34
|
-
|
34
|
+
end
|
35
35
|
|
36
36
|
let(:dpkg_package) { Chef::Resource::DpkgPackage.new(test1_0, run_context) }
|
37
37
|
|
@@ -21,17 +21,17 @@ require "spec_helper"
|
|
21
21
|
describe Chef::Resource::DscResource, :windows_powershell_dsc_only do
|
22
22
|
let(:event_dispatch) { Chef::EventDispatch::Dispatcher.new }
|
23
23
|
|
24
|
-
let(:node)
|
24
|
+
let(:node) do
|
25
25
|
Chef::Node.new.tap do |n|
|
26
26
|
n.consume_external_attrs(OHAI_SYSTEM.data, {})
|
27
27
|
end
|
28
|
-
|
28
|
+
end
|
29
29
|
|
30
30
|
let(:run_context) { Chef::RunContext.new(node, {}, event_dispatch) }
|
31
31
|
|
32
|
-
let(:new_resource)
|
32
|
+
let(:new_resource) do
|
33
33
|
Chef::Resource::DscResource.new("dsc_resource_test", run_context)
|
34
|
-
|
34
|
+
end
|
35
35
|
|
36
36
|
context "when Powershell does not support Invoke-DscResource"
|
37
37
|
context "when Powershell supports Invoke-DscResource" do
|
@@ -77,7 +77,7 @@ describe Chef::Resource::DscResource, :windows_powershell_dsc_only do
|
|
77
77
|
new_resource.run_action(:run)
|
78
78
|
expect(new_resource).to be_updated
|
79
79
|
reresource =
|
80
|
-
|
80
|
+
Chef::Resource::DscResource.new("dsc_resource_retest", run_context)
|
81
81
|
reresource.resource :File
|
82
82
|
reresource.property :Contents, test_text
|
83
83
|
reresource.property :DestinationPath, tmp_file_name
|
@@ -74,7 +74,7 @@ describe Chef::Resource::DscScript, :windows_powershell_dsc_only do
|
|
74
74
|
let(:dsc_env_variable) { "chefenvtest" }
|
75
75
|
let(:dsc_env_value1) { "value1" }
|
76
76
|
let(:env_value2) { "value2" }
|
77
|
-
let(:dsc_test_run_context)
|
77
|
+
let(:dsc_test_run_context) do
|
78
78
|
node = Chef::Node.new
|
79
79
|
node.automatic["platform"] = "windows"
|
80
80
|
node.automatic["platform_version"] = "6.1"
|
@@ -82,11 +82,11 @@ describe Chef::Resource::DscScript, :windows_powershell_dsc_only do
|
|
82
82
|
node.automatic[:languages][:powershell][:version] = "4.0"
|
83
83
|
empty_events = Chef::EventDispatch::Dispatcher.new
|
84
84
|
Chef::RunContext.new(node, {}, empty_events)
|
85
|
-
|
85
|
+
end
|
86
86
|
let(:dsc_test_resource_name) { "DSCTest" }
|
87
|
-
let(:dsc_test_resource_base)
|
87
|
+
let(:dsc_test_resource_base) do
|
88
88
|
Chef::Resource::DscScript.new(dsc_test_resource_name, dsc_test_run_context)
|
89
|
-
|
89
|
+
end
|
90
90
|
let(:test_registry_key) { 'HKEY_LOCAL_MACHINE\Software\Chef\Spec\Functional\Resource\dsc_script_spec' }
|
91
91
|
let(:test_registry_value) { "Registration" }
|
92
92
|
let(:test_registry_data1) { "LL927" }
|
@@ -94,7 +94,8 @@ describe Chef::Resource::DscScript, :windows_powershell_dsc_only do
|
|
94
94
|
let(:reg_key_name_param_name) { "testregkeyname" }
|
95
95
|
let(:reg_key_value_param_name) { "testregvaluename" }
|
96
96
|
let(:registry_embedded_parameters) { "$#{reg_key_name_param_name} = '#{test_registry_key}';$#{reg_key_value_param_name} = '#{test_registry_value}'" }
|
97
|
-
let(:dsc_reg_code)
|
97
|
+
let(:dsc_reg_code) do
|
98
|
+
<<-EOH
|
98
99
|
#{registry_embedded_parameters}
|
99
100
|
Registry "ChefRegKey"
|
100
101
|
{
|
@@ -104,14 +105,15 @@ describe Chef::Resource::DscScript, :windows_powershell_dsc_only do
|
|
104
105
|
Ensure = 'Present'
|
105
106
|
}
|
106
107
|
EOH
|
107
|
-
|
108
|
+
end
|
108
109
|
|
109
110
|
let(:dsc_code) { dsc_reg_code }
|
110
|
-
let(:dsc_reg_script)
|
111
|
+
let(:dsc_reg_script) do
|
112
|
+
<<-EOH
|
111
113
|
param($testregkeyname, $testregvaluename)
|
112
114
|
#{dsc_reg_code}
|
113
115
|
EOH
|
114
|
-
|
116
|
+
end
|
115
117
|
|
116
118
|
let(:dsc_user_prefix) { "dsc" }
|
117
119
|
let(:dsc_user_suffix) { "chefx" }
|
@@ -128,7 +130,8 @@ EOH
|
|
128
130
|
let(:dsc_user_param_code) { "\"$(#{dsc_user_prefix_param_code})_usr_$(#{dsc_user_suffix_param_code})\"" }
|
129
131
|
|
130
132
|
let(:config_flags) { nil }
|
131
|
-
let(:config_params)
|
133
|
+
let(:config_params) do
|
134
|
+
<<-EOH
|
132
135
|
|
133
136
|
[CmdletBinding()]
|
134
137
|
param
|
@@ -137,14 +140,15 @@ EOH
|
|
137
140
|
$#{dsc_user_suffix_param_name}
|
138
141
|
)
|
139
142
|
EOH
|
140
|
-
|
143
|
+
end
|
141
144
|
|
142
145
|
let(:config_param_section) { "" }
|
143
146
|
let(:dsc_user_code) { "'#{dsc_user}'" }
|
144
147
|
let(:dsc_user_prefix_code) { dsc_user_prefix }
|
145
148
|
let(:dsc_user_suffix_code) { dsc_user_suffix }
|
146
149
|
let(:dsc_script_environment_attribute) { nil }
|
147
|
-
let(:dsc_user_resources_code)
|
150
|
+
let(:dsc_user_resources_code) do
|
151
|
+
<<-EOH
|
148
152
|
#{config_param_section}
|
149
153
|
node localhost
|
150
154
|
{
|
@@ -164,9 +168,9 @@ User dsctestusercreate
|
|
164
168
|
}
|
165
169
|
}
|
166
170
|
EOH
|
167
|
-
|
171
|
+
end
|
168
172
|
|
169
|
-
let(:dsc_user_config_data)
|
173
|
+
let(:dsc_user_config_data) do
|
170
174
|
<<-EOH
|
171
175
|
@{
|
172
176
|
AllNodes = @(
|
@@ -178,13 +182,14 @@ EOH
|
|
178
182
|
}
|
179
183
|
|
180
184
|
EOH
|
181
|
-
|
185
|
+
end
|
182
186
|
|
183
187
|
let(:dsc_environment_env_var_name) { "dsc_test_cwd" }
|
184
188
|
let(:dsc_environment_no_fail_not_etc_directory) { "#{ENV['systemroot']}\\system32" }
|
185
189
|
let(:dsc_environment_fail_etc_directory) { "#{ENV['systemroot']}\\system32\\drivers\\etc" }
|
186
190
|
let(:exception_message_signature) { "LL927-LL928" }
|
187
|
-
let(:dsc_environment_config)
|
191
|
+
let(:dsc_environment_config) do
|
192
|
+
<<-EOH
|
188
193
|
if (($pwd.path -eq '#{dsc_environment_fail_etc_directory}') -and (test-path('#{dsc_environment_fail_etc_directory}')))
|
189
194
|
{
|
190
195
|
throw 'Signature #{exception_message_signature}: Purposefully failing because cwd == #{dsc_environment_fail_etc_directory}'
|
@@ -196,21 +201,21 @@ environment "whatsmydir"
|
|
196
201
|
Ensure = 'Present'
|
197
202
|
}
|
198
203
|
EOH
|
199
|
-
|
204
|
+
end
|
200
205
|
|
201
|
-
let(:dsc_config_name)
|
206
|
+
let(:dsc_config_name) do
|
202
207
|
dsc_test_resource_base.name
|
203
|
-
|
204
|
-
let(:dsc_resource_from_code)
|
208
|
+
end
|
209
|
+
let(:dsc_resource_from_code) do
|
205
210
|
dsc_test_resource_base.code(dsc_code)
|
206
211
|
dsc_test_resource_base
|
207
|
-
|
212
|
+
end
|
208
213
|
let(:config_name_value) { dsc_test_resource_base.name }
|
209
214
|
|
210
|
-
let(:dsc_resource_from_path)
|
215
|
+
let(:dsc_resource_from_path) do
|
211
216
|
dsc_test_resource_base.command(create_config_script_from_code(dsc_code, config_name_value))
|
212
217
|
dsc_test_resource_base
|
213
|
-
|
218
|
+
end
|
214
219
|
|
215
220
|
before(:each) do
|
216
221
|
test_key_resource = Chef::Resource::RegistryKey.new(test_registry_key, dsc_test_run_context)
|
@@ -27,17 +27,17 @@ describe Chef::Resource::Env, :windows_only do
|
|
27
27
|
let(:env_value2) { "value2" }
|
28
28
|
|
29
29
|
let(:env_value_expandable) { "%SystemRoot%" }
|
30
|
-
let(:test_run_context)
|
30
|
+
let(:test_run_context) do
|
31
31
|
node = Chef::Node.new
|
32
32
|
node.default["os"] = "windows"
|
33
33
|
node.default["platform"] = "windows"
|
34
34
|
node.default["platform_version"] = "6.1"
|
35
35
|
empty_events = Chef::EventDispatch::Dispatcher.new
|
36
36
|
Chef::RunContext.new(node, {}, empty_events)
|
37
|
-
|
38
|
-
let(:test_resource)
|
37
|
+
end
|
38
|
+
let(:test_resource) do
|
39
39
|
Chef::Resource::Env.new("unknown", test_run_context)
|
40
|
-
|
40
|
+
end
|
41
41
|
|
42
42
|
before(:each) do
|
43
43
|
resource_lower = Chef::Resource::Env.new(chef_env_test_lower_case, test_run_context)
|
@@ -21,11 +21,11 @@ require "functional/resource/base"
|
|
21
21
|
require "timeout"
|
22
22
|
|
23
23
|
describe Chef::Resource::Execute do
|
24
|
-
let(:resource)
|
24
|
+
let(:resource) do
|
25
25
|
resource = Chef::Resource::Execute.new("foo_resource", run_context)
|
26
26
|
resource.command("echo hello")
|
27
27
|
resource
|
28
|
-
|
28
|
+
end
|
29
29
|
|
30
30
|
describe "when guard is ruby block" do
|
31
31
|
it "guard can still run" do
|
@@ -41,10 +41,10 @@ describe Chef::Resource::Execute do
|
|
41
41
|
end
|
42
42
|
|
43
43
|
let(:guard) { "ruby -e 'exit 0'" }
|
44
|
-
let!(:guard_resource)
|
44
|
+
let!(:guard_resource) do
|
45
45
|
interpreter = Chef::GuardInterpreter::ResourceGuardInterpreter.new(resource, guard, nil)
|
46
46
|
interpreter.send(:get_interpreter_resource, resource)
|
47
|
-
|
47
|
+
end
|
48
48
|
|
49
49
|
it "executes the guard and not the regular resource" do
|
50
50
|
expect_any_instance_of(Chef::GuardInterpreter::ResourceGuardInterpreter).to receive(:get_interpreter_resource).and_return(guard_resource)
|
@@ -85,8 +85,14 @@ describe Chef::Resource::Group, :requires_root_or_running_windows, :not_supporte
|
|
85
85
|
end
|
86
86
|
end
|
87
87
|
|
88
|
+
def node
|
89
|
+
node = Chef::Node.new
|
90
|
+
node.consume_external_attrs(ohai.data, {})
|
91
|
+
node
|
92
|
+
end
|
93
|
+
|
88
94
|
def user(username)
|
89
|
-
usr = Chef::Resource
|
95
|
+
usr = Chef::Resource.resource_for_node(:user, node).new(username, run_context)
|
90
96
|
if ohai[:platform_family] == "windows"
|
91
97
|
usr.password("ComplexPass11!")
|
92
98
|
end
|
@@ -99,7 +105,11 @@ describe Chef::Resource::Group, :requires_root_or_running_windows, :not_supporte
|
|
99
105
|
end
|
100
106
|
|
101
107
|
def remove_user(username)
|
102
|
-
|
108
|
+
if ! windows_domain_user?(username)
|
109
|
+
u = user(username)
|
110
|
+
u.manage_home false # jekins hosts throw mail spool file not owned by user if we use manage_home true
|
111
|
+
u.run_action(:remove)
|
112
|
+
end
|
103
113
|
# TODO: User shouldn't exist
|
104
114
|
end
|
105
115
|
|
@@ -282,12 +292,12 @@ describe Chef::Resource::Group, :requires_root_or_running_windows, :not_supporte
|
|
282
292
|
let(:group_name) { "group#{SecureRandom.random_number(9999)}" }
|
283
293
|
let(:included_members) { nil }
|
284
294
|
let(:excluded_members) { nil }
|
285
|
-
let(:group_resource)
|
295
|
+
let(:group_resource) do
|
286
296
|
group = Chef::Resource::Group.new(group_name, run_context)
|
287
297
|
group.members(included_members)
|
288
298
|
group.excluded_members(excluded_members)
|
289
299
|
group
|
290
|
-
|
300
|
+
end
|
291
301
|
|
292
302
|
it "append should be false by default" do
|
293
303
|
expect(group_resource.append).to eq(false)
|
@@ -305,10 +315,11 @@ describe Chef::Resource::Group, :requires_root_or_running_windows, :not_supporte
|
|
305
315
|
end
|
306
316
|
|
307
317
|
describe "when group name is length 256", :windows_only do
|
308
|
-
let!(:group_name)
|
318
|
+
let!(:group_name) do
|
319
|
+
"theoldmanwalkingdownthestreetalwayshadagood\
|
309
320
|
smileonhisfacetheoldmanwalkingdownthestreetalwayshadagoodsmileonhisface\
|
310
321
|
theoldmanwalkingdownthestreetalwayshadagoodsmileonhisfacetheoldmanwalking\
|
311
|
-
downthestreetalwayshadagoodsmileonhisfacetheoldmanwalkingdownthestree"
|
322
|
+
downthestreetalwayshadagoodsmileonhisfacetheoldmanwalkingdownthestree" end
|
312
323
|
|
313
324
|
it "should create a group" do
|
314
325
|
group_resource.run_action(:create)
|
@@ -317,10 +328,11 @@ downthestreetalwayshadagoodsmileonhisfacetheoldmanwalkingdownthestree" }
|
|
317
328
|
end
|
318
329
|
|
319
330
|
describe "when group name length is more than 256", :windows_only do
|
320
|
-
let!(:group_name)
|
331
|
+
let!(:group_name) do
|
332
|
+
"theoldmanwalkingdownthestreetalwayshadagood\
|
321
333
|
smileonhisfacetheoldmanwalkingdownthestreetalwayshadagoodsmileonhisface\
|
322
334
|
theoldmanwalkingdownthestreetalwayshadagoodsmileonhisfacetheoldmanwalking\
|
323
|
-
downthestreetalwayshadagoodsmileonhisfacetheoldmanwalkingdownthestreeQQQQQQ"
|
335
|
+
downthestreetalwayshadagoodsmileonhisfacetheoldmanwalkingdownthestreeQQQQQQ" end
|
324
336
|
|
325
337
|
it "should not create a group" do
|
326
338
|
expect { group_resource.run_action(:create) }.to raise_error(ArgumentError)
|
@@ -388,6 +388,14 @@ describe Chef::Resource::Link do
|
|
388
388
|
symlink(other_dir, target_file)
|
389
389
|
end
|
390
390
|
include_context "create symbolic link succeeds"
|
391
|
+
include_context "delete succeeds"
|
392
|
+
end
|
393
|
+
context "and the link already exists and points at the target" do
|
394
|
+
before do
|
395
|
+
symlink(to, target_file)
|
396
|
+
end
|
397
|
+
include_context "create symbolic link is noop"
|
398
|
+
include_context "delete succeeds"
|
391
399
|
end
|
392
400
|
end
|
393
401
|
context "when the link destination is a symbolic link" do
|
@@ -406,6 +414,19 @@ describe Chef::Resource::Link do
|
|
406
414
|
include_context "create symbolic link succeeds"
|
407
415
|
include_context "delete is noop"
|
408
416
|
end
|
417
|
+
context "and the destination itself has another symbolic link" do
|
418
|
+
context "to a link that exist" do
|
419
|
+
before do
|
420
|
+
symlink(to, target_file)
|
421
|
+
end
|
422
|
+
include_context "create symbolic link is noop"
|
423
|
+
include_context "delete succeeds"
|
424
|
+
end
|
425
|
+
context "to a link that does not exist" do
|
426
|
+
include_context "create symbolic link succeeds"
|
427
|
+
include_context "delete is noop"
|
428
|
+
end
|
429
|
+
end
|
409
430
|
end
|
410
431
|
context "to a file that does not exist" do
|
411
432
|
before(:each) do
|
@@ -418,6 +439,19 @@ describe Chef::Resource::Link do
|
|
418
439
|
include_context "create symbolic link succeeds"
|
419
440
|
include_context "delete is noop"
|
420
441
|
end
|
442
|
+
context "and the destination itself has another symbolic link" do
|
443
|
+
context "to a link that exist" do
|
444
|
+
before do
|
445
|
+
symlink(to, target_file)
|
446
|
+
end
|
447
|
+
include_context "create symbolic link is noop"
|
448
|
+
include_context "delete succeeds"
|
449
|
+
end
|
450
|
+
context "to a link that does not exist" do
|
451
|
+
include_context "create symbolic link succeeds"
|
452
|
+
include_context "delete is noop"
|
453
|
+
end
|
454
|
+
end
|
421
455
|
end
|
422
456
|
end
|
423
457
|
context "when the link destination does not exist" do
|
@@ -19,18 +19,18 @@
|
|
19
19
|
require "spec_helper"
|
20
20
|
|
21
21
|
describe Chef::Resource::Ohai do
|
22
|
-
let(:ohai)
|
22
|
+
let(:ohai) do
|
23
23
|
OHAI_SYSTEM
|
24
|
-
|
24
|
+
end
|
25
25
|
|
26
26
|
let(:node) { Chef::Node.new }
|
27
27
|
|
28
|
-
let(:run_context)
|
28
|
+
let(:run_context) do
|
29
29
|
node.default[:platform] = ohai[:platform]
|
30
30
|
node.default[:platform_version] = ohai[:platform_version]
|
31
31
|
events = Chef::EventDispatch::Dispatcher.new
|
32
32
|
Chef::RunContext.new(node, {}, events)
|
33
|
-
|
33
|
+
end
|
34
34
|
|
35
35
|
shared_examples_for "reloaded :uptime" do
|
36
36
|
it "should reload :uptime" do
|
@@ -51,11 +51,11 @@ describe Chef::Resource::Ohai do
|
|
51
51
|
end
|
52
52
|
|
53
53
|
describe "when reloading only uptime" do
|
54
|
-
let(:ohai_resource)
|
54
|
+
let(:ohai_resource) do
|
55
55
|
r = Chef::Resource::Ohai.new("reload all", run_context)
|
56
56
|
r.plugin("uptime")
|
57
57
|
r
|
58
|
-
|
58
|
+
end
|
59
59
|
|
60
60
|
it_behaves_like "reloaded :uptime"
|
61
61
|
end
|
@@ -80,9 +80,9 @@ describe Chef::Resource::Reboot do
|
|
80
80
|
|
81
81
|
it "should have modified the run context correctly" do
|
82
82
|
# this doesn't actually test the flow of Chef::Client#do_run, unfortunately.
|
83
|
-
expect
|
83
|
+
expect do
|
84
84
|
resource.run_action(:reboot_now)
|
85
|
-
|
85
|
+
end.to throw_symbol(:end_client_run_early)
|
86
86
|
|
87
87
|
test_reboot_action(resource)
|
88
88
|
end
|
@@ -55,11 +55,11 @@ describe Chef::Resource::RemoteFile do
|
|
55
55
|
let(:default_mode) { (0666 & ~File.umask).to_s(8) }
|
56
56
|
|
57
57
|
context "when fetching files over HTTP" do
|
58
|
-
before(:
|
58
|
+
before(:each) do
|
59
59
|
start_tiny_server
|
60
60
|
end
|
61
61
|
|
62
|
-
after(:
|
62
|
+
after(:each) do
|
63
63
|
stop_tiny_server
|
64
64
|
end
|
65
65
|
|
@@ -97,7 +97,7 @@ describe Chef::Resource::RemoteFile do
|
|
97
97
|
|
98
98
|
context "when fetching files over HTTPS" do
|
99
99
|
|
100
|
-
before(:
|
100
|
+
before(:each) do
|
101
101
|
cert_text = File.read(File.expand_path("ssl/chef-rspec.cert", CHEF_SPEC_DATA))
|
102
102
|
cert = OpenSSL::X509::Certificate.new(cert_text)
|
103
103
|
key_text = File.read(File.expand_path("ssl/chef-rspec.key", CHEF_SPEC_DATA))
|
@@ -111,7 +111,7 @@ describe Chef::Resource::RemoteFile do
|
|
111
111
|
start_tiny_server(server_opts)
|
112
112
|
end
|
113
113
|
|
114
|
-
after(:
|
114
|
+
after(:each) do
|
115
115
|
stop_tiny_server
|
116
116
|
end
|
117
117
|
|
@@ -124,11 +124,11 @@ describe Chef::Resource::RemoteFile do
|
|
124
124
|
end
|
125
125
|
|
126
126
|
context "when dealing with content length checking" do
|
127
|
-
before(:
|
127
|
+
before(:each) do
|
128
128
|
start_tiny_server
|
129
129
|
end
|
130
130
|
|
131
|
-
after(:
|
131
|
+
after(:each) do
|
132
132
|
stop_tiny_server
|
133
133
|
end
|
134
134
|
|
@@ -232,7 +232,16 @@ describe Chef::Resource::RemoteFile do
|
|
232
232
|
end
|
233
233
|
|
234
234
|
it "should not create the file" do
|
235
|
-
|
235
|
+
# This can legitimately raise either Errno::EADDRNOTAVAIL or Errno::ECONNREFUSED
|
236
|
+
# in different Ruby versions.
|
237
|
+
old_value = RSpec::Expectations.configuration.on_potential_false_positives
|
238
|
+
RSpec::Expectations.configuration.on_potential_false_positives = :nothing
|
239
|
+
begin
|
240
|
+
expect { resource.run_action(:create) }.to raise_error
|
241
|
+
ensure
|
242
|
+
RSpec::Expectations.configuration.on_potential_false_positives = old_value
|
243
|
+
end
|
244
|
+
|
236
245
|
expect(File).not_to exist(path)
|
237
246
|
end
|
238
247
|
end
|