chef 14.14.29 → 14.15.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/README.md +18 -7
- data/Rakefile +7 -4
- data/chef.gemspec +1 -1
- data/lib/chef/knife/ssh.rb +6 -0
- data/lib/chef/provider/ifconfig.rb +14 -5
- data/lib/chef/provider/windows_task.rb +9 -5
- data/lib/chef/resource/kernel_module.rb +61 -0
- data/lib/chef/resource/windows_task.rb +4 -0
- data/lib/chef/version.rb +1 -1
- data/lib/chef/win32/system.rb +0 -0
- data/spec/data/cookbooks/openldap/metadata.rb +2 -2
- data/spec/data/metadata/quick_start/metadata.rb +2 -7
- data/spec/functional/audit/runner_spec.rb +1 -1
- data/spec/functional/dsl/reboot_pending_spec.rb +7 -25
- data/spec/functional/event_loggers/windows_eventlog_spec.rb +6 -4
- data/spec/functional/file_content_management/deploy_strategies_spec.rb +21 -21
- data/spec/functional/knife/exec_spec.rb +1 -1
- data/spec/functional/knife/ssh_spec.rb +3 -3
- data/spec/functional/mixin/user_context_spec.rb +3 -1
- data/spec/functional/rebooter_spec.rb +1 -1
- data/spec/functional/resource/aix_service_spec.rb +1 -1
- data/spec/functional/resource/aixinit_service_spec.rb +1 -1
- data/spec/functional/resource/apt_package_spec.rb +1 -1
- data/spec/functional/resource/chocolatey_package_spec.rb +2 -2
- data/spec/functional/resource/cookbook_file_spec.rb +1 -3
- data/spec/functional/resource/cron_spec.rb +4 -3
- data/spec/functional/resource/dpkg_package_spec.rb +4 -4
- data/spec/functional/resource/dsc_resource_spec.rb +2 -1
- data/spec/functional/resource/dsc_script_spec.rb +16 -20
- data/spec/functional/resource/execute_spec.rb +2 -2
- data/spec/functional/resource/git_spec.rb +6 -6
- data/spec/functional/resource/group_spec.rb +8 -6
- data/spec/functional/resource/ifconfig_spec.rb +3 -5
- data/spec/functional/resource/link_spec.rb +2 -2
- data/spec/functional/resource/mount_spec.rb +3 -7
- data/spec/functional/resource/powershell_script_spec.rb +9 -8
- data/spec/functional/resource/reboot_spec.rb +1 -1
- data/spec/functional/resource/remote_file_spec.rb +2 -2
- data/spec/functional/resource/template_spec.rb +1 -1
- data/spec/functional/resource/user/windows_spec.rb +2 -2
- data/spec/functional/resource/windows_certificate_spec.rb +3 -3
- data/spec/functional/resource/windows_service_spec.rb +3 -3
- data/spec/functional/resource/windows_task_spec.rb +51 -0
- data/spec/functional/run_lock_spec.rb +10 -3
- data/spec/functional/shell_spec.rb +1 -1
- data/spec/functional/util/powershell/cmdlet_spec.rb +1 -1
- data/spec/functional/version_spec.rb +1 -1
- data/spec/functional/win32/security_spec.rb +12 -7
- data/spec/functional/win32/service_manager_spec.rb +1 -1
- data/spec/functional/win32/version_info_spec.rb +4 -4
- data/spec/integration/client/client_spec.rb +114 -132
- data/spec/integration/client/exit_code_spec.rb +8 -8
- data/spec/integration/client/ipv6_spec.rb +5 -5
- data/spec/integration/knife/chef_fs_data_store_spec.rb +38 -38
- data/spec/integration/knife/chef_repo_path_spec.rb +42 -42
- data/spec/integration/knife/chef_repository_file_system_spec.rb +9 -9
- data/spec/integration/knife/chefignore_spec.rb +13 -13
- data/spec/integration/knife/client_bulk_delete_spec.rb +8 -8
- data/spec/integration/knife/client_create_spec.rb +1 -1
- data/spec/integration/knife/client_delete_spec.rb +4 -4
- data/spec/integration/knife/client_key_delete_spec.rb +1 -1
- data/spec/integration/knife/client_key_list_spec.rb +1 -1
- data/spec/integration/knife/client_list_spec.rb +1 -1
- data/spec/integration/knife/common_options_spec.rb +1 -1
- data/spec/integration/knife/config_get_spec.rb +1 -1
- data/spec/integration/knife/config_list_profiles_spec.rb +2 -1
- data/spec/integration/knife/cookbook_api_ipv6_spec.rb +3 -3
- data/spec/integration/knife/cookbook_bulk_delete_spec.rb +3 -3
- data/spec/integration/knife/cookbook_download_spec.rb +4 -4
- data/spec/integration/knife/cookbook_list_spec.rb +2 -2
- data/spec/integration/knife/cookbook_show_spec.rb +3 -3
- data/spec/integration/knife/cookbook_upload_spec.rb +6 -6
- data/spec/integration/knife/data_bag_delete_spec.rb +4 -4
- data/spec/integration/knife/data_bag_from_file_spec.rb +7 -7
- data/spec/integration/knife/data_bag_list_spec.rb +1 -1
- data/spec/integration/knife/delete_spec.rb +37 -37
- data/spec/integration/knife/deps_spec.rb +23 -23
- data/spec/integration/knife/diff_spec.rb +23 -23
- data/spec/integration/knife/download_spec.rb +79 -79
- data/spec/integration/knife/environment_compare_spec.rb +3 -3
- data/spec/integration/knife/environment_from_file_spec.rb +6 -6
- data/spec/integration/knife/environment_list_spec.rb +1 -1
- data/spec/integration/knife/environment_show_spec.rb +4 -4
- data/spec/integration/knife/list_spec.rb +25 -25
- data/spec/integration/knife/node_bulk_delete_spec.rb +2 -2
- data/spec/integration/knife/node_delete_spec.rb +2 -2
- data/spec/integration/knife/node_environment_set_spec.rb +1 -1
- data/spec/integration/knife/node_from_file_spec.rb +2 -2
- data/spec/integration/knife/node_list_spec.rb +1 -1
- data/spec/integration/knife/raw_spec.rb +12 -12
- data/spec/integration/knife/redirection_spec.rb +1 -1
- data/spec/integration/knife/role_bulk_delete_spec.rb +2 -2
- data/spec/integration/knife/role_delete_spec.rb +2 -2
- data/spec/integration/knife/role_from_file_spec.rb +5 -5
- data/spec/integration/knife/role_list_spec.rb +1 -1
- data/spec/integration/knife/role_show_spec.rb +1 -1
- data/spec/integration/knife/show_spec.rb +10 -10
- data/spec/integration/knife/upload_spec.rb +85 -85
- data/spec/integration/recipes/accumulator_spec.rb +4 -4
- data/spec/integration/recipes/lwrp_inline_resources_spec.rb +6 -6
- data/spec/integration/recipes/lwrp_spec.rb +6 -6
- data/spec/integration/recipes/notifies_spec.rb +45 -45
- data/spec/integration/recipes/notifying_block_spec.rb +4 -4
- data/spec/integration/recipes/provider_choice.rb +1 -2
- data/spec/integration/recipes/recipe_dsl_spec.rb +9 -9
- data/spec/integration/recipes/remote_directory.rb +2 -2
- data/spec/integration/recipes/resource_action_spec.rb +1 -1
- data/spec/integration/recipes/resource_converge_if_changed_spec.rb +19 -19
- data/spec/integration/solo/solo_spec.rb +29 -29
- data/spec/scripts/ssl-serve.rb +1 -1
- data/spec/spec_helper.rb +11 -14
- data/spec/stress/win32/security_spec.rb +1 -1
- data/spec/support/lib/chef/resource/zen_follower.rb +1 -1
- data/spec/support/lib/chef/resource/zen_master.rb +1 -1
- data/spec/support/mock/platform.rb +2 -2
- data/spec/support/platform_helpers.rb +12 -3
- data/spec/support/platforms/win32/spec_service.rb +6 -10
- data/spec/support/shared/context/client.rb +2 -1
- data/spec/support/shared/functional/execute_resource.rb +4 -4
- data/spec/support/shared/functional/file_resource.rb +1 -3
- data/spec/support/shared/functional/http.rb +20 -44
- data/spec/support/shared/functional/securable_resource.rb +4 -8
- data/spec/support/shared/functional/win32_service.rb +1 -1
- data/spec/support/shared/functional/windows_script.rb +2 -1
- data/spec/support/shared/integration/app_server_support.rb +3 -4
- data/spec/support/shared/integration/integration_helper.rb +1 -0
- data/spec/support/shared/integration/knife_support.rb +5 -5
- data/spec/support/shared/unit/application_dot_d.rb +10 -4
- data/spec/support/shared/unit/file_system_support.rb +3 -2
- data/spec/support/shared/unit/platform_introspector.rb +12 -12
- data/spec/support/shared/unit/provider/file.rb +1 -1
- data/spec/support/shared/unit/script_resource.rb +1 -1
- data/spec/support/shared/unit/windows_script_resource.rb +1 -1
- data/spec/tiny_server.rb +1 -1
- data/spec/unit/api_client/registration_spec.rb +1 -1
- data/spec/unit/api_client_spec.rb +5 -5
- data/spec/unit/api_client_v1_spec.rb +6 -6
- data/spec/unit/application/client_spec.rb +8 -8
- data/spec/unit/application/exit_code_spec.rb +3 -2
- data/spec/unit/application/knife_spec.rb +1 -2
- data/spec/unit/audit/audit_event_proxy_spec.rb +14 -7
- data/spec/unit/audit/audit_reporter_spec.rb +20 -11
- data/spec/unit/audit/control_group_data_spec.rb +17 -12
- data/spec/unit/chef_fs/config_spec.rb +3 -3
- data/spec/unit/chef_fs/file_system/repository/directory_spec.rb +1 -1
- data/spec/unit/chef_fs/parallelizer.rb +1 -1
- data/spec/unit/client_spec.rb +3 -3
- data/spec/unit/config_fetcher_spec.rb +1 -1
- data/spec/unit/cookbook/metadata_spec.rb +13 -13
- data/spec/unit/cookbook/synchronizer_spec.rb +6 -6
- data/spec/unit/cookbook_loader_spec.rb +17 -17
- data/spec/unit/cookbook_manifest_spec.rb +9 -9
- data/spec/unit/cookbook_site_streaming_uploader_spec.rb +1 -2
- data/spec/unit/cookbook_uploader_spec.rb +2 -2
- data/spec/unit/cookbook_version_file_specificity_spec.rb +9 -9
- data/spec/unit/cookbook_version_spec.rb +2 -2
- data/spec/unit/data_bag_item_spec.rb +7 -7
- data/spec/unit/data_bag_spec.rb +1 -1
- data/spec/unit/data_collector_spec.rb +23 -23
- data/spec/unit/decorator_spec.rb +2 -2
- data/spec/unit/deprecated_spec.rb +2 -2
- data/spec/unit/dsl/data_query_spec.rb +3 -2
- data/spec/unit/dsl/declare_resource_spec.rb +1 -1
- data/spec/unit/dsl/platform_introspection_spec.rb +2 -2
- data/spec/unit/encrypted_data_bag_item/check_encrypted_spec.rb +2 -1
- data/spec/unit/encrypted_data_bag_item_spec.rb +2 -1
- data/spec/unit/environment_spec.rb +13 -13
- data/spec/unit/event_dispatch/dsl_spec.rb +1 -1
- data/spec/unit/file_content_management/deploy/mv_unix_spec.rb +3 -3
- data/spec/unit/file_content_management/deploy/mv_windows_spec.rb +2 -2
- data/spec/unit/formatters/error_inspectors/resource_failure_inspector_spec.rb +3 -3
- data/spec/unit/guard_interpreter/resource_guard_interpreter_spec.rb +1 -1
- data/spec/unit/http/authenticator_spec.rb +4 -3
- data/spec/unit/http/json_input_spec.rb +1 -1
- data/spec/unit/http/socketless_chef_zero_client_spec.rb +15 -15
- data/spec/unit/key_spec.rb +8 -8
- data/spec/unit/knife/bootstrap_spec.rb +14 -10
- data/spec/unit/knife/client_bulk_delete_spec.rb +4 -4
- data/spec/unit/knife/configure_client_spec.rb +1 -1
- data/spec/unit/knife/configure_spec.rb +1 -1
- data/spec/unit/knife/cookbook_bulk_delete_spec.rb +1 -1
- data/spec/unit/knife/cookbook_delete_spec.rb +2 -2
- data/spec/unit/knife/cookbook_download_spec.rb +2 -2
- data/spec/unit/knife/cookbook_metadata_spec.rb +4 -4
- data/spec/unit/knife/cookbook_upload_spec.rb +7 -5
- data/spec/unit/knife/core/bootstrap_context_spec.rb +1 -1
- data/spec/unit/knife/core/cookbook_scm_repo_spec.rb +2 -2
- data/spec/unit/knife/core/gem_glob_loader_spec.rb +4 -4
- data/spec/unit/knife/core/hashed_command_loader_spec.rb +4 -2
- data/spec/unit/knife/core/node_editor_spec.rb +12 -12
- data/spec/unit/knife/core/ui_spec.rb +11 -11
- data/spec/unit/knife/data_bag_from_file_spec.rb +2 -1
- data/spec/unit/knife/data_bag_show_spec.rb +2 -1
- data/spec/unit/knife/key_create_spec.rb +1 -1
- data/spec/unit/knife/key_delete_spec.rb +3 -3
- data/spec/unit/knife/key_edit_spec.rb +4 -4
- data/spec/unit/knife/key_list_spec.rb +1 -1
- data/spec/unit/knife/key_show_spec.rb +3 -3
- data/spec/unit/knife/node_bulk_delete_spec.rb +3 -3
- data/spec/unit/knife/node_delete_spec.rb +2 -2
- data/spec/unit/knife/node_edit_spec.rb +1 -1
- data/spec/unit/knife/node_environment_set_spec.rb +1 -1
- data/spec/unit/knife/node_from_file_spec.rb +1 -1
- data/spec/unit/knife/node_policy_set_spec.rb +1 -1
- data/spec/unit/knife/node_run_list_add_spec.rb +1 -1
- data/spec/unit/knife/node_run_list_remove_spec.rb +1 -1
- data/spec/unit/knife/node_run_list_set_spec.rb +1 -1
- data/spec/unit/knife/node_show_spec.rb +1 -1
- data/spec/unit/knife/raw_spec.rb +2 -2
- data/spec/unit/knife/role_bulk_delete_spec.rb +2 -2
- data/spec/unit/knife/role_create_spec.rb +1 -1
- data/spec/unit/knife/role_delete_spec.rb +1 -1
- data/spec/unit/knife/role_edit_spec.rb +1 -1
- data/spec/unit/knife/role_env_run_list_add_spec.rb +1 -1
- data/spec/unit/knife/role_env_run_list_clear_spec.rb +1 -1
- data/spec/unit/knife/role_env_run_list_remove_spec.rb +1 -1
- data/spec/unit/knife/role_env_run_list_replace_spec.rb +1 -1
- data/spec/unit/knife/role_env_run_list_set_spec.rb +1 -1
- data/spec/unit/knife/role_from_file_spec.rb +1 -1
- data/spec/unit/knife/role_run_list_add_spec.rb +1 -1
- data/spec/unit/knife/role_run_list_clear_spec.rb +1 -1
- data/spec/unit/knife/role_run_list_remove_spec.rb +1 -1
- data/spec/unit/knife/role_run_list_replace_spec.rb +1 -1
- data/spec/unit/knife/role_run_list_set_spec.rb +1 -1
- data/spec/unit/knife/ssh_spec.rb +27 -17
- data/spec/unit/knife/ssl_check_spec.rb +4 -4
- data/spec/unit/knife/ssl_fetch_spec.rb +5 -5
- data/spec/unit/knife/status_spec.rb +3 -2
- data/spec/unit/knife/supermarket_download_spec.rb +4 -4
- data/spec/unit/knife/supermarket_install_spec.rb +5 -4
- data/spec/unit/knife/supermarket_share_spec.rb +1 -1
- data/spec/unit/knife_spec.rb +34 -33
- data/spec/unit/lwrp_spec.rb +19 -19
- data/spec/unit/mixin/homebrew_user_spec.rb +1 -1
- data/spec/unit/mixin/params_validate_spec.rb +10 -10
- data/spec/unit/mixin/properties_spec.rb +4 -4
- data/spec/unit/mixin/shell_out_spec.rb +27 -27
- data/spec/unit/mixin/template_spec.rb +4 -8
- data/spec/unit/mixin/unformatter_spec.rb +1 -2
- data/spec/unit/mixin/user_context_spec.rb +1 -2
- data/spec/unit/mixin/which.rb +2 -0
- data/spec/unit/mixin/windows_architecture_helper_spec.rb +3 -3
- data/spec/unit/node/attribute_spec.rb +79 -79
- data/spec/unit/node/immutable_collections_spec.rb +50 -50
- data/spec/unit/node_spec.rb +16 -16
- data/spec/unit/org_spec.rb +3 -3
- data/spec/unit/policy_builder/policyfile_spec.rb +2 -2
- data/spec/unit/property/state_spec.rb +26 -25
- data/spec/unit/property/validation_spec.rb +14 -13
- data/spec/unit/property_spec.rb +10 -9
- data/spec/unit/provider/apt_update_spec.rb +6 -6
- data/spec/unit/provider/cron_spec.rb +15 -15
- data/spec/unit/provider/dsc_resource_spec.rb +6 -3
- data/spec/unit/provider/dsc_script_spec.rb +1 -1
- data/spec/unit/provider/execute_spec.rb +5 -5
- data/spec/unit/provider/git_spec.rb +39 -39
- data/spec/unit/provider/group/dscl_spec.rb +3 -3
- data/spec/unit/provider/group/groupadd_spec.rb +1 -1
- data/spec/unit/provider/group_spec.rb +2 -3
- data/spec/unit/provider/ifconfig/aix_spec.rb +1 -1
- data/spec/unit/provider/ifconfig/debian_spec.rb +2 -2
- data/spec/unit/provider/ifconfig_spec.rb +45 -16
- data/spec/unit/provider/launchd_spec.rb +23 -15
- data/spec/unit/provider/link_spec.rb +22 -11
- data/spec/unit/provider/mount/aix_spec.rb +6 -6
- data/spec/unit/provider/mount/mount_spec.rb +31 -31
- data/spec/unit/provider/mount/solaris_spec.rb +11 -11
- data/spec/unit/provider/ohai_spec.rb +1 -1
- data/spec/unit/provider/osx_profile_spec.rb +5 -7
- data/spec/unit/provider/package/apt_spec.rb +5 -5
- data/spec/unit/provider/package/bff_spec.rb +1 -1
- data/spec/unit/provider/package/cab_spec.rb +1 -1
- data/spec/unit/provider/package/chocolatey_spec.rb +8 -8
- data/spec/unit/provider/package/freebsd/pkg_spec.rb +1 -1
- data/spec/unit/provider/package/ips_spec.rb +6 -6
- data/spec/unit/provider/package/macports_spec.rb +1 -1
- data/spec/unit/provider/package/msu_spec.rb +1 -1
- data/spec/unit/provider/package/openbsd_spec.rb +15 -11
- data/spec/unit/provider/package/pacman_spec.rb +3 -3
- data/spec/unit/provider/package/paludis_spec.rb +4 -4
- data/spec/unit/provider/package/portage_spec.rb +1 -1
- data/spec/unit/provider/package/powershell_spec.rb +1 -1
- data/spec/unit/provider/package/smartos_spec.rb +3 -3
- data/spec/unit/provider/package/solaris_spec.rb +1 -1
- data/spec/unit/provider/package/windows/exe_spec.rb +9 -9
- data/spec/unit/provider/package/windows/msi_spec.rb +7 -7
- data/spec/unit/provider/package/windows_spec.rb +2 -1
- data/spec/unit/provider/package/yum/yum_cache_spec.rb +1 -1
- data/spec/unit/provider/package/zypper_spec.rb +4 -4
- data/spec/unit/provider/package_spec.rb +1 -1
- data/spec/unit/provider/powershell_script_spec.rb +7 -7
- data/spec/unit/provider/registry_key_spec.rb +1 -1
- data/spec/unit/provider/remote_directory_spec.rb +6 -6
- data/spec/unit/provider/route_spec.rb +11 -11
- data/spec/unit/provider/service/arch_service_spec.rb +13 -13
- data/spec/unit/provider/service/debian_service_spec.rb +2 -1
- data/spec/unit/provider/service/freebsd_service_spec.rb +28 -24
- data/spec/unit/provider/service/gentoo_service_spec.rb +2 -2
- data/spec/unit/provider/service/init_service_spec.rb +11 -11
- data/spec/unit/provider/service/invokercd_service_spec.rb +11 -11
- data/spec/unit/provider/service/macosx_spec.rb +5 -5
- data/spec/unit/provider/service/openbsd_service_spec.rb +15 -11
- data/spec/unit/provider/service/simple_service_spec.rb +7 -7
- data/spec/unit/provider/service/upstart_service_spec.rb +14 -14
- data/spec/unit/provider/service/windows_spec.rb +53 -35
- data/spec/unit/provider/subversion_spec.rb +8 -4
- data/spec/unit/provider/systemd_unit_spec.rb +142 -142
- data/spec/unit/provider/template/content_spec.rb +29 -29
- data/spec/unit/provider/windows_task_spec.rb +1 -1
- data/spec/unit/provider_resolver_spec.rb +75 -75
- data/spec/unit/provider_spec.rb +2 -4
- data/spec/unit/recipe_spec.rb +4 -4
- data/spec/unit/resource/batch_spec.rb +1 -1
- data/spec/unit/resource/chef_gem_spec.rb +1 -1
- data/spec/unit/resource/chocolatey_config_spec.rb +1 -1
- data/spec/unit/resource/chocolatey_source_spec.rb +1 -1
- data/spec/unit/resource/directory_spec.rb +1 -1
- data/spec/unit/resource/dnf_package_spec.rb +1 -1
- data/spec/unit/resource/dsc_resource_spec.rb +1 -1
- data/spec/unit/resource/file/verification_spec.rb +1 -2
- data/spec/unit/resource/file_spec.rb +1 -1
- data/spec/unit/resource/group_spec.rb +1 -1
- data/spec/unit/resource/link_spec.rb +1 -1
- data/spec/unit/resource/osx_profile_spec.rb +2 -1
- data/spec/unit/resource/powershell_script_spec.rb +12 -7
- data/spec/unit/resource/registry_key_spec.rb +3 -3
- data/spec/unit/resource/rhsm_subscription_spec.rb +1 -1
- data/spec/unit/resource/service_spec.rb +1 -1
- data/spec/unit/resource/template_spec.rb +2 -2
- data/spec/unit/resource/windows_env_spec.rb +1 -1
- data/spec/unit/resource/windows_service_spec.rb +5 -5
- data/spec/unit/resource/windows_task_spec.rb +6 -2
- data/spec/unit/resource/yum_package_spec.rb +1 -1
- data/spec/unit/resource_collection/resource_list_spec.rb +1 -1
- data/spec/unit/resource_collection/resource_set_spec.rb +7 -7
- data/spec/unit/resource_collection/stepable_iterator_spec.rb +2 -2
- data/spec/unit/resource_collection_spec.rb +4 -4
- data/spec/unit/resource_definition_spec.rb +2 -2
- data/spec/unit/resource_inspector_spec.rb +1 -1
- data/spec/unit/resource_reporter_spec.rb +4 -4
- data/spec/unit/resource_spec.rb +22 -22
- data/spec/unit/role_spec.rb +3 -3
- data/spec/unit/run_context/cookbook_compiler_spec.rb +23 -23
- data/spec/unit/run_list/run_list_expansion_spec.rb +9 -6
- data/spec/unit/run_list_spec.rb +1 -1
- data/spec/unit/runner_spec.rb +3 -3
- data/spec/unit/search/query_spec.rb +3 -2
- data/spec/unit/shell/model_wrapper_spec.rb +1 -1
- data/spec/unit/shell/shell_session_spec.rb +8 -11
- data/spec/unit/shell_spec.rb +1 -2
- data/spec/unit/user_spec.rb +4 -4
- data/spec/unit/user_v1_spec.rb +3 -3
- data/spec/unit/util/backup_spec.rb +1 -1
- data/spec/unit/util/dsc/lcm_output_parser_spec.rb +13 -13
- data/spec/unit/util/dsc/local_configuration_manager_spec.rb +3 -3
- data/spec/unit/util/editor_spec.rb +1 -1
- data/spec/unit/util/powershell/ps_credential_spec.rb +3 -2
- data/spec/unit/util/threaded_job_queue_spec.rb +2 -2
- data/spec/unit/version_class_spec.rb +4 -4
- data/spec/unit/win32/registry_spec.rb +5 -5
- data/spec/unit/win32/security_spec.rb +2 -1
- data/tasks/announce.rb +4 -11
- metadata +10 -6
- data/tasks/maintainers.rb +0 -211
- data/tasks/templates/prerelease.md.erb +0 -35
@@ -96,7 +96,7 @@ describe Chef::Resource::Group, :requires_root_or_running_windows do
|
|
96
96
|
end
|
97
97
|
|
98
98
|
def create_user(username, uid = nil)
|
99
|
-
|
99
|
+
unless windows_domain_user?(username)
|
100
100
|
user_to_create = user(username)
|
101
101
|
user_to_create.uid(uid) if uid
|
102
102
|
user_to_create.run_action(:create)
|
@@ -105,7 +105,7 @@ describe Chef::Resource::Group, :requires_root_or_running_windows do
|
|
105
105
|
end
|
106
106
|
|
107
107
|
def remove_user(username)
|
108
|
-
|
108
|
+
unless windows_domain_user?(username)
|
109
109
|
u = user(username)
|
110
110
|
u.manage_home false # jekins hosts throw mail spool file not owned by user if we use manage_home true
|
111
111
|
u.run_action(:remove)
|
@@ -152,7 +152,7 @@ describe Chef::Resource::Group, :requires_root_or_running_windows do
|
|
152
152
|
let(:excluded_members) { [] }
|
153
153
|
|
154
154
|
it "should raise an error" do
|
155
|
-
expect { group_resource.run_action(tested_action) }.to raise_error
|
155
|
+
expect { group_resource.run_action(tested_action) }.to raise_error
|
156
156
|
end
|
157
157
|
end
|
158
158
|
|
@@ -162,7 +162,7 @@ describe Chef::Resource::Group, :requires_root_or_running_windows do
|
|
162
162
|
end
|
163
163
|
|
164
164
|
it "should raise an error" do
|
165
|
-
expect { group_resource.run_action(tested_action) }.to raise_error
|
165
|
+
expect { group_resource.run_action(tested_action) }.to raise_error
|
166
166
|
end
|
167
167
|
end
|
168
168
|
end
|
@@ -336,7 +336,8 @@ describe Chef::Resource::Group, :requires_root_or_running_windows do
|
|
336
336
|
"theoldmanwalkingdownthestreetalwayshadagood\
|
337
337
|
smileonhisfacetheoldmanwalkingdownthestreetalwayshadagoodsmileonhisface\
|
338
338
|
theoldmanwalkingdownthestreetalwayshadagoodsmileonhisfacetheoldmanwalking\
|
339
|
-
downthestreetalwayshadagoodsmileonhisfacetheoldmanwalkingdownthestree"
|
339
|
+
downthestreetalwayshadagoodsmileonhisfacetheoldmanwalkingdownthestree"
|
340
|
+
end
|
340
341
|
|
341
342
|
it "should create a group" do
|
342
343
|
group_resource.run_action(:create)
|
@@ -362,7 +363,8 @@ downthestreetalwayshadagoodsmileonhisfacetheoldmanwalkingdownthestree" end
|
|
362
363
|
"theoldmanwalkingdownthestreetalwayshadagood\
|
363
364
|
smileonhisfacetheoldmanwalkingdownthestreetalwayshadagoodsmileonhisface\
|
364
365
|
theoldmanwalkingdownthestreetalwayshadagoodsmileonhisfacetheoldmanwalking\
|
365
|
-
downthestreetalwayshadagoodsmileonhisfacetheoldmanwalkingdownthestreeQQQQQQ"
|
366
|
+
downthestreetalwayshadagoodsmileonhisfacetheoldmanwalkingdownthestreeQQQQQQ"
|
367
|
+
end
|
366
368
|
|
367
369
|
it "should not create a group" do
|
368
370
|
expect { group_resource.run_action(:create) }.to raise_error(ArgumentError)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Kaustubh Deorukhkar (<kaustubh@clogeny.com>)
|
3
|
-
# Copyright:: Copyright 2013-
|
3
|
+
# Copyright:: Copyright 2013-2020, Chef Software Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -23,9 +23,7 @@ require "chef/mixin/shell_out"
|
|
23
23
|
# run this test only for following platforms.
|
24
24
|
include_flag = !(%w{amazon debian aix}.include?(ohai[:platform_family]) || (ohai[:platform_family] == "rhel" && ohai[:platform_version].to_i < 7))
|
25
25
|
|
26
|
-
describe Chef::Resource::Ifconfig, :requires_root, :
|
27
|
-
# This test does not work in travis because there is no eth0
|
28
|
-
|
26
|
+
describe Chef::Resource::Ifconfig, :requires_root, :requires_ifconfig, external: include_flag do
|
29
27
|
include Chef::Mixin::ShellOut
|
30
28
|
|
31
29
|
let(:new_resource) do
|
@@ -53,7 +51,7 @@ describe Chef::Resource::Ifconfig, :requires_root, :skip_travis, external: inclu
|
|
53
51
|
end
|
54
52
|
|
55
53
|
def fetch_first_interface_name
|
56
|
-
shell_out("ip link list |grep UP|grep -vi loop|head -1|cut -d':' -f 2").stdout.strip
|
54
|
+
shell_out("ip link list |grep UP|grep -vi loop|head -1|cut -d':' -f 2 |cut -d'@' -f 1").stdout.strip
|
57
55
|
end
|
58
56
|
|
59
57
|
# **Caution: any updates to core interfaces can be risky.
|
@@ -133,9 +133,9 @@ describe Chef::Resource::Link do
|
|
133
133
|
end
|
134
134
|
|
135
135
|
def get_sid(value)
|
136
|
-
if value.
|
136
|
+
if value.is_a?(String)
|
137
137
|
Chef::ReservedNames::Win32::Security::SID.from_account(value)
|
138
|
-
elsif value.
|
138
|
+
elsif value.is_a?(Chef::ReservedNames::Win32::Security::SID)
|
139
139
|
value
|
140
140
|
else
|
141
141
|
raise "Must specify username or SID: #{value}"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Kaustubh Deorukhkar (<kaustubh@clogeny.com>)
|
3
|
-
# Copyright:: Copyright 2013-
|
3
|
+
# Copyright:: Copyright 2013-2019, Chef Software Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -24,14 +24,10 @@ require "tmpdir"
|
|
24
24
|
# run this test only for following platforms.
|
25
25
|
include_flag = !(%w{debian rhel amazon aix solaris2}.include?(ohai[:platform_family]))
|
26
26
|
|
27
|
-
describe Chef::Resource::Mount, :requires_root,
|
28
|
-
# Disabled in travis because it refuses to let us mount a ramdisk. /dev/ramX does not
|
29
|
-
# exist even after loading the kernel module
|
30
|
-
|
27
|
+
describe Chef::Resource::Mount, :requires_root, external: include_flag do
|
31
28
|
include Chef::Mixin::ShellOut
|
32
29
|
|
33
30
|
# Platform specific setup, cleanup and validation helpers.
|
34
|
-
|
35
31
|
def setup_device_for_mount
|
36
32
|
# use ramdisk for creating a test device for mount.
|
37
33
|
# This can cleaner if we have chef resource/provider for ramdisk.
|
@@ -73,7 +69,7 @@ describe Chef::Resource::Mount, :requires_root, :skip_travis, external: include_
|
|
73
69
|
def mount_should_exist(mount_point, device, fstype = nil, options = nil)
|
74
70
|
validation_cmd = "mount | grep #{mount_point} | grep #{device} "
|
75
71
|
validation_cmd << " | grep #{fstype} " unless fstype.nil?
|
76
|
-
validation_cmd << " | grep #{options.join(
|
72
|
+
validation_cmd << " | grep #{options.join(",")} " unless options.nil? || options.empty?
|
77
73
|
expect(shell_out(validation_cmd).exitstatus).to eq(0)
|
78
74
|
end
|
79
75
|
|
@@ -28,13 +28,13 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do
|
|
28
28
|
|
29
29
|
it_behaves_like "a Windows script running on Windows"
|
30
30
|
|
31
|
-
let(:successful_executable_script_content) { "#{ENV[
|
32
|
-
let(:failed_executable_script_content) { "#{ENV[
|
31
|
+
let(:successful_executable_script_content) { "#{ENV["SystemRoot"]}\\system32\\attrib.exe $env:systemroot" }
|
32
|
+
let(:failed_executable_script_content) { "#{ENV["SystemRoot"]}\\system32\\attrib.exe /badargument" }
|
33
33
|
let(:processor_architecture_script_content) { "echo $env:PROCESSOR_ARCHITECTURE" }
|
34
34
|
let(:native_architecture_script_content) { "echo $env:PROCESSOR_ARCHITECTUREW6432" }
|
35
35
|
let(:cmdlet_exit_code_not_found_content) { "get-item '.\\thisdoesnotexist'" }
|
36
36
|
let(:cmdlet_exit_code_success_content) { "get-item ." }
|
37
|
-
let(:windows_process_exit_code_success_content) { "#{ENV[
|
37
|
+
let(:windows_process_exit_code_success_content) { "#{ENV["SystemRoot"]}\\system32\\attrib.exe $env:systemroot" }
|
38
38
|
let(:windows_process_exit_code_not_found_content) { "findstr /notavalidswitch" }
|
39
39
|
let(:arbitrary_nonzero_process_exit_code) { 4193 }
|
40
40
|
let(:arbitrary_nonzero_process_exit_code_content) { "exit #{arbitrary_nonzero_process_exit_code}" }
|
@@ -473,26 +473,26 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do
|
|
473
473
|
end
|
474
474
|
|
475
475
|
it "evaluates a not_if block using the cwd guard parameter" do
|
476
|
-
custom_cwd = "#{ENV[
|
476
|
+
custom_cwd = "#{ENV["SystemRoot"]}\\system32\\drivers\\etc"
|
477
477
|
resource.not_if "exit ! [int32]($pwd.path -eq '#{custom_cwd}')", cwd: custom_cwd
|
478
478
|
expect(resource.should_skip?(:run)).to be_truthy
|
479
479
|
end
|
480
480
|
|
481
481
|
it "evaluates an only_if block using the cwd guard parameter" do
|
482
|
-
custom_cwd = "#{ENV[
|
482
|
+
custom_cwd = "#{ENV["SystemRoot"]}\\system32\\drivers\\etc"
|
483
483
|
resource.only_if "exit ! [int32]($pwd.path -eq '#{custom_cwd}')", cwd: custom_cwd
|
484
484
|
expect(resource.should_skip?(:run)).to be_falsey
|
485
485
|
end
|
486
486
|
|
487
487
|
it "inherits cwd from the parent resource for only_if" do
|
488
|
-
custom_cwd = "#{ENV[
|
488
|
+
custom_cwd = "#{ENV["SystemRoot"]}\\system32\\drivers\\etc"
|
489
489
|
resource.cwd custom_cwd
|
490
490
|
resource.only_if "exit ! [int32]($pwd.path -eq '#{custom_cwd}')"
|
491
491
|
expect(resource.should_skip?(:run)).to be_falsey
|
492
492
|
end
|
493
493
|
|
494
494
|
it "inherits cwd from the parent resource for not_if" do
|
495
|
-
custom_cwd = "#{ENV[
|
495
|
+
custom_cwd = "#{ENV["SystemRoot"]}\\system32\\drivers\\etc"
|
496
496
|
resource.cwd custom_cwd
|
497
497
|
resource.not_if "exit ! [int32]($pwd.path -eq '#{custom_cwd}')"
|
498
498
|
expect(resource.should_skip?(:run)).to be_truthy
|
@@ -584,7 +584,8 @@ describe Chef::Resource::WindowsScript::PowershellScript, :windows_only do
|
|
584
584
|
resource.only_if "$true", architecture: :i386
|
585
585
|
expect { resource.run_action(:run) }.to raise_error(
|
586
586
|
Chef::Exceptions::Win32ArchitectureIncorrect,
|
587
|
-
/cannot execute script with requested architecture 'i386' on Windows Nano Server/
|
587
|
+
/cannot execute script with requested architecture 'i386' on Windows Nano Server/
|
588
|
+
)
|
588
589
|
end
|
589
590
|
end
|
590
591
|
end
|
@@ -45,7 +45,7 @@ describe Chef::Resource::Reboot do
|
|
45
45
|
shared_context "testing run context modification" do
|
46
46
|
def test_reboot_action(resource)
|
47
47
|
reboot_info = resource.run_context.reboot_info
|
48
|
-
expect(reboot_info.keys.sort).to eq(
|
48
|
+
expect(reboot_info.keys.sort).to eq(%i{delay_mins reason requested_by timestamp})
|
49
49
|
expect(reboot_info[:delay_mins]).to eq(expected[:delay_mins])
|
50
50
|
expect(reboot_info[:reason]).to eq(expected[:reason])
|
51
51
|
expect(reboot_info[:requested_by]).to eq(expected[:requested_by])
|
@@ -134,7 +134,7 @@ describe Chef::Resource::RemoteFile do
|
|
134
134
|
let(:smb_file_local_file_name) { "smb_file.txt" }
|
135
135
|
let(:smb_file_local_path) { File.join( smb_share_root_directory, smb_file_local_file_name ) }
|
136
136
|
let(:smb_share_name) { "chef_smb_test" }
|
137
|
-
let(:smb_remote_path) { File.join("//#{ENV[
|
137
|
+
let(:smb_remote_path) { File.join("//#{ENV["COMPUTERNAME"]}", smb_share_name, smb_file_local_file_name).gsub(%r{/}, "\\") }
|
138
138
|
let(:smb_file_content) { "hellofun" }
|
139
139
|
let(:local_destination_path) { File.join(Dir.tmpdir, make_tmpname("chef_remote_file")) }
|
140
140
|
let(:windows_current_user) { ENV["USERNAME"] }
|
@@ -155,7 +155,7 @@ describe Chef::Resource::RemoteFile do
|
|
155
155
|
before do
|
156
156
|
shell_out("net.exe share #{smb_share_name} /delete")
|
157
157
|
File.write(smb_file_local_path, smb_file_content )
|
158
|
-
shell_out!("net.exe share #{smb_share_name}=\"#{smb_share_root_directory.gsub(
|
158
|
+
shell_out!("net.exe share #{smb_share_name}=\"#{smb_share_root_directory.gsub(%r{/}, '\\')}\" /grant:\"authenticated users\",read")
|
159
159
|
end
|
160
160
|
|
161
161
|
after do
|
@@ -47,13 +47,13 @@ describe Chef::Provider::User::Windows, :windows_only do
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def backup_secedit_policy
|
50
|
-
backup_command = "secedit /export /cfg #{ENV[
|
50
|
+
backup_command = "secedit /export /cfg #{ENV["TEMP"]}\\secedit_restore.inf /areas SECURITYPOLICY"
|
51
51
|
shell_out(backup_command)
|
52
52
|
end
|
53
53
|
|
54
54
|
def restore_secedit_policy
|
55
55
|
security_database = "C:\\windows\\security\\database\\seceditnew.sdb"
|
56
|
-
restore_command = "secedit /configure /db #{security_database} /cfg #{ENV[
|
56
|
+
restore_command = "secedit /configure /db #{security_database} /cfg #{ENV["TEMP"]}\\secedit_restore.inf /areas SECURITYPOLICY"
|
57
57
|
shell_out(restore_command)
|
58
58
|
end
|
59
59
|
|
@@ -81,9 +81,9 @@ describe Chef::Resource::WindowsCertificate, :windows_only, :appveyor_only do
|
|
81
81
|
|
82
82
|
# Byepassing the validation so that we may create a custom store
|
83
83
|
allow_any_instance_of(Chef::Mixin::ParamsValidate)
|
84
|
-
|
85
|
-
|
86
|
-
|
84
|
+
.to receive(:_pv_equal_to)
|
85
|
+
.with(opts, key, to_be)
|
86
|
+
.and_return(true)
|
87
87
|
|
88
88
|
# Creating a custom store for the testing
|
89
89
|
create_store(store)
|
@@ -24,7 +24,7 @@ describe Chef::Resource::WindowsService, :windows_only, :system_windows_service_
|
|
24
24
|
include_context "using Win32::Service"
|
25
25
|
|
26
26
|
let(:username) { "service_spec_user" }
|
27
|
-
let(:qualified_username) { "#{ENV[
|
27
|
+
let(:qualified_username) { "#{ENV["COMPUTERNAME"]}\\#{username}" }
|
28
28
|
let(:password) { "1a2b3c4X!&narf" }
|
29
29
|
|
30
30
|
let(:user_resource) do
|
@@ -36,7 +36,7 @@ describe Chef::Resource::WindowsService, :windows_only, :system_windows_service_
|
|
36
36
|
end
|
37
37
|
|
38
38
|
let(:global_service_file_path) do
|
39
|
-
"#{ENV[
|
39
|
+
"#{ENV["WINDIR"]}\\temp\\#{File.basename(test_service[:service_file_path])}"
|
40
40
|
end
|
41
41
|
|
42
42
|
let(:service_params) do
|
@@ -59,7 +59,7 @@ describe Chef::Resource::WindowsService, :windows_only, :system_windows_service_
|
|
59
59
|
|
60
60
|
let(:service_resource) do
|
61
61
|
r = Chef::Resource::WindowsService.new(service_params[:service_name], run_context)
|
62
|
-
|
62
|
+
%i{run_as_user run_as_password}.each { |prop| r.send(prop, service_params[prop]) }
|
63
63
|
r
|
64
64
|
end
|
65
65
|
|
@@ -1283,6 +1283,57 @@ describe Chef::Resource::WindowsTask, :windows_only do
|
|
1283
1283
|
expect(subject).not_to be_updated_by_last_action
|
1284
1284
|
end
|
1285
1285
|
end
|
1286
|
+
|
1287
|
+
context "when start_when_available is passed" do
|
1288
|
+
subject do
|
1289
|
+
new_resource = Chef::Resource::WindowsTask.new(task_name, run_context)
|
1290
|
+
new_resource.command task_name
|
1291
|
+
new_resource.run_level :highest
|
1292
|
+
new_resource.execution_time_limit = 259200 / 60 # converting "PT72H" into minutes and passing here since win32-taskscheduler accespts this
|
1293
|
+
new_resource
|
1294
|
+
end
|
1295
|
+
|
1296
|
+
it "sets start_when_available to true" do
|
1297
|
+
subject.frequency :minute
|
1298
|
+
subject.start_when_available true
|
1299
|
+
call_for_create_action
|
1300
|
+
# loading current resource again to check new task is creted and it matches task parameters
|
1301
|
+
current_resource = call_for_load_current_resource
|
1302
|
+
expect(current_resource.exists).to eq(true)
|
1303
|
+
expect(current_resource.task.settings[:start_when_available]).to eql(true)
|
1304
|
+
end
|
1305
|
+
|
1306
|
+
it "sets start_when_available to false" do
|
1307
|
+
subject.frequency :minute
|
1308
|
+
subject.start_when_available false
|
1309
|
+
call_for_create_action
|
1310
|
+
# loading current resource again to check new task is created and it matches task parameters
|
1311
|
+
current_resource = call_for_load_current_resource
|
1312
|
+
expect(current_resource.exists).to eq(true)
|
1313
|
+
expect(current_resource.task.settings[:start_when_available]).to eql(false)
|
1314
|
+
end
|
1315
|
+
|
1316
|
+
it "sets the default if start_when_available is nil" do
|
1317
|
+
subject.frequency :minute
|
1318
|
+
subject.start_when_available nil
|
1319
|
+
call_for_create_action
|
1320
|
+
# loading current resource again to check new task is created and it matches task parameters
|
1321
|
+
current_resource = call_for_load_current_resource
|
1322
|
+
expect(current_resource.exists).to eq(true)
|
1323
|
+
expect(current_resource.task.settings[:start_when_available]).to eql(false)
|
1324
|
+
end
|
1325
|
+
|
1326
|
+
it "does not converge the resource if it is already converged" do
|
1327
|
+
subject.frequency :minute
|
1328
|
+
subject.start_when_available true
|
1329
|
+
subject.run_action(:create)
|
1330
|
+
subject.frequency :minute
|
1331
|
+
subject.start_when_available true
|
1332
|
+
subject.disallow_start_if_on_batteries false
|
1333
|
+
subject.run_action(:create)
|
1334
|
+
expect(subject).not_to be_updated_by_last_action
|
1335
|
+
end
|
1336
|
+
end
|
1286
1337
|
end
|
1287
1338
|
|
1288
1339
|
context "task_name with parent folder" do
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Daniel DeLeo (<dan@chef.io>)
|
3
|
-
# Copyright:: Copyright 2012-
|
3
|
+
# Copyright:: Copyright 2012-2020, Chef Software Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -334,6 +334,7 @@ describe Chef::RunLock do
|
|
334
334
|
loop do
|
335
335
|
line = readline_nonblock(read_from_process)
|
336
336
|
break if line.nil?
|
337
|
+
|
337
338
|
event, time = line.split("@")
|
338
339
|
example.log_event("#{name}.last_event got #{event}")
|
339
340
|
example.log_event("[#{name}] #{event}", time.strip)
|
@@ -346,7 +347,7 @@ describe Chef::RunLock do
|
|
346
347
|
example.log_event("#{name}.run_to(#{to_event.inspect})")
|
347
348
|
|
348
349
|
# Start the process if it's not started
|
349
|
-
start
|
350
|
+
start unless pid
|
350
351
|
|
351
352
|
# Tell the process what to stop at (also means it can go)
|
352
353
|
write_to_process.print "#{to_event}\n"
|
@@ -370,7 +371,7 @@ describe Chef::RunLock do
|
|
370
371
|
def run_to_completion
|
371
372
|
example.log_event("#{name}.run_to_completion")
|
372
373
|
# Start the process if it's not started
|
373
|
-
start
|
374
|
+
start unless pid
|
374
375
|
|
375
376
|
# Tell the process to stop at nothing (no blocking)
|
376
377
|
@write_to_process.print "nothing\n"
|
@@ -403,6 +404,12 @@ describe Chef::RunLock do
|
|
403
404
|
example.log_event("#{name}.stop finished (pid #{pid} wasn't running)")
|
404
405
|
end
|
405
406
|
end
|
407
|
+
|
408
|
+
# close the IO.pipes so we don't leak them as open filehandles
|
409
|
+
@read_from_process.close rescue nil
|
410
|
+
@write_to_tests.close rescue nil
|
411
|
+
@read_from_tests.close rescue nil
|
412
|
+
@write_to_process.close rescue nil
|
406
413
|
end
|
407
414
|
|
408
415
|
def fire_event(event)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Daniel DeLeo (<dan@chef.io>)
|
3
|
-
# Copyright:: Copyright 2012-
|
3
|
+
# Copyright:: Copyright 2012-2019, Chef Software Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -29,7 +29,7 @@ describe Chef::Util::Powershell::Cmdlet, :windows_powershell_dsc_only do
|
|
29
29
|
let(:invalid_cmdlet) { Chef::Util::Powershell::Cmdlet.new(@node, "get-idontexist", cmd_output_format) }
|
30
30
|
let(:cmdlet_get_item_requires_switch_or_argument) { Chef::Util::Powershell::Cmdlet.new(@node, "get-item", cmd_output_format, { depth: 2 }) }
|
31
31
|
let(:cmdlet_alias_requires_switch_or_argument) { Chef::Util::Powershell::Cmdlet.new(@node, "alias", cmd_output_format, { depth: 2 }) }
|
32
|
-
let(:etc_directory) { "#{ENV[
|
32
|
+
let(:etc_directory) { "#{ENV["systemroot"]}\\system32\\drivers\\etc" }
|
33
33
|
let(:architecture_cmdlet) { Chef::Util::Powershell::Cmdlet.new(@node, "$env:PROCESSOR_ARCHITECTURE") }
|
34
34
|
|
35
35
|
it "executes a simple process" do
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Serdar Sutay (<dan@chef.io>)
|
3
|
-
# Copyright:: Copyright 2013-
|
3
|
+
# Copyright:: Copyright 2013-2019, Chef Software Inc.
|
4
4
|
# License:: Apache License, Version 2.0
|
5
5
|
#
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -61,7 +61,8 @@ describe "Chef::Win32::Security", :windows_only do
|
|
61
61
|
describe "get_file_security" do
|
62
62
|
it "should return a security descriptor when called with a path that exists" do
|
63
63
|
security_descriptor = Chef::ReservedNames::Win32::Security.get_file_security(
|
64
|
-
"C:\\Program Files"
|
64
|
+
"C:\\Program Files"
|
65
|
+
)
|
65
66
|
# Make sure the security descriptor works
|
66
67
|
expect(security_descriptor.dacl_present?).to be true
|
67
68
|
end
|
@@ -70,7 +71,8 @@ describe "Chef::Win32::Security", :windows_only do
|
|
70
71
|
describe "access_check" do
|
71
72
|
let(:security_descriptor) do
|
72
73
|
Chef::ReservedNames::Win32::Security.get_file_security(
|
73
|
-
"C:\\Program Files"
|
74
|
+
"C:\\Program Files"
|
75
|
+
)
|
74
76
|
end
|
75
77
|
|
76
78
|
let(:token_rights) { Chef::ReservedNames::Win32::Security::TOKEN_ALL_ACCESS }
|
@@ -78,7 +80,8 @@ describe "Chef::Win32::Security", :windows_only do
|
|
78
80
|
let(:token) do
|
79
81
|
Chef::ReservedNames::Win32::Security.open_process_token(
|
80
82
|
Chef::ReservedNames::Win32::Process.get_current_process,
|
81
|
-
token_rights
|
83
|
+
token_rights
|
84
|
+
).duplicate_token(:SecurityImpersonation)
|
82
85
|
end
|
83
86
|
|
84
87
|
let(:mapping) do
|
@@ -94,7 +97,7 @@ describe "Chef::Win32::Security", :windows_only do
|
|
94
97
|
|
95
98
|
it "should check if the provided token has the desired access" do
|
96
99
|
expect(Chef::ReservedNames::Win32::Security.access_check(security_descriptor,
|
97
|
-
|
100
|
+
token, desired_access, mapping)).to be true
|
98
101
|
end
|
99
102
|
end
|
100
103
|
|
@@ -102,7 +105,8 @@ describe "Chef::Win32::Security", :windows_only do
|
|
102
105
|
let(:token) do
|
103
106
|
Chef::ReservedNames::Win32::Security.open_process_token(
|
104
107
|
Chef::ReservedNames::Win32::Process.get_current_process,
|
105
|
-
token_rights
|
108
|
+
token_rights
|
109
|
+
)
|
106
110
|
end
|
107
111
|
context "with all rights" do
|
108
112
|
let(:token_rights) { Chef::ReservedNames::Win32::Security::TOKEN_ALL_ACCESS }
|
@@ -127,11 +131,12 @@ describe "Chef::Win32::Security", :windows_only do
|
|
127
131
|
let(:token) do
|
128
132
|
Chef::ReservedNames::Win32::Security.open_process_token(
|
129
133
|
Chef::ReservedNames::Win32::Process.get_current_process,
|
130
|
-
token_rights
|
134
|
+
token_rights
|
135
|
+
)
|
131
136
|
end
|
132
137
|
|
133
138
|
context "when the token is valid" do
|
134
|
-
let(:token_elevation_type) {
|
139
|
+
let(:token_elevation_type) { %i{TokenElevationTypeDefault TokenElevationTypeFull TokenElevationTypeLimited} }
|
135
140
|
|
136
141
|
it "returns the token elevation type" do
|
137
142
|
elevation_type = Chef::ReservedNames::Win32::Security.get_token_information_elevation_type(token)
|