chef 14.2.0 → 14.3.37
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +13 -12
- data/Gemfile +15 -0
- data/README.md +36 -40
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/bin/chef-apply +0 -1
- data/bin/chef-client +1 -2
- data/bin/chef-shell +1 -6
- data/bin/chef-solo +1 -2
- data/bin/knife +1 -2
- data/chef-universal-mingw32.gemspec +2 -2
- data/chef.gemspec +1 -1
- data/distro/ruby_bin_folder/Chef.PowerShell.Wrapper.dll +0 -0
- data/distro/ruby_bin_folder/Chef.PowerShell.dll +0 -0
- data/distro/{powershell/chef → ruby_bin_folder}/Newtonsoft.Json.dll +0 -0
- data/lib/chef/api_client.rb +10 -10
- data/lib/chef/api_client/registration.rb +5 -5
- data/lib/chef/api_client_v1.rb +15 -15
- data/lib/chef/application.rb +1 -1
- data/lib/chef/application/apply.rb +56 -56
- data/lib/chef/application/client.rb +169 -170
- data/lib/chef/application/exit_code.rb +2 -2
- data/lib/chef/application/knife.rb +79 -78
- data/lib/chef/application/solo.rb +120 -120
- data/lib/chef/application/windows_service.rb +21 -21
- data/lib/chef/application/windows_service_manager.rb +39 -39
- data/lib/chef/audit/audit_event_proxy.rb +6 -6
- data/lib/chef/audit/audit_reporter.rb +2 -2
- data/lib/chef/audit/control_group_data.rb +15 -15
- data/lib/chef/audit/runner.rb +1 -1
- data/lib/chef/chef_class.rb +16 -8
- data/lib/chef/chef_fs/chef_fs_data_store.rb +8 -8
- data/lib/chef/chef_fs/config.rb +2 -2
- data/lib/chef/chef_fs/file_system/chef_server/acl_entry.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/acls_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/chef_server_root_dir.rb +2 -2
- data/lib/chef/chef_fs/file_system/chef_server/cookbooks_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/organization_invites_entry.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/organization_members_entry.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/rest_list_entry.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_server/versioned_cookbooks_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/acls_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb +3 -3
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb +2 -2
- data/lib/chef/chef_fs/file_system/repository/directory.rb +3 -3
- data/lib/chef/chef_fs/file_system/repository/file_system_entry.rb +3 -3
- data/lib/chef/chef_fs/knife.rb +6 -6
- data/lib/chef/chef_fs/parallelizer.rb +1 -1
- data/lib/chef/client.rb +3 -0
- data/lib/chef/cookbook/cookbook_version_loader.rb +1 -1
- data/lib/chef/cookbook/file_system_file_vendor.rb +1 -1
- data/lib/chef/cookbook/manifest_v0.rb +1 -1
- data/lib/chef/cookbook/metadata.rb +61 -61
- data/lib/chef/cookbook/remote_file_vendor.rb +1 -1
- data/lib/chef/cookbook/synchronizer.rb +2 -2
- data/lib/chef/cookbook_loader.rb +3 -3
- data/lib/chef/cookbook_manifest.rb +5 -5
- data/lib/chef/cookbook_site_streaming_uploader.rb +5 -5
- data/lib/chef/cookbook_uploader.rb +2 -2
- data/lib/chef/cookbook_version.rb +2 -2
- data/lib/chef/data_bag.rb +3 -3
- data/lib/chef/data_bag_item.rb +2 -2
- data/lib/chef/deprecated.rb +110 -176
- data/lib/chef/dsl/audit.rb +1 -1
- data/lib/chef/dsl/definitions.rb +1 -1
- data/lib/chef/dsl/platform_introspection.rb +5 -0
- data/lib/chef/dsl/reboot_pending.rb +1 -1
- data/lib/chef/encrypted_data_bag_item.rb +2 -2
- data/lib/chef/encrypted_data_bag_item/check_encrypted.rb +1 -1
- data/lib/chef/encrypted_data_bag_item/encryptor.rb +1 -1
- data/lib/chef/environment.rb +10 -10
- data/lib/chef/event_loggers/windows_eventlog.rb +21 -21
- data/lib/chef/exceptions.rb +3 -3
- data/lib/chef/file_cache.rb +18 -16
- data/lib/chef/formatters/base.rb +9 -10
- data/lib/chef/formatters/doc.rb +12 -16
- data/lib/chef/formatters/error_inspectors/api_error_formatting.rb +51 -51
- data/lib/chef/formatters/error_inspectors/cookbook_resolve_error_inspector.rb +10 -10
- data/lib/chef/formatters/error_inspectors/node_load_error_inspector.rb +13 -13
- data/lib/chef/formatters/error_inspectors/registration_error_inspector.rb +39 -39
- data/lib/chef/formatters/error_inspectors/resource_failure_inspector.rb +1 -1
- data/lib/chef/formatters/error_inspectors/run_list_expansion_error_inspector.rb +16 -16
- data/lib/chef/formatters/indentable_output_stream.rb +4 -4
- data/lib/chef/guard_interpreter/resource_guard_interpreter.rb +3 -3
- data/lib/chef/handler/json_file.rb +1 -1
- data/lib/chef/http/auth_credentials.rb +2 -2
- data/lib/chef/http/authenticator.rb +6 -6
- data/lib/chef/http/cookie_manager.rb +1 -1
- data/lib/chef/http/http_request.rb +3 -3
- data/lib/chef/http/json_input.rb +1 -1
- data/lib/chef/http/json_to_model_output.rb +1 -1
- data/lib/chef/http/socketless_chef_zero_client.rb +1 -1
- data/lib/chef/json_compat.rb +1 -1
- data/lib/chef/key.rb +9 -9
- data/lib/chef/knife.rb +5 -5
- data/lib/chef/knife/bootstrap.rb +116 -116
- data/lib/chef/knife/bootstrap/client_builder.rb +1 -1
- data/lib/chef/knife/client_bulk_delete.rb +3 -3
- data/lib/chef/knife/client_create.rb +17 -17
- data/lib/chef/knife/client_delete.rb +3 -3
- data/lib/chef/knife/client_list.rb +3 -3
- data/lib/chef/knife/client_reregister.rb +3 -3
- data/lib/chef/knife/config_get.rb +126 -0
- data/lib/chef/knife/configure.rb +25 -25
- data/lib/chef/knife/cookbook_bulk_delete.rb +1 -1
- data/lib/chef/knife/cookbook_delete.rb +2 -2
- data/lib/chef/knife/cookbook_download.rb +11 -11
- data/lib/chef/knife/cookbook_list.rb +6 -6
- data/lib/chef/knife/cookbook_metadata.rb +7 -8
- data/lib/chef/knife/cookbook_metadata_from_file.rb +0 -1
- data/lib/chef/knife/cookbook_show.rb +16 -16
- data/lib/chef/knife/cookbook_site_download.rb +11 -10
- data/lib/chef/knife/cookbook_site_install.rb +24 -24
- data/lib/chef/knife/cookbook_site_list.rb +8 -8
- data/lib/chef/knife/cookbook_site_search.rb +6 -5
- data/lib/chef/knife/cookbook_site_share.rb +20 -19
- data/lib/chef/knife/cookbook_site_show.rb +6 -5
- data/lib/chef/knife/cookbook_site_unshare.rb +5 -5
- data/lib/chef/knife/cookbook_test.rb +8 -8
- data/lib/chef/knife/cookbook_upload.rb +32 -32
- data/lib/chef/knife/core/bootstrap_context.rb +7 -7
- data/lib/chef/knife/core/cookbook_scm_repo.rb +1 -1
- data/lib/chef/knife/core/generic_presenter.rb +7 -7
- data/lib/chef/knife/core/hashed_command_loader.rb +1 -1
- data/lib/chef/knife/core/node_presenter.rb +37 -37
- data/lib/chef/knife/core/status_presenter.rb +11 -11
- data/lib/chef/knife/data_bag_from_file.rb +4 -4
- data/lib/chef/knife/data_bag_list.rb +3 -3
- data/lib/chef/knife/data_bag_secret_options.rb +13 -13
- data/lib/chef/knife/delete.rb +29 -13
- data/lib/chef/knife/deps.rb +25 -9
- data/lib/chef/knife/diff.rb +30 -14
- data/lib/chef/knife/download.rb +39 -23
- data/lib/chef/knife/edit.rb +19 -3
- data/lib/chef/knife/environment_compare.rb +8 -8
- data/lib/chef/knife/environment_create.rb +3 -3
- data/lib/chef/knife/environment_from_file.rb +5 -3
- data/lib/chef/knife/environment_list.rb +3 -3
- data/lib/chef/knife/exec.rb +7 -7
- data/lib/chef/knife/key_create.rb +4 -4
- data/lib/chef/knife/key_create_base.rb +12 -12
- data/lib/chef/knife/key_edit.rb +5 -5
- data/lib/chef/knife/key_edit_base.rb +15 -15
- data/lib/chef/knife/key_list.rb +3 -3
- data/lib/chef/knife/key_list_base.rb +9 -9
- data/lib/chef/knife/list.rb +35 -19
- data/lib/chef/knife/node_edit.rb +4 -4
- data/lib/chef/knife/node_list.rb +3 -3
- data/lib/chef/knife/node_run_list_add.rb +6 -6
- data/lib/chef/knife/node_show.rb +6 -6
- data/lib/chef/knife/osc_user_create.rb +13 -13
- data/lib/chef/knife/osc_user_list.rb +3 -3
- data/lib/chef/knife/osc_user_reregister.rb +3 -3
- data/lib/chef/knife/raw.rb +32 -16
- data/lib/chef/knife/role_create.rb +3 -3
- data/lib/chef/knife/role_env_run_list_add.rb +4 -3
- data/lib/chef/knife/role_env_run_list_remove.rb +2 -2
- data/lib/chef/knife/role_env_run_list_replace.rb +1 -0
- data/lib/chef/knife/role_list.rb +3 -3
- data/lib/chef/knife/role_run_list_add.rb +4 -3
- data/lib/chef/knife/role_run_list_remove.rb +2 -2
- data/lib/chef/knife/role_run_list_replace.rb +1 -0
- data/lib/chef/knife/search.rb +23 -23
- data/lib/chef/knife/serve.rb +22 -6
- data/lib/chef/knife/show.rb +19 -3
- data/lib/chef/knife/ssh.rb +68 -68
- data/lib/chef/knife/ssl_check.rb +31 -31
- data/lib/chef/knife/ssl_fetch.rb +5 -5
- data/lib/chef/knife/status.rb +11 -11
- data/lib/chef/knife/upload.rb +41 -25
- data/lib/chef/knife/user_create.rb +28 -28
- data/lib/chef/knife/user_delete.rb +9 -9
- data/lib/chef/knife/user_edit.rb +9 -9
- data/lib/chef/knife/user_list.rb +3 -3
- data/lib/chef/knife/user_reregister.rb +12 -12
- data/lib/chef/knife/user_show.rb +9 -9
- data/lib/chef/knife/xargs.rb +52 -36
- data/lib/chef/log.rb +10 -8
- data/lib/chef/log/winevt.rb +21 -21
- data/lib/chef/mixin/api_version_request_handling.rb +6 -6
- data/lib/chef/mixin/deep_merge.rb +1 -1
- data/lib/chef/mixin/deprecation.rb +2 -2
- data/lib/chef/mixin/params_validate.rb +9 -9
- data/lib/chef/mixin/properties.rb +2 -2
- data/lib/chef/mixin/securable.rb +11 -11
- data/lib/chef/mixin/shell_out.rb +138 -82
- data/lib/chef/mixin/wide_string.rb +5 -23
- data/lib/chef/mixin/windows_env_helper.rb +1 -1
- data/lib/chef/mixin/xml_escape.rb +3 -3
- data/lib/chef/node.rb +15 -15
- data/lib/chef/node/attribute.rb +6 -6
- data/lib/chef/node/attribute_collections.rb +2 -2
- data/lib/chef/node/mixin/deep_merge_cache.rb +1 -1
- data/lib/chef/node/mixin/immutablize_array.rb +2 -2
- data/lib/chef/node/mixin/immutablize_hash.rb +2 -2
- data/lib/chef/node_map.rb +77 -3
- data/lib/chef/org.rb +8 -8
- data/lib/chef/policy_builder/expand_node_object.rb +1 -1
- data/lib/chef/powershell.rb +9 -7
- data/lib/chef/property.rb +14 -14
- data/lib/chef/provider/apt_update.rb +2 -2
- data/lib/chef/provider/cron.rb +3 -3
- data/lib/chef/provider/cron/unix.rb +2 -2
- data/lib/chef/provider/dsc_resource.rb +1 -1
- data/lib/chef/provider/dsc_script.rb +8 -8
- data/lib/chef/provider/execute.rb +1 -1
- data/lib/chef/provider/group/aix.rb +6 -6
- data/lib/chef/provider/group/dscl.rb +1 -1
- data/lib/chef/provider/group/gpasswd.rb +4 -4
- data/lib/chef/provider/group/groupadd.rb +3 -3
- data/lib/chef/provider/group/groupmod.rb +6 -6
- data/lib/chef/provider/group/pw.rb +4 -4
- data/lib/chef/provider/group/suse.rb +2 -2
- data/lib/chef/provider/group/usermod.rb +1 -1
- data/lib/chef/provider/http_request.rb +6 -6
- data/lib/chef/provider/ifconfig.rb +4 -4
- data/lib/chef/provider/ifconfig/aix.rb +1 -1
- data/lib/chef/provider/mdadm.rb +1 -1
- data/lib/chef/provider/mount/mount.rb +1 -1
- data/lib/chef/provider/mount/windows.rb +7 -7
- data/lib/chef/provider/package.rb +3 -18
- data/lib/chef/provider/package/apt.rb +4 -4
- data/lib/chef/provider/package/bff.rb +9 -9
- data/lib/chef/provider/package/chocolatey.rb +7 -7
- data/lib/chef/provider/package/dnf.rb +2 -2
- data/lib/chef/provider/package/dpkg.rb +6 -6
- data/lib/chef/provider/package/freebsd/base.rb +2 -2
- data/lib/chef/provider/package/freebsd/pkg.rb +6 -6
- data/lib/chef/provider/package/freebsd/pkgng.rb +5 -5
- data/lib/chef/provider/package/freebsd/port.rb +4 -4
- data/lib/chef/provider/package/homebrew.rb +1 -1
- data/lib/chef/provider/package/ips.rb +6 -6
- data/lib/chef/provider/package/macports.rb +6 -6
- data/lib/chef/provider/package/msu.rb +1 -1
- data/lib/chef/provider/package/openbsd.rb +5 -5
- data/lib/chef/provider/package/pacman.rb +4 -4
- data/lib/chef/provider/package/paludis.rb +3 -3
- data/lib/chef/provider/package/portage.rb +5 -5
- data/lib/chef/provider/package/powershell.rb +6 -2
- data/lib/chef/provider/package/rpm.rb +10 -10
- data/lib/chef/provider/package/rubygems.rb +4 -4
- data/lib/chef/provider/package/smartos.rb +4 -4
- data/lib/chef/provider/package/solaris.rb +9 -9
- data/lib/chef/provider/package/windows.rb +4 -3
- data/lib/chef/provider/package/yum.rb +2 -2
- data/lib/chef/provider/package/zypper.rb +4 -4
- data/lib/chef/provider/powershell_script.rb +73 -73
- data/lib/chef/provider/reboot.rb +4 -4
- data/lib/chef/provider/registry_key.rb +4 -4
- data/lib/chef/provider/remote_file/cache_control_data.rb +2 -2
- data/lib/chef/provider/remote_file/sftp.rb +1 -1
- data/lib/chef/provider/resource_update.rb +1 -1
- data/lib/chef/provider/route.rb +2 -2
- data/lib/chef/provider/service/openbsd.rb +3 -3
- data/lib/chef/provider/service/redhat.rb +1 -1
- data/lib/chef/provider/service/simple.rb +1 -0
- data/lib/chef/provider/service/solaris.rb +1 -1
- data/lib/chef/provider/service/systemd.rb +2 -2
- data/lib/chef/provider/service/windows.rb +17 -17
- data/lib/chef/provider/subversion.rb +3 -3
- data/lib/chef/provider/systemd_unit.rb +2 -2
- data/lib/chef/provider/template/content.rb +1 -1
- data/lib/chef/provider/user/aix.rb +6 -6
- data/lib/chef/provider/user/dscl.rb +6 -6
- data/lib/chef/provider/user/linux.rb +6 -6
- data/lib/chef/provider/user/pw.rb +5 -5
- data/lib/chef/provider/user/solaris.rb +6 -6
- data/lib/chef/provider/user/useradd.rb +7 -7
- data/lib/chef/provider/windows_env.rb +6 -6
- data/lib/chef/provider/windows_task.rb +22 -24
- data/lib/chef/resource.rb +26 -4
- data/lib/chef/resource/chef_handler.rb +2 -0
- data/lib/chef/resource/chocolatey_config.rb +83 -0
- data/lib/chef/resource/chocolatey_source.rb +95 -0
- data/lib/chef/resource/cron.rb +5 -5
- data/lib/chef/resource/dsc_script.rb +12 -11
- data/lib/chef/resource/execute.rb +1 -1
- data/lib/chef/resource/file/verification.rb +1 -1
- data/lib/chef/resource/freebsd_package.rb +3 -1
- data/lib/chef/resource/group.rb +2 -2
- data/lib/chef/resource/homebrew_package.rb +2 -1
- data/lib/chef/resource/homebrew_tap.rb +1 -1
- data/lib/chef/resource/hostname.rb +23 -7
- data/lib/chef/resource/http_request.rb +6 -3
- data/lib/chef/resource/ifconfig.rb +57 -17
- data/lib/chef/resource/ips_package.rb +3 -1
- data/lib/chef/resource/kernel_module.rb +129 -0
- data/lib/chef/resource/launchd.rb +205 -98
- data/lib/chef/resource/log.rb +7 -2
- data/lib/chef/resource/mdadm.rb +29 -8
- data/lib/chef/resource/ohai.rb +2 -0
- data/lib/chef/resource/ohai_hint.rb +5 -3
- data/lib/chef/resource/openssl_dhparam.rb +1 -1
- data/lib/chef/resource/openssl_rsa_private_key.rb +2 -0
- data/lib/chef/resource/paludis_package.rb +1 -1
- data/lib/chef/resource/portage_package.rb +2 -0
- data/lib/chef/resource/powershell_package.rb +2 -0
- data/lib/chef/resource/powershell_package_source.rb +165 -0
- data/lib/chef/resource/powershell_script.rb +2 -2
- data/lib/chef/resource/registry_key.rb +1 -1
- data/lib/chef/resource/remote_directory.rb +3 -3
- data/lib/chef/resource/remote_file.rb +2 -2
- data/lib/chef/resource/resource_notification.rb +16 -16
- data/lib/chef/resource/rhsm_errata.rb +1 -1
- data/lib/chef/resource/rhsm_errata_level.rb +1 -1
- data/lib/chef/resource/rhsm_register.rb +4 -4
- data/lib/chef/resource/rhsm_repo.rb +2 -2
- data/lib/chef/resource/rhsm_subscription.rb +2 -2
- data/lib/chef/resource/script.rb +1 -1
- data/lib/chef/resource/service.rb +18 -18
- data/lib/chef/resource/ssh_known_hosts_entry.rb +146 -0
- data/lib/chef/resource/sudo.rb +4 -4
- data/lib/chef/resource/support/ssh_known_hosts.erb +3 -0
- data/lib/chef/resource/sysctl.rb +9 -5
- data/lib/chef/resource/template.rb +1 -1
- data/lib/chef/resource/user.rb +15 -15
- data/lib/chef/resource/windows_feature_dism.rb +10 -9
- data/lib/chef/resource/windows_feature_powershell.rb +24 -13
- data/lib/chef/resource/windows_script.rb +1 -1
- data/lib/chef/resource/windows_service.rb +2 -2
- data/lib/chef/resource/windows_task.rb +3 -3
- data/lib/chef/resource_definition.rb +1 -1
- data/lib/chef/resource_inspector.rb +1 -0
- data/lib/chef/resource_reporter.rb +4 -4
- data/lib/chef/resources.rb +5 -0
- data/lib/chef/role.rb +8 -8
- data/lib/chef/run_context.rb +8 -8
- data/lib/chef/run_list/run_list_expansion.rb +6 -6
- data/lib/chef/run_list/run_list_item.rb +1 -1
- data/lib/chef/run_list/versioned_recipe_list.rb +3 -3
- data/lib/chef/run_status.rb +10 -10
- data/lib/chef/shell.rb +60 -60
- data/lib/chef/shell/ext.rb +151 -151
- data/lib/chef/shell/shell_session.rb +2 -2
- data/lib/chef/user.rb +11 -11
- data/lib/chef/user_v1.rb +26 -26
- data/lib/chef/util/backup.rb +2 -2
- data/lib/chef/util/diff.rb +1 -1
- data/lib/chef/util/dsc/configuration_generator.rb +11 -11
- data/lib/chef/util/dsc/lcm_output_parser.rb +1 -1
- data/lib/chef/util/file_edit.rb +14 -14
- data/lib/chef/util/powershell/cmdlet.rb +4 -4
- data/lib/chef/util/selinux.rb +2 -2
- data/lib/chef/util/windows/net_group.rb +1 -1
- data/lib/chef/util/windows/net_use.rb +3 -3
- data/lib/chef/util/windows/net_user.rb +12 -12
- data/lib/chef/util/windows/volume.rb +2 -2
- data/lib/chef/version.rb +3 -3
- data/lib/chef/version_constraint.rb +3 -3
- data/lib/chef/win32/api.rb +6 -6
- data/lib/chef/win32/api/error.rb +2 -2
- data/lib/chef/win32/api/file.rb +12 -12
- data/lib/chef/win32/api/net.rb +58 -58
- data/lib/chef/win32/registry.rb +8 -8
- data/lib/chef/win32/security.rb +6 -6
- data/lib/chef/win32/security/securable_object.rb +10 -10
- data/lib/chef/win32/unicode.rb +6 -0
- data/lib/chef/win32/version.rb +16 -16
- data/spec/functional/audit/rspec_formatter_spec.rb +1 -1
- data/spec/functional/audit/runner_spec.rb +1 -1
- data/spec/functional/dsl/reboot_pending_spec.rb +3 -3
- data/spec/functional/dsl/registry_helper_spec.rb +3 -3
- data/spec/functional/http/simple_spec.rb +1 -1
- data/spec/functional/knife/exec_spec.rb +1 -1
- data/spec/functional/knife/ssh_spec.rb +2 -2
- data/spec/functional/mixin/shell_out_spec.rb +8 -4
- data/spec/functional/rebooter_spec.rb +6 -6
- data/spec/functional/resource/aixinit_service_spec.rb +2 -2
- data/spec/functional/resource/apt_package_spec.rb +17 -17
- data/spec/functional/resource/bash_spec.rb +1 -1
- data/spec/functional/resource/bff_spec.rb +1 -1
- data/spec/functional/resource/cron_spec.rb +1 -1
- data/spec/functional/resource/dnf_package_spec.rb +7 -7
- data/spec/functional/resource/dsc_script_spec.rb +94 -94
- data/spec/functional/resource/execute_spec.rb +4 -4
- data/spec/functional/resource/file_spec.rb +1 -1
- data/spec/functional/resource/git_spec.rb +19 -19
- data/spec/functional/resource/ifconfig_spec.rb +5 -5
- data/spec/functional/resource/link_spec.rb +1 -1
- data/spec/functional/resource/mount_spec.rb +2 -2
- data/spec/functional/resource/powershell_script_spec.rb +13 -13
- data/spec/functional/resource/reboot_spec.rb +3 -3
- data/spec/functional/resource/registry_spec.rb +82 -82
- data/spec/functional/resource/remote_file_spec.rb +2 -2
- data/spec/functional/resource/rpm_spec.rb +1 -1
- data/spec/functional/resource/template_spec.rb +5 -5
- data/spec/functional/resource/user/dscl_spec.rb +3 -3
- data/spec/functional/resource/windows_env_spec.rb +1 -1
- data/spec/functional/resource/windows_service_spec.rb +1 -1
- data/spec/functional/resource/windows_task_spec.rb +92 -38
- data/spec/functional/resource/yum_package_spec.rb +8 -8
- data/spec/functional/run_lock_spec.rb +4 -4
- data/spec/functional/shell_spec.rb +1 -1
- data/spec/functional/util/powershell/cmdlet_spec.rb +7 -7
- data/spec/functional/version_spec.rb +1 -1
- data/spec/functional/win32/crypto_spec.rb +9 -9
- data/spec/functional/win32/registry_spec.rb +66 -66
- data/spec/integration/client/client_spec.rb +219 -219
- data/spec/integration/client/exit_code_spec.rb +19 -19
- data/spec/integration/client/ipv6_spec.rb +36 -36
- data/spec/integration/knife/chef_fs_data_store_spec.rb +130 -130
- data/spec/integration/knife/chef_repo_path_spec.rb +418 -418
- data/spec/integration/knife/chef_repository_file_system_spec.rb +35 -35
- data/spec/integration/knife/chefignore_spec.rb +88 -88
- data/spec/integration/knife/client_bulk_delete_spec.rb +49 -49
- data/spec/integration/knife/client_create_spec.rb +5 -5
- data/spec/integration/knife/client_delete_spec.rb +13 -13
- data/spec/integration/knife/client_key_delete_spec.rb +2 -2
- data/spec/integration/knife/client_key_list_spec.rb +4 -4
- data/spec/integration/knife/client_list_spec.rb +8 -8
- data/spec/integration/knife/common_options_spec.rb +31 -31
- data/spec/integration/knife/config_get_spec.rb +183 -0
- data/spec/integration/knife/cookbook_api_ipv6_spec.rb +38 -38
- data/spec/integration/knife/cookbook_bulk_delete_spec.rb +14 -14
- data/spec/integration/knife/cookbook_download_spec.rb +12 -12
- data/spec/integration/knife/cookbook_list_spec.rb +8 -8
- data/spec/integration/knife/cookbook_show_spec.rb +81 -81
- data/spec/integration/knife/cookbook_upload_spec.rb +24 -24
- data/spec/integration/knife/data_bag_delete_spec.rb +8 -8
- data/spec/integration/knife/data_bag_from_file_spec.rb +47 -47
- data/spec/integration/knife/data_bag_list_spec.rb +4 -4
- data/spec/integration/knife/data_bag_show_spec.rb +7 -7
- data/spec/integration/knife/delete_spec.rb +593 -593
- data/spec/integration/knife/deps_spec.rb +185 -185
- data/spec/integration/knife/diff_spec.rb +116 -116
- data/spec/integration/knife/download_spec.rb +510 -510
- data/spec/integration/knife/environment_compare_spec.rb +15 -15
- data/spec/integration/knife/environment_from_file_spec.rb +59 -59
- data/spec/integration/knife/environment_list_spec.rb +4 -4
- data/spec/integration/knife/environment_show_spec.rb +25 -25
- data/spec/integration/knife/list_spec.rb +731 -731
- data/spec/integration/knife/node_bulk_delete_spec.rb +8 -8
- data/spec/integration/knife/node_delete_spec.rb +6 -6
- data/spec/integration/knife/node_environment_set_spec.rb +3 -3
- data/spec/integration/knife/node_from_file_spec.rb +16 -16
- data/spec/integration/knife/node_list_spec.rb +5 -5
- data/spec/integration/knife/raw_spec.rb +117 -117
- data/spec/integration/knife/role_bulk_delete_spec.rb +8 -8
- data/spec/integration/knife/role_delete_spec.rb +6 -6
- data/spec/integration/knife/role_from_file_spec.rb +42 -42
- data/spec/integration/knife/role_list_spec.rb +5 -5
- data/spec/integration/knife/role_show_spec.rb +9 -9
- data/spec/integration/knife/show_spec.rb +57 -57
- data/spec/integration/knife/upload_spec.rb +396 -396
- data/spec/integration/recipes/accumulator_spec.rb +2 -2
- data/spec/integration/recipes/lwrp_inline_resources_spec.rb +8 -8
- data/spec/integration/recipes/lwrp_spec.rb +12 -12
- data/spec/integration/recipes/notifies_spec.rb +167 -167
- data/spec/integration/recipes/notifying_block_spec.rb +2 -2
- data/spec/integration/recipes/remote_directory.rb +1 -1
- data/spec/integration/recipes/resource_converge_if_changed_spec.rb +99 -99
- data/spec/integration/recipes/resource_load_spec.rb +8 -8
- data/spec/integration/solo/solo_spec.rb +40 -40
- data/spec/scripts/ssl-serve.rb +12 -12
- data/spec/spec_helper.rb +73 -73
- data/spec/stress/win32/file_spec.rb +2 -2
- data/spec/stress/win32/security_spec.rb +2 -2
- data/spec/support/platform_helpers.rb +1 -1
- data/spec/support/shared/context/client.rb +25 -25
- data/spec/support/shared/functional/securable_resource.rb +13 -13
- data/spec/support/shared/functional/securable_resource_with_reporting.rb +6 -6
- data/spec/support/shared/functional/win32_service.rb +5 -5
- data/spec/support/shared/functional/windows_script.rb +3 -3
- data/spec/support/shared/integration/app_server_support.rb +3 -3
- data/spec/support/shared/integration/integration_helper.rb +2 -2
- data/spec/support/shared/integration/knife_support.rb +9 -3
- data/spec/support/shared/unit/api_error_inspector.rb +6 -6
- data/spec/support/shared/unit/api_versioning.rb +2 -2
- data/spec/support/shared/unit/execute_resource.rb +2 -2
- data/spec/support/shared/unit/provider/file.rb +12 -12
- data/spec/support/shared/unit/provider/useradd_based_user_provider.rb +34 -34
- data/spec/support/shared/unit/user_and_client_shared.rb +3 -3
- data/spec/tiny_server.rb +8 -8
- data/spec/unit/api_client/registration_spec.rb +30 -30
- data/spec/unit/api_client_spec.rb +6 -6
- data/spec/unit/api_client_v1_spec.rb +6 -6
- data/spec/unit/application/apply_spec.rb +4 -4
- data/spec/unit/application/client_spec.rb +11 -11
- data/spec/unit/application/knife_spec.rb +3 -3
- data/spec/unit/application/solo_spec.rb +5 -5
- data/spec/unit/application_spec.rb +11 -11
- data/spec/unit/audit/audit_event_proxy_spec.rb +48 -48
- data/spec/unit/audit/audit_reporter_spec.rb +51 -55
- data/spec/unit/audit/control_group_data_spec.rb +20 -20
- data/spec/unit/audit/runner_spec.rb +2 -2
- data/spec/unit/chef_class_spec.rb +120 -0
- data/spec/unit/chef_fs/data_handler/data_bag_item_data_handler.rb +1 -1
- data/spec/unit/chef_fs/data_handler/data_handler_base_spec.rb +3 -3
- data/spec/unit/chef_fs/diff_spec.rb +45 -45
- data/spec/unit/chef_fs/file_pattern_spec.rb +2 -2
- data/spec/unit/chef_fs/file_system/repository/directory_spec.rb +2 -2
- data/spec/unit/chef_fs/file_system_spec.rb +8 -8
- data/spec/unit/chef_fs/parallelizer.rb +12 -12
- data/spec/unit/client_spec.rb +15 -15
- data/spec/unit/config_fetcher_spec.rb +23 -23
- data/spec/unit/config_spec.rb +2 -2
- data/spec/unit/cookbook/metadata_spec.rb +81 -81
- data/spec/unit/cookbook/synchronizer_spec.rb +171 -171
- data/spec/unit/cookbook_loader_spec.rb +10 -5
- data/spec/unit/cookbook_site_streaming_uploader_spec.rb +6 -6
- data/spec/unit/cookbook_uploader_spec.rb +8 -8
- data/spec/unit/cookbook_version_file_specificity_spec.rb +135 -135
- data/spec/unit/daemon_spec.rb +4 -4
- data/spec/unit/data_bag_item_spec.rb +3 -3
- data/spec/unit/data_bag_spec.rb +1 -1
- data/spec/unit/data_collector/resource_report_spec.rb +1 -1
- data/spec/unit/data_collector_spec.rb +4 -3
- data/spec/unit/deprecated_spec.rb +18 -12
- data/spec/unit/dsl/audit_spec.rb +1 -1
- data/spec/unit/dsl/platform_introspection_spec.rb +16 -16
- data/spec/unit/dsl/reboot_pending_spec.rb +1 -1
- data/spec/unit/environment_spec.rb +16 -16
- data/spec/unit/file_access_control_spec.rb +8 -8
- data/spec/unit/file_content_management/deploy/mv_unix_spec.rb +3 -3
- data/spec/unit/file_content_management/deploy/mv_windows_spec.rb +26 -26
- data/spec/unit/formatters/error_description_spec.rb +39 -39
- data/spec/unit/formatters/error_inspectors/compile_error_inspector_spec.rb +16 -16
- data/spec/unit/formatters/error_inspectors/cookbook_sync_error_inspector_spec.rb +1 -1
- data/spec/unit/formatters/error_inspectors/node_load_error_inspector_spec.rb +1 -1
- data/spec/unit/formatters/error_inspectors/registration_error_inspector_spec.rb +1 -1
- data/spec/unit/formatters/error_inspectors/resource_failure_inspector_spec.rb +1 -1
- data/spec/unit/formatters/error_inspectors/run_list_expansion_error_inspector_spec.rb +5 -5
- data/spec/unit/guard_interpreter/resource_guard_interpreter_spec.rb +4 -4
- data/spec/unit/handler/json_file_spec.rb +1 -1
- data/spec/unit/http/api_versions_spec.rb +1 -1
- data/spec/unit/http/authenticator_spec.rb +17 -17
- data/spec/unit/http/ssl_policies_spec.rb +1 -1
- data/spec/unit/http/validate_content_length_spec.rb +2 -2
- data/spec/unit/key_spec.rb +12 -12
- data/spec/unit/knife/bootstrap/client_builder_spec.rb +3 -3
- data/spec/unit/knife/client_bulk_delete_spec.rb +1 -1
- data/spec/unit/knife/client_delete_spec.rb +1 -1
- data/spec/unit/knife/client_reregister_spec.rb +1 -1
- data/spec/unit/knife/configure_client_spec.rb +4 -4
- 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 +4 -4
- data/spec/unit/knife/cookbook_download_spec.rb +21 -21
- data/spec/unit/knife/cookbook_list_spec.rb +7 -7
- data/spec/unit/knife/cookbook_show_spec.rb +24 -24
- data/spec/unit/knife/cookbook_site_download_spec.rb +23 -23
- data/spec/unit/knife/cookbook_site_install_spec.rb +4 -4
- data/spec/unit/knife/cookbook_site_share_spec.rb +10 -10
- data/spec/unit/knife/cookbook_site_unshare_spec.rb +2 -2
- data/spec/unit/knife/cookbook_upload_spec.rb +19 -19
- data/spec/unit/knife/core/bootstrap_context_spec.rb +37 -37
- data/spec/unit/knife/core/cookbook_scm_repo_spec.rb +20 -20
- data/spec/unit/knife/core/object_loader_spec.rb +1 -1
- data/spec/unit/knife/core/ui_spec.rb +55 -55
- data/spec/unit/knife/data_bag_create_spec.rb +2 -2
- data/spec/unit/knife/data_bag_edit_spec.rb +1 -1
- data/spec/unit/knife/data_bag_secret_options_spec.rb +5 -5
- data/spec/unit/knife/environment_from_file_spec.rb +1 -1
- data/spec/unit/knife/key_create_spec.rb +4 -4
- data/spec/unit/knife/key_delete_spec.rb +3 -3
- data/spec/unit/knife/key_edit_spec.rb +3 -3
- data/spec/unit/knife/key_list_spec.rb +3 -3
- data/spec/unit/knife/key_show_spec.rb +3 -3
- data/spec/unit/knife/node_delete_spec.rb +1 -1
- data/spec/unit/knife/node_edit_spec.rb +7 -7
- data/spec/unit/knife/node_from_file_spec.rb +1 -1
- data/spec/unit/knife/node_run_list_add_spec.rb +1 -1
- data/spec/unit/knife/osc_user_edit_spec.rb +1 -1
- data/spec/unit/knife/osc_user_reregister_spec.rb +1 -1
- data/spec/unit/knife/role_bulk_delete_spec.rb +1 -1
- 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_env_run_list_add_spec.rb +4 -4
- 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 +4 -4
- 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 +25 -25
- data/spec/unit/knife/ssl_check_spec.rb +23 -23
- data/spec/unit/knife/ssl_fetch_spec.rb +11 -11
- data/spec/unit/knife/user_delete_spec.rb +1 -1
- data/spec/unit/knife/user_reregister_spec.rb +1 -1
- data/spec/unit/knife_spec.rb +26 -26
- data/spec/unit/log/syslog_spec.rb +1 -1
- data/spec/unit/lwrp_spec.rb +4 -4
- data/spec/unit/mash_spec.rb +3 -3
- data/spec/unit/mixin/api_version_request_handling_spec.rb +16 -16
- data/spec/unit/mixin/checksum_spec.rb +1 -1
- data/spec/unit/mixin/enforce_ownership_and_permissions_spec.rb +8 -8
- data/spec/unit/mixin/homebrew_user_spec.rb +1 -1
- data/spec/unit/mixin/params_validate_spec.rb +96 -96
- data/spec/unit/mixin/powershell_exec_spec.rb +1 -1
- data/spec/unit/mixin/powershell_type_coercions_spec.rb +1 -1
- data/spec/unit/mixin/securable_spec.rb +27 -27
- data/spec/unit/mixin/shell_out_spec.rb +286 -132
- data/spec/unit/mixin/user_context_spec.rb +1 -1
- data/spec/unit/mixin/xml_escape_spec.rb +1 -1
- data/spec/unit/node/attribute_spec.rb +10 -10
- data/spec/unit/node/vivid_mash_spec.rb +3 -3
- data/spec/unit/node_map_spec.rb +71 -3
- data/spec/unit/node_spec.rb +15 -15
- data/spec/unit/org_spec.rb +2 -2
- data/spec/unit/platform/query_helpers_spec.rb +26 -26
- data/spec/unit/policy_builder/expand_node_object_spec.rb +4 -4
- data/spec/unit/policy_builder/policyfile_spec.rb +29 -29
- data/spec/unit/property_spec.rb +5 -5
- data/spec/unit/provider/apt_repository_spec.rb +19 -19
- data/spec/unit/provider/cookbook_file/content_spec.rb +1 -1
- data/spec/unit/provider/cookbook_file_spec.rb +1 -1
- data/spec/unit/provider/cron/unix_spec.rb +12 -12
- data/spec/unit/provider/cron_spec.rb +279 -279
- data/spec/unit/provider/dsc_resource_spec.rb +6 -6
- data/spec/unit/provider/execute_spec.rb +2 -2
- data/spec/unit/provider/file/content_spec.rb +1 -1
- data/spec/unit/provider/file_spec.rb +1 -1
- data/spec/unit/provider/git_spec.rb +123 -123
- data/spec/unit/provider/group/dscl_spec.rb +18 -18
- data/spec/unit/provider/group/gpasswd_spec.rb +7 -7
- data/spec/unit/provider/group/groupadd_spec.rb +7 -7
- data/spec/unit/provider/group/groupmod_spec.rb +13 -13
- data/spec/unit/provider/group/pw_spec.rb +4 -4
- data/spec/unit/provider/group/suse_spec.rb +2 -2
- data/spec/unit/provider/group/usermod_spec.rb +4 -4
- data/spec/unit/provider/group_spec.rb +3 -3
- data/spec/unit/provider/ifconfig/aix_spec.rb +17 -17
- data/spec/unit/provider/ifconfig/debian_spec.rb +16 -16
- data/spec/unit/provider/ifconfig_spec.rb +16 -16
- data/spec/unit/provider/launchd_spec.rb +52 -52
- data/spec/unit/provider/link_spec.rb +7 -7
- data/spec/unit/provider/mdadm_spec.rb +3 -3
- data/spec/unit/provider/mount/aix_spec.rb +39 -39
- data/spec/unit/provider/mount/mount_spec.rb +26 -26
- data/spec/unit/provider/mount/solaris_spec.rb +2 -2
- data/spec/unit/provider/mount/windows_spec.rb +6 -6
- data/spec/unit/provider/ohai_spec.rb +9 -9
- data/spec/unit/provider/osx_profile_spec.rb +1 -1
- data/spec/unit/provider/package/apt_spec.rb +186 -186
- data/spec/unit/provider/package/bff_spec.rb +36 -36
- data/spec/unit/provider/package/cab_spec.rb +58 -58
- data/spec/unit/provider/package/chocolatey_spec.rb +34 -34
- data/spec/unit/provider/package/dpkg_spec.rb +33 -33
- data/spec/unit/provider/package/freebsd/pkg_spec.rb +35 -35
- data/spec/unit/provider/package/freebsd/pkgng_spec.rb +22 -22
- data/spec/unit/provider/package/freebsd/port_spec.rb +21 -21
- data/spec/unit/provider/package/homebrew_spec.rb +4 -4
- data/spec/unit/provider/package/ips_spec.rb +94 -94
- data/spec/unit/provider/package/macports_spec.rb +23 -23
- data/spec/unit/provider/package/msu_spec.rb +44 -44
- data/spec/unit/provider/package/openbsd_spec.rb +19 -19
- data/spec/unit/provider/package/pacman_spec.rb +50 -50
- data/spec/unit/provider/package/paludis_spec.rb +33 -33
- data/spec/unit/provider/package/portage_spec.rb +25 -25
- data/spec/unit/provider/package/powershell_spec.rb +98 -85
- data/spec/unit/provider/package/rpm_spec.rb +21 -21
- data/spec/unit/provider/package/rubygems_spec.rb +71 -71
- data/spec/unit/provider/package/smartos_spec.rb +21 -21
- data/spec/unit/provider/package/solaris_spec.rb +38 -38
- data/spec/unit/provider/package/windows/exe_spec.rb +1 -1
- data/spec/unit/provider/package/windows/msi_spec.rb +1 -1
- data/spec/unit/provider/package/windows_spec.rb +11 -4
- data/spec/unit/provider/package/zypper_spec.rb +42 -46
- data/spec/unit/provider/package_spec.rb +2 -2
- data/spec/unit/provider/powershell_script_spec.rb +1 -1
- data/spec/unit/provider/registry_key_spec.rb +22 -22
- data/spec/unit/provider/remote_file/cache_control_data_spec.rb +7 -7
- data/spec/unit/provider/remote_file/content_spec.rb +4 -4
- data/spec/unit/provider/remote_file/fetcher_spec.rb +5 -5
- data/spec/unit/provider/remote_file/ftp_spec.rb +1 -1
- data/spec/unit/provider/remote_file/http_spec.rb +1 -1
- data/spec/unit/provider/remote_file/local_file_spec.rb +2 -2
- data/spec/unit/provider/remote_file/network_file_spec.rb +3 -3
- data/spec/unit/provider/remote_file/sftp_spec.rb +2 -2
- data/spec/unit/provider/remote_file_spec.rb +1 -1
- data/spec/unit/provider/script_spec.rb +1 -1
- data/spec/unit/provider/service/aix_service_spec.rb +8 -8
- data/spec/unit/provider/service/aixinit_service_spec.rb +3 -3
- data/spec/unit/provider/service/arch_service_spec.rb +21 -21
- data/spec/unit/provider/service/debian_service_spec.rb +2 -2
- data/spec/unit/provider/service/freebsd_service_spec.rb +30 -30
- data/spec/unit/provider/service/gentoo_service_spec.rb +1 -1
- data/spec/unit/provider/service/init_service_spec.rb +14 -14
- data/spec/unit/provider/service/insserv_service_spec.rb +2 -2
- data/spec/unit/provider/service/invokercd_service_spec.rb +17 -17
- data/spec/unit/provider/service/macosx_spec.rb +59 -59
- data/spec/unit/provider/service/openbsd_service_spec.rb +6 -6
- data/spec/unit/provider/service/redhat_spec.rb +27 -27
- data/spec/unit/provider/service/simple_service_spec.rb +14 -14
- data/spec/unit/provider/service/solaris_smf_service_spec.rb +19 -19
- data/spec/unit/provider/service/systemd_service_spec.rb +13 -13
- data/spec/unit/provider/service/upstart_service_spec.rb +5 -5
- data/spec/unit/provider/service/windows_spec.rb +38 -38
- data/spec/unit/provider/service_spec.rb +3 -3
- data/spec/unit/provider/subversion_spec.rb +13 -13
- data/spec/unit/provider/systemd_unit_spec.rb +10 -10
- data/spec/unit/provider/template/content_spec.rb +44 -44
- data/spec/unit/provider/template_spec.rb +2 -2
- data/spec/unit/provider/user/aix_spec.rb +5 -5
- data/spec/unit/provider/user/dscl_spec.rb +12 -12
- data/spec/unit/provider/user/pw_spec.rb +12 -12
- data/spec/unit/provider/user/solaris_spec.rb +6 -6
- data/spec/unit/provider/windows_env_spec.rb +2 -2
- data/spec/unit/provider/windows_task_spec.rb +16 -16
- data/spec/unit/provider/zypper_repository_spec.rb +7 -7
- data/spec/unit/provider_resolver_spec.rb +3 -3
- data/spec/unit/recipe_spec.rb +13 -13
- data/spec/unit/resource/chocolatey_config_spec.rb +98 -0
- data/spec/unit/resource/chocolatey_source_spec.rb +102 -0
- data/spec/unit/resource/conditional_spec.rb +1 -1
- data/spec/unit/resource/cookbook_file_spec.rb +3 -3
- data/spec/unit/resource/dnf_package_spec.rb +3 -3
- data/spec/unit/resource/dsc_script_spec.rb +10 -10
- data/spec/unit/resource/execute_spec.rb +2 -2
- data/spec/unit/resource/file/verification/systemd_unit_spec.rb +1 -1
- data/spec/unit/resource/file/verification_spec.rb +1 -1
- data/spec/unit/resource/file_spec.rb +3 -3
- data/spec/unit/resource/freebsd_package_spec.rb +5 -4
- data/spec/unit/resource/group_spec.rb +4 -4
- data/spec/unit/resource/kernel_module_spec.rb +48 -0
- data/spec/unit/resource/mount_spec.rb +13 -3
- data/spec/unit/resource/package_spec.rb +2 -2
- data/spec/unit/resource/powershell_package_source_spec.rb +219 -0
- data/spec/unit/resource/powershell_package_spec.rb +10 -1
- data/spec/unit/resource/powershell_script_spec.rb +8 -8
- data/spec/unit/resource/registry_key_spec.rb +19 -19
- data/spec/unit/resource/remote_file_spec.rb +2 -2
- data/spec/unit/resource/resource_notification_spec.rb +8 -8
- data/spec/unit/resource/service_spec.rb +3 -3
- data/spec/unit/resource/ssh_known_hosts_entry_spec.rb +55 -0
- data/spec/unit/resource/template_spec.rb +2 -2
- data/spec/unit/resource/user_spec.rb +2 -2
- data/spec/unit/resource/windows_feature_dism.rb +5 -5
- data/spec/unit/resource/windows_feature_powershell.rb +27 -6
- data/spec/unit/resource/yum_package_spec.rb +3 -3
- data/spec/unit/resource_collection/resource_set_spec.rb +6 -6
- data/spec/unit/resource_collection_spec.rb +5 -5
- data/spec/unit/resource_definition_spec.rb +2 -2
- data/spec/unit/resource_inspector_spec.rb +3 -3
- data/spec/unit/resource_reporter_spec.rb +24 -24
- data/spec/unit/resource_spec.rb +65 -31
- data/spec/unit/role_spec.rb +22 -22
- data/spec/unit/run_context_spec.rb +1 -1
- data/spec/unit/run_list/run_list_item_spec.rb +3 -3
- data/spec/unit/run_list/versioned_recipe_list_spec.rb +12 -12
- data/spec/unit/run_list_spec.rb +6 -6
- data/spec/unit/runner_spec.rb +4 -4
- data/spec/unit/scan_access_control_spec.rb +3 -3
- data/spec/unit/shell/model_wrapper_spec.rb +4 -4
- data/spec/unit/shell/shell_ext_spec.rb +4 -4
- data/spec/unit/shell/shell_session_spec.rb +28 -28
- data/spec/unit/user_spec.rb +2 -2
- data/spec/unit/user_v1_spec.rb +25 -25
- data/spec/unit/util/diff_spec.rb +1 -1
- data/spec/unit/util/dsc/configuration_generator_spec.rb +4 -4
- data/spec/unit/util/dsc/lcm_output_parser_spec.rb +105 -105
- data/spec/unit/util/dsc/local_configuration_manager_spec.rb +16 -16
- data/spec/unit/util/file_edit_spec.rb +38 -38
- data/spec/unit/util/powershell/cmdlet_spec.rb +1 -1
- data/spec/unit/util/selinux_spec.rb +10 -10
- data/spec/unit/win32/registry_spec.rb +3 -3
- data/spec/unit/windows_service_spec.rb +2 -2
- data/tasks/cbgb.rb +3 -3
- data/tasks/dependencies.rb +6 -8
- data/tasks/maintainers.rb +7 -7
- data/tasks/rspec.rb +2 -2
- metadata +20 -79
- data/acceptance/.shared/kitchen_acceptance/.kitchen.digitalocean.yml +0 -33
- data/acceptance/.shared/kitchen_acceptance/.kitchen.ec2.yml +0 -272
- data/acceptance/.shared/kitchen_acceptance/.kitchen.vagrant.yml +0 -57
- data/acceptance/.shared/kitchen_acceptance/libraries/kitchen.rb +0 -68
- data/acceptance/.shared/kitchen_acceptance/metadata.rb +0 -1
- data/acceptance/Gemfile +0 -19
- data/acceptance/Gemfile.lock +0 -266
- data/acceptance/README.md +0 -137
- data/acceptance/basics/.acceptance/acceptance-cookbook/.gitignore +0 -2
- data/acceptance/basics/.acceptance/acceptance-cookbook/metadata.rb +0 -3
- data/acceptance/basics/.acceptance/acceptance-cookbook/recipes/destroy.rb +0 -1
- data/acceptance/basics/.acceptance/acceptance-cookbook/recipes/provision.rb +0 -1
- data/acceptance/basics/.acceptance/acceptance-cookbook/recipes/verify.rb +0 -1
- data/acceptance/basics/.kitchen.yml +0 -4
- data/acceptance/basics/test/integration/chef-current-install/serverspec/chef_client_spec.rb +0 -19
- data/acceptance/basics/test/integration/chef-current-install/serverspec/spec_helper.rb +0 -6
- data/acceptance/basics/test/integration/helpers/serverspec/Gemfile +0 -8
- data/acceptance/data-collector/.acceptance/acceptance-cookbook/.gitignore +0 -2
- data/acceptance/data-collector/.acceptance/acceptance-cookbook/metadata.rb +0 -3
- data/acceptance/data-collector/.acceptance/acceptance-cookbook/recipes/destroy.rb +0 -2
- data/acceptance/data-collector/.acceptance/acceptance-cookbook/recipes/provision.rb +0 -2
- data/acceptance/data-collector/.acceptance/acceptance-cookbook/recipes/verify.rb +0 -2
- data/acceptance/data-collector/.acceptance/data-collector-test/.gitignore +0 -16
- data/acceptance/data-collector/.acceptance/data-collector-test/Berksfile +0 -3
- data/acceptance/data-collector/.acceptance/data-collector-test/files/default/api.rb +0 -101
- data/acceptance/data-collector/.acceptance/data-collector-test/files/default/apigemfile +0 -3
- data/acceptance/data-collector/.acceptance/data-collector-test/files/default/client-rb-both-mode.rb +0 -4
- data/acceptance/data-collector/.acceptance/data-collector-test/files/default/client-rb-client-mode.rb +0 -4
- data/acceptance/data-collector/.acceptance/data-collector-test/files/default/client-rb-no-endpoint.rb +0 -2
- data/acceptance/data-collector/.acceptance/data-collector-test/files/default/client-rb-solo-mode.rb +0 -4
- data/acceptance/data-collector/.acceptance/data-collector-test/files/default/config.ru +0 -2
- data/acceptance/data-collector/.acceptance/data-collector-test/metadata.rb +0 -7
- data/acceptance/data-collector/.acceptance/data-collector-test/recipes/default.rb +0 -44
- data/acceptance/data-collector/.kitchen.yml +0 -9
- data/acceptance/data-collector/Berksfile +0 -3
- data/acceptance/data-collector/test/integration/default/serverspec/default_spec.rb +0 -208
- data/acceptance/data-collector/test/integration/helpers/serverspec/Gemfile +0 -8
- data/acceptance/omnitruck/.acceptance/acceptance-cookbook/.gitignore +0 -2
- data/acceptance/omnitruck/.acceptance/acceptance-cookbook/metadata.rb +0 -1
- data/acceptance/omnitruck/.acceptance/acceptance-cookbook/recipes/destroy.rb +0 -1
- data/acceptance/omnitruck/.acceptance/acceptance-cookbook/recipes/provision.rb +0 -1
- data/acceptance/omnitruck/.acceptance/acceptance-cookbook/recipes/verify.rb +0 -61
- data/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/.gitignore +0 -2
- data/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/cookbook_kitchen.rb +0 -43
- data/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/top_cookbooks.rb +0 -41
- data/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/metadata.rb +0 -3
- data/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/recipes/destroy.rb +0 -1
- data/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/recipes/provision.rb +0 -1
- data/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/recipes/verify.rb +0 -1
- data/acceptance/top-cookbooks/.gitignore +0 -1
- data/acceptance/top-cookbooks/.kitchen.chocolatey.yml +0 -6
- data/acceptance/top-cookbooks/.kitchen.iis.yml +0 -4
- data/acceptance/top-cookbooks/.kitchen.learn-the-basics-rhel.yml +0 -7
- data/acceptance/top-cookbooks/.kitchen.learn-the-basics-ubuntu.yml +0 -7
- data/acceptance/top-cookbooks/.kitchen.learn-the-basics-windows.yml +0 -7
- data/acceptance/top-cookbooks/.kitchen.powershell.yml +0 -4
- data/acceptance/top-cookbooks/.kitchen.sql_server.yml +0 -5
- data/acceptance/top-cookbooks/.kitchen.winbox.yml +0 -8
- data/acceptance/top-cookbooks/.kitchen.windows.yml +0 -38
- data/acceptance/trivial/.acceptance/acceptance-cookbook/.gitignore +0 -2
- data/acceptance/trivial/.acceptance/acceptance-cookbook/metadata.rb +0 -2
- data/acceptance/trivial/.acceptance/acceptance-cookbook/recipes/destroy.rb +0 -1
- data/acceptance/trivial/.acceptance/acceptance-cookbook/recipes/provision.rb +0 -1
- data/acceptance/trivial/.acceptance/acceptance-cookbook/recipes/verify.rb +0 -1
- data/acceptance/trivial/.kitchen.yml +0 -7
- data/acceptance/trivial/test/integration/chef-current-install/inspec/chef_client_spec.rb +0 -5
- data/acceptance/windows-service/.acceptance/acceptance-cookbook/.gitignore +0 -2
- data/acceptance/windows-service/.acceptance/acceptance-cookbook/metadata.rb +0 -2
- data/acceptance/windows-service/.acceptance/acceptance-cookbook/recipes/destroy.rb +0 -1
- data/acceptance/windows-service/.acceptance/acceptance-cookbook/recipes/provision.rb +0 -1
- data/acceptance/windows-service/.acceptance/acceptance-cookbook/recipes/verify.rb +0 -1
- data/acceptance/windows-service/.kitchen.yml +0 -7
- data/acceptance/windows-service/test/integration/chef-windows-service/inspec/chef_windows_service_spec.rb +0 -58
- data/distro/powershell/chef/Chef.PowerShell.dll +0 -0
data/lib/chef/log.rb
CHANGED
@@ -46,19 +46,21 @@ class Chef
|
|
46
46
|
#
|
47
47
|
def self.caller_location
|
48
48
|
# Pick the first caller that is *not* part of the Chef gem, that's the
|
49
|
-
# thing the user wrote.
|
49
|
+
# thing the user wrote. Or failing that, the most recent caller.
|
50
50
|
chef_gem_path = File.expand_path("../..", __FILE__)
|
51
|
-
caller(0..20).find { |c| !c.start_with?(chef_gem_path) }
|
51
|
+
caller(0..20).find { |c| !c.start_with?(chef_gem_path) } || caller(0..1)[0]
|
52
52
|
end
|
53
53
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
54
|
+
# Log a deprecation warning.
|
55
|
+
#
|
56
|
+
# If the treat_deprecation_warnings_as_errors config option is set, this
|
57
|
+
# will raise an exception instead.
|
58
|
+
#
|
59
|
+
# @param msg [String] Deprecation message to display.
|
60
|
+
def self.deprecation(msg, &block)
|
59
61
|
if Chef::Config[:treat_deprecation_warnings_as_errors]
|
60
62
|
error(msg, &block)
|
61
|
-
raise Chef::Exceptions::DeprecatedFeatureError.new(msg
|
63
|
+
raise Chef::Exceptions::DeprecatedFeatureError.new(msg)
|
62
64
|
else
|
63
65
|
warn(msg, &block)
|
64
66
|
end
|
data/lib/chef/log/winevt.rb
CHANGED
@@ -36,7 +36,7 @@ class Chef
|
|
36
36
|
FATAL_EVENT_ID = 10104
|
37
37
|
|
38
38
|
# Since we must install the event logger, this is not really configurable
|
39
|
-
SOURCE = "Chef"
|
39
|
+
SOURCE = "Chef".freeze
|
40
40
|
|
41
41
|
include Chef::Mixin::Unformatter
|
42
42
|
|
@@ -51,46 +51,46 @@ class Chef
|
|
51
51
|
|
52
52
|
def info(msg)
|
53
53
|
@eventlog.report_event(
|
54
|
-
:
|
55
|
-
:
|
56
|
-
:
|
57
|
-
:
|
54
|
+
event_type: ::Win32::EventLog::INFO_TYPE,
|
55
|
+
source: SOURCE,
|
56
|
+
event_id: INFO_EVENT_ID,
|
57
|
+
data: [msg]
|
58
58
|
)
|
59
59
|
end
|
60
60
|
|
61
61
|
def warn(msg)
|
62
62
|
@eventlog.report_event(
|
63
|
-
:
|
64
|
-
:
|
65
|
-
:
|
66
|
-
:
|
63
|
+
event_type: ::Win32::EventLog::WARN_TYPE,
|
64
|
+
source: SOURCE,
|
65
|
+
event_id: WARN_EVENT_ID,
|
66
|
+
data: [msg]
|
67
67
|
)
|
68
68
|
end
|
69
69
|
|
70
70
|
def debug(msg)
|
71
71
|
@eventlog.report_event(
|
72
|
-
:
|
73
|
-
:
|
74
|
-
:
|
75
|
-
:
|
72
|
+
event_type: ::Win32::EventLog::INFO_TYPE,
|
73
|
+
source: SOURCE,
|
74
|
+
event_id: DEBUG_EVENT_ID,
|
75
|
+
data: [msg]
|
76
76
|
)
|
77
77
|
end
|
78
78
|
|
79
79
|
def error(msg)
|
80
80
|
@eventlog.report_event(
|
81
|
-
:
|
82
|
-
:
|
83
|
-
:
|
84
|
-
:
|
81
|
+
event_type: ::Win32::EventLog::ERROR_TYPE,
|
82
|
+
source: SOURCE,
|
83
|
+
event_id: ERROR_EVENT_ID,
|
84
|
+
data: [msg]
|
85
85
|
)
|
86
86
|
end
|
87
87
|
|
88
88
|
def fatal(msg)
|
89
89
|
@eventlog.report_event(
|
90
|
-
:
|
91
|
-
:
|
92
|
-
:
|
93
|
-
:
|
90
|
+
event_type: ::Win32::EventLog::ERROR_TYPE,
|
91
|
+
source: SOURCE,
|
92
|
+
event_id: FATAL_EVENT_ID,
|
93
|
+
data: [msg]
|
94
94
|
)
|
95
95
|
end
|
96
96
|
|
@@ -50,12 +50,12 @@ class Chef
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def reregister_only_v0_supported_error_msg(max_version, min_version)
|
53
|
-
|
54
|
-
The reregister command only supports server API version 0.
|
55
|
-
The server that received the request supports a min version of #{min_version} and a max version of #{max_version}.
|
56
|
-
User keys are now managed via the key rotation commmands.
|
57
|
-
Please refer to the documentation on how to manage your keys via the key rotation commands:
|
58
|
-
https://docs.chef.io/server_security.html#key-rotation
|
53
|
+
<<~EOH
|
54
|
+
The reregister command only supports server API version 0.
|
55
|
+
The server that received the request supports a min version of #{min_version} and a max version of #{max_version}.
|
56
|
+
User keys are now managed via the key rotation commmands.
|
57
|
+
Please refer to the documentation on how to manage your keys via the key rotation commands:
|
58
|
+
https://docs.chef.io/server_security.html#key-rotation
|
59
59
|
EOH
|
60
60
|
end
|
61
61
|
|
@@ -106,7 +106,7 @@ class Chef
|
|
106
106
|
if merge_onto.kind_of?(Hash) && merge_with.kind_of?(Hash)
|
107
107
|
merge_with.each do |key, merge_with_value|
|
108
108
|
value =
|
109
|
-
if merge_onto.
|
109
|
+
if merge_onto.key?(key)
|
110
110
|
hash_only_merge(merge_onto[key], merge_with_value)
|
111
111
|
else
|
112
112
|
merge_with_value
|
@@ -33,7 +33,7 @@ class Chef
|
|
33
33
|
# Chef::Mixin::RecipeDefinitionDSLCore is deprecated, use Chef::DSL::Recipe instead.
|
34
34
|
# EOM
|
35
35
|
def self.deprecate_constant(name, replacement, message)
|
36
|
-
deprecated_constants[name] = { :
|
36
|
+
deprecated_constants[name] = { replacement: replacement, message: message }
|
37
37
|
end
|
38
38
|
|
39
39
|
# Const missing hook to look up deprecated constants defined with
|
@@ -54,7 +54,7 @@ class Chef
|
|
54
54
|
module Deprecation
|
55
55
|
|
56
56
|
class DeprecatedObjectProxyBase
|
57
|
-
KEEPERS = %w{__id__ __send__ instance_eval == equal? initialize object_id}
|
57
|
+
KEEPERS = %w{__id__ __send__ instance_eval == equal? initialize object_id}.freeze
|
58
58
|
instance_methods.each { |method_name| undef_method(method_name) unless KEEPERS.include?(method_name.to_s) }
|
59
59
|
end
|
60
60
|
|
@@ -106,7 +106,7 @@ class Chef
|
|
106
106
|
when false
|
107
107
|
true
|
108
108
|
when Hash
|
109
|
-
@validation_message[key] = validation.delete(:validation_message) if validation.
|
109
|
+
@validation_message[key] = validation.delete(:validation_message) if validation.key?(:validation_message)
|
110
110
|
validation.each do |check, carg|
|
111
111
|
check_method = "_pv_#{check}"
|
112
112
|
if respond_to?(check_method, true)
|
@@ -132,14 +132,14 @@ class Chef
|
|
132
132
|
private
|
133
133
|
|
134
134
|
def _validation_message(key, default)
|
135
|
-
@validation_message.
|
135
|
+
@validation_message.key?(key) ? @validation_message[key] : default
|
136
136
|
end
|
137
137
|
|
138
138
|
# Return the value of a parameter, or nil if it doesn't exist.
|
139
139
|
def _pv_opts_lookup(opts, key)
|
140
|
-
if opts.
|
140
|
+
if opts.key?(key.to_s)
|
141
141
|
opts[key.to_s]
|
142
|
-
elsif opts.
|
142
|
+
elsif opts.key?(key.to_sym)
|
143
143
|
opts[key.to_sym]
|
144
144
|
else
|
145
145
|
nil
|
@@ -149,8 +149,8 @@ class Chef
|
|
149
149
|
# Raise an exception if the parameter is not found.
|
150
150
|
def _pv_required(opts, key, is_required = true, explicitly_allows_nil = false)
|
151
151
|
if is_required
|
152
|
-
return true if opts.
|
153
|
-
return true if opts.
|
152
|
+
return true if opts.key?(key.to_s) && (explicitly_allows_nil || !opts[key.to_s].nil?)
|
153
|
+
return true if opts.key?(key.to_sym) && (explicitly_allows_nil || !opts[key.to_sym].nil?)
|
154
154
|
raise Exceptions::ValidationFailed, _validation_message(key, "Required argument #{key.inspect} is missing!")
|
155
155
|
end
|
156
156
|
true
|
@@ -404,7 +404,7 @@ class Chef
|
|
404
404
|
# ```
|
405
405
|
#
|
406
406
|
def _pv_is(opts, key, to_be)
|
407
|
-
return true if !opts.
|
407
|
+
return true if !opts.key?(key.to_s) && !opts.key?(key.to_sym)
|
408
408
|
value = _pv_opts_lookup(opts, key)
|
409
409
|
to_be = [ to_be ].flatten(1)
|
410
410
|
errors = []
|
@@ -454,10 +454,10 @@ class Chef
|
|
454
454
|
# ```
|
455
455
|
#
|
456
456
|
def _pv_coerce(opts, key, coercer)
|
457
|
-
if opts.
|
457
|
+
if opts.key?(key.to_s)
|
458
458
|
raise Exceptions::CannotValidateStaticallyError, "coerce must be evaluated for each resource." if self == Chef::Mixin::ParamsValidate
|
459
459
|
opts[key.to_s] = instance_exec(opts[key], &coercer)
|
460
|
-
elsif opts.
|
460
|
+
elsif opts.key?(key.to_sym)
|
461
461
|
raise Exceptions::CannotValidateStaticallyError, "coerce must be evaluated for each resource." if self == Chef::Mixin::ParamsValidate
|
462
462
|
opts[key.to_sym] = instance_exec(opts[key], &coercer)
|
463
463
|
end
|
@@ -102,14 +102,14 @@ class Chef
|
|
102
102
|
|
103
103
|
options = options.inject({}) { |memo, (key, value)| memo[key.to_sym] = value; memo }
|
104
104
|
|
105
|
-
options[:instance_variable_name] = :"@#{name}" if !options.
|
105
|
+
options[:instance_variable_name] = :"@#{name}" if !options.key?(:instance_variable_name)
|
106
106
|
options[:name] = name
|
107
107
|
options[:declared_in] = self
|
108
108
|
|
109
109
|
if type == NOT_PASSED
|
110
110
|
# If a type is not passed, the property derives from the
|
111
111
|
# superclass property (if any)
|
112
|
-
if properties.
|
112
|
+
if properties.key?(name)
|
113
113
|
property = properties[name].derive(**options)
|
114
114
|
else
|
115
115
|
property = property_type(**options)
|
data/lib/chef/mixin/securable.rb
CHANGED
@@ -24,7 +24,7 @@ class Chef
|
|
24
24
|
set_or_return(
|
25
25
|
:owner,
|
26
26
|
arg,
|
27
|
-
:
|
27
|
+
regex: Chef::Config[:user_valid_regex]
|
28
28
|
)
|
29
29
|
end
|
30
30
|
|
@@ -34,7 +34,7 @@ class Chef
|
|
34
34
|
set_or_return(
|
35
35
|
:group,
|
36
36
|
arg,
|
37
|
-
:
|
37
|
+
regex: Chef::Config[:group_valid_regex]
|
38
38
|
)
|
39
39
|
end
|
40
40
|
|
@@ -42,7 +42,7 @@ class Chef
|
|
42
42
|
set_or_return(
|
43
43
|
:mode,
|
44
44
|
arg,
|
45
|
-
:
|
45
|
+
callbacks: {
|
46
46
|
"not in valid numeric range" => lambda do |m|
|
47
47
|
if m.kind_of?(String)
|
48
48
|
m =~ /^0/ || m = "0#{m}"
|
@@ -110,16 +110,16 @@ class Chef
|
|
110
110
|
rights = instance_variable_get("@#{name}".to_sym)
|
111
111
|
unless permissions.nil?
|
112
112
|
input = {
|
113
|
-
:
|
114
|
-
:
|
113
|
+
permissions: permissions,
|
114
|
+
principals: principals,
|
115
115
|
}
|
116
116
|
input.merge!(args_hash) unless args_hash.nil?
|
117
117
|
|
118
|
-
validations = { :
|
119
|
-
:
|
120
|
-
:
|
121
|
-
:
|
122
|
-
:
|
118
|
+
validations = { permissions: { required: true },
|
119
|
+
principals: { required: true, kind_of: [String, Array] },
|
120
|
+
applies_to_children: { equal_to: [ true, false, :containers_only, :objects_only ] },
|
121
|
+
applies_to_self: { kind_of: [ TrueClass, FalseClass ] },
|
122
|
+
one_level_deep: { kind_of: [ TrueClass, FalseClass ] },
|
123
123
|
}
|
124
124
|
validate(input, validations)
|
125
125
|
|
@@ -167,7 +167,7 @@ class Chef
|
|
167
167
|
set_or_return(
|
168
168
|
:inherits,
|
169
169
|
arg,
|
170
|
-
:
|
170
|
+
kind_of: [ TrueClass, FalseClass ]
|
171
171
|
)
|
172
172
|
end
|
173
173
|
end
|
data/lib/chef/mixin/shell_out.rb
CHANGED
@@ -21,88 +21,138 @@ require "chef/mixin/path_sanity"
|
|
21
21
|
class Chef
|
22
22
|
module Mixin
|
23
23
|
module ShellOut
|
24
|
-
|
24
|
+
extend Chef::Mixin::PathSanity
|
25
25
|
|
26
26
|
# PREFERRED APIS:
|
27
27
|
#
|
28
|
-
#
|
29
|
-
# the resultant array to shell_out. this actually eliminates spaces-in-args bugs because this:
|
28
|
+
# all consumers should now call shell_out!/shell_out.
|
30
29
|
#
|
31
|
-
# shell_out
|
30
|
+
# on unix the shell_out API supports the clean_array() kind of syntax (below) so that
|
31
|
+
# array args are flat/compact/to_s'd. on windows, array args aren't supported to its
|
32
|
+
# up to the caller to join(" ") on arrays of strings.
|
32
33
|
#
|
33
|
-
#
|
34
|
+
# the shell_out_compacted/shell_out_compacted! APIs are private but are intended for use
|
35
|
+
# in rspec tests, and should ideally always be used to make code refactorings that do not
|
36
|
+
# change behavior easier:
|
34
37
|
#
|
35
|
-
#
|
38
|
+
# allow(provider).to receive(:shell_out_compacted!).with("foo", "bar", "baz")
|
39
|
+
# provider.shell_out!("foo", [ "bar", nil, "baz"])
|
40
|
+
# provider.shell_out!(["foo", nil, "bar" ], ["baz"])
|
36
41
|
#
|
37
|
-
#
|
38
|
-
#
|
39
|
-
#
|
40
|
-
#
|
41
|
-
#
|
42
|
-
# the argument must actually be removed).
|
43
|
-
#
|
44
|
-
# there's also an implicit join between all the array elements, and nested arrays are flattened which
|
45
|
-
# means that odd where-do-i-put-the-spaces options handling just works, and instead of this:
|
46
|
-
#
|
47
|
-
# opts = "" # needs to be empty string for when foo and bar are both missing
|
48
|
-
# opts << " -foo" if needs_foo? # needs the leading space on both of these
|
49
|
-
# opts << " -bar" if needs_bar?
|
50
|
-
# shell_out!("cmd#{opts}") # have to think way too hard about why there's no space here
|
51
|
-
#
|
52
|
-
# becomes:
|
53
|
-
#
|
54
|
-
# opts = []
|
55
|
-
# opts << "-foo" if needs_foo?
|
56
|
-
# opts << "-bar" if needs_bar?
|
57
|
-
# shell_out_compact!("cmd", opts)
|
58
|
-
#
|
59
|
-
# and opts can be an empty array or nil and it'll work out fine.
|
60
|
-
#
|
61
|
-
# generally its best to use shell_out_compact! in code and setup expectations on shell_out! in tests
|
42
|
+
# note that shell_out_compacted also includes adding the magical timeout option to force
|
43
|
+
# people to setup expectations on that value explicitly. it does not include the default_env
|
44
|
+
# mangling in order to avoid users having to setup an expectation on anything other than
|
45
|
+
# setting `default_env: false` and allow us to make tweak to the default_env without breaking
|
46
|
+
# a thousand unit tests.
|
62
47
|
#
|
63
48
|
|
64
49
|
def shell_out_compact(*args, **options)
|
50
|
+
Chef.deprecated(:shell_out, "shell_out_compact should be replaced by shell_out")
|
65
51
|
if options.empty?
|
66
|
-
shell_out(*
|
52
|
+
shell_out(*args)
|
67
53
|
else
|
68
|
-
shell_out(*
|
54
|
+
shell_out(*args, **options)
|
69
55
|
end
|
70
56
|
end
|
71
57
|
|
72
58
|
def shell_out_compact!(*args, **options)
|
59
|
+
Chef.deprecated(:shell_out, "shell_out_compact! should be replaced by shell_out!")
|
73
60
|
if options.empty?
|
74
|
-
shell_out!(*
|
61
|
+
shell_out!(*args)
|
75
62
|
else
|
76
|
-
shell_out!(*
|
63
|
+
shell_out!(*args, **options)
|
77
64
|
end
|
78
65
|
end
|
79
66
|
|
80
|
-
# helper sugar for resources that support passing timeouts to shell_out
|
81
|
-
|
82
67
|
def shell_out_compact_timeout(*args, **options)
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
68
|
+
Chef.deprecated(:shell_out, "shell_out_compact_timeout should be replaced by shell_out")
|
69
|
+
if options.empty?
|
70
|
+
shell_out(*args, argument_that_will_go_away_in_chef_15_so_do_not_use_it: true)
|
71
|
+
else
|
72
|
+
shell_out(*args, argument_that_will_go_away_in_chef_15_so_do_not_use_it: true, **options)
|
73
|
+
end
|
88
74
|
end
|
89
75
|
|
90
76
|
def shell_out_compact_timeout!(*args, **options)
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
77
|
+
Chef.deprecated(:shell_out, "shell_out_compact_timeout! should be replaced by shell_out!")
|
78
|
+
if options.empty?
|
79
|
+
shell_out!(*args, argument_that_will_go_away_in_chef_15_so_do_not_use_it: true)
|
80
|
+
else
|
81
|
+
shell_out!(*args, argument_that_will_go_away_in_chef_15_so_do_not_use_it: true, **options)
|
82
|
+
end
|
96
83
|
end
|
97
84
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
85
|
+
def shell_out_with_systems_locale(*args, **options)
|
86
|
+
Chef.deprecated(:shell_out, "shell_out_with_systems_locale should be replaced by shell_out with the default_env option set to false")
|
87
|
+
if options.empty?
|
88
|
+
shell_out(*args, default_env: false)
|
89
|
+
else
|
90
|
+
shell_out(*args, default_env: false, **options)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def shell_out_with_systems_locale!(*args, **options)
|
95
|
+
Chef.deprecated(:shell_out, "shell_out_with_systems_locale! should be replaced by shell_out! with the default_env option set to false")
|
96
|
+
if options.empty?
|
97
|
+
shell_out!(*args, default_env: false)
|
98
|
+
else
|
99
|
+
shell_out!(*args, default_env: false, **options)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def a_to_s(*args)
|
104
|
+
Chef.deprecated(:shell_out, "a_to_s is deprecated use shell_out with splat-args")
|
105
|
+
args.flatten.reject { |i| i.nil? || i == "" }.map(&:to_s).join(" ")
|
106
|
+
end
|
102
107
|
|
103
|
-
# we use 'en_US.UTF-8' by default because we parse localized strings in English as an API and
|
104
|
-
# generally must support UTF-8 unicode.
|
105
108
|
def shell_out(*args, **options)
|
109
|
+
options = options.dup
|
110
|
+
options = Chef::Mixin::ShellOut.maybe_add_timeout(self, options)
|
111
|
+
if options.empty?
|
112
|
+
shell_out_compacted(*Chef::Mixin::ShellOut.clean_array(*args))
|
113
|
+
else
|
114
|
+
shell_out_compacted(*Chef::Mixin::ShellOut.clean_array(*args), **options)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
def shell_out!(*args, **options)
|
119
|
+
options = options.dup
|
120
|
+
options = Chef::Mixin::ShellOut.maybe_add_timeout(self, options)
|
121
|
+
if options.empty?
|
122
|
+
shell_out_compacted!(*Chef::Mixin::ShellOut.clean_array(*args))
|
123
|
+
else
|
124
|
+
shell_out_compacted!(*Chef::Mixin::ShellOut.clean_array(*args), **options)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
# helper sugar for resources that support passing timeouts to shell_out
|
129
|
+
#
|
130
|
+
# module method to not pollute namespaces, but that means we need self injected as an arg
|
131
|
+
# @api private
|
132
|
+
def self.maybe_add_timeout(obj, options)
|
133
|
+
options = options.dup
|
134
|
+
force = options.delete(:argument_that_will_go_away_in_chef_15_so_do_not_use_it) # remove in Chef-15
|
135
|
+
# historically resources have not properly declared defaults on their timeouts, so a default default of 900s was enforced here
|
136
|
+
default_val = 900
|
137
|
+
if !force
|
138
|
+
return options if options.key?(:timeout) # leave this line in Chef-15, delete the rest of the conditional
|
139
|
+
else
|
140
|
+
default_val = options[:timeout] if options.key?(:timeout) # delete in Chef-15
|
141
|
+
end
|
142
|
+
# note that we can't define an empty Chef::Resource::LWRPBase because that breaks descendants tracker, so we'd have to instead require the file here, which would pull in half
|
143
|
+
# of chef, so instead convert to using strings. once descendants tracker is gone, we can just declare the empty classes instead and use `is_a?` against the symbols.
|
144
|
+
# (be nice if ruby supported strings in `is_a?` for looser coupling).
|
145
|
+
# FIXME: just use `if obj.respond_to?(:new_resource) && obj.new_resource.respond_to?(:timeout) && !options.key?(:timeout)` in Chef 15
|
146
|
+
if obj.respond_to?(:new_resource) && ( force || ( obj.class.ancestors.map(&:name).include?("Chef::Provider") && !obj.class.ancestors.map(&:name).include?("Chef::Resource::LWRPBase") && !obj.class.ancestors.map(&:name).include?("Chef::Resource::ActionClass") && obj.new_resource.respond_to?(:timeout) && !options.key?(:timeout) ) )
|
147
|
+
options[:timeout] = obj.new_resource.timeout ? obj.new_resource.timeout.to_f : default_val
|
148
|
+
end
|
149
|
+
options
|
150
|
+
end
|
151
|
+
|
152
|
+
# helper function to mangle options when `default_env` is true
|
153
|
+
#
|
154
|
+
# @api private
|
155
|
+
def self.apply_default_env(options)
|
106
156
|
options = options.dup
|
107
157
|
default_env = options.delete(:default_env)
|
108
158
|
default_env = true if default_env.nil?
|
@@ -115,34 +165,37 @@ class Chef
|
|
115
165
|
env_path => sanitized_path,
|
116
166
|
}.update(options[env_key] || {})
|
117
167
|
end
|
118
|
-
|
168
|
+
options
|
119
169
|
end
|
120
170
|
|
121
|
-
|
122
|
-
def shell_out!(*command_args)
|
123
|
-
cmd = shell_out(*command_args)
|
124
|
-
cmd.error!
|
125
|
-
cmd
|
126
|
-
end
|
127
|
-
|
128
|
-
def shell_out_with_systems_locale(*args, **options) # FIXME: deprecate
|
129
|
-
shell_out(*args, default_env: false, **options)
|
130
|
-
end
|
171
|
+
private
|
131
172
|
|
132
|
-
|
133
|
-
|
173
|
+
# this SHOULD be used for setting up expectations in rspec, see banner comment at top.
|
174
|
+
#
|
175
|
+
# the private constraint is meant to avoid code calling this directly, rspec expectations are fine.
|
176
|
+
#
|
177
|
+
def shell_out_compacted(*args, **options)
|
178
|
+
options = Chef::Mixin::ShellOut.apply_default_env(options)
|
179
|
+
if options.empty?
|
180
|
+
Chef::Mixin::ShellOut.shell_out_command(*args)
|
181
|
+
else
|
182
|
+
Chef::Mixin::ShellOut.shell_out_command(*args, **options)
|
183
|
+
end
|
134
184
|
end
|
135
185
|
|
136
|
-
#
|
137
|
-
# will compact nil or empty strings in the array and will join the array elements
|
138
|
-
# with spaces, without introducing any double spaces for nil/empty elements.
|
186
|
+
# this SHOULD be used for setting up expectations in rspec, see banner comment at top.
|
139
187
|
#
|
140
|
-
#
|
141
|
-
#
|
142
|
-
def
|
143
|
-
|
144
|
-
|
145
|
-
|
188
|
+
# the private constraint is meant to avoid code calling this directly, rspec expectations are fine.
|
189
|
+
#
|
190
|
+
def shell_out_compacted!(*args, **options)
|
191
|
+
options = Chef::Mixin::ShellOut.apply_default_env(options)
|
192
|
+
cmd = if options.empty?
|
193
|
+
Chef::Mixin::ShellOut.shell_out_command(*args)
|
194
|
+
else
|
195
|
+
Chef::Mixin::ShellOut.shell_out_command(*args, **options)
|
196
|
+
end
|
197
|
+
cmd.error!
|
198
|
+
cmd
|
146
199
|
end
|
147
200
|
|
148
201
|
# Helper for subclasses to reject nil out of an array. It allows
|
@@ -161,20 +214,23 @@ class Chef
|
|
161
214
|
#
|
162
215
|
# @param args [String] variable number of string arguments
|
163
216
|
# @return [Array] array of strings with nil and null string rejection
|
164
|
-
|
217
|
+
|
218
|
+
def self.clean_array(*args)
|
165
219
|
args.flatten.compact.map(&:to_s)
|
166
220
|
end
|
167
221
|
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
222
|
+
def self.shell_out_command(*args, **options)
|
223
|
+
cmd = if options.empty?
|
224
|
+
Mixlib::ShellOut.new(*args)
|
225
|
+
else
|
226
|
+
Mixlib::ShellOut.new(*args, **options)
|
227
|
+
end
|
172
228
|
cmd.live_stream ||= io_for_live_stream
|
173
229
|
cmd.run_command
|
174
230
|
cmd
|
175
231
|
end
|
176
232
|
|
177
|
-
def io_for_live_stream
|
233
|
+
def self.io_for_live_stream
|
178
234
|
if STDOUT.tty? && !Chef::Config[:daemon] && Chef::Log.debug?
|
179
235
|
STDOUT
|
180
236
|
else
|
@@ -182,7 +238,7 @@ class Chef
|
|
182
238
|
end
|
183
239
|
end
|
184
240
|
|
185
|
-
def env_path
|
241
|
+
def self.env_path
|
186
242
|
if Chef::Platform.windows?
|
187
243
|
"Path"
|
188
244
|
else
|