chef 16.3.38-universal-mingw32 → 16.5.64-universal-mingw32
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/Rakefile +2 -2
- data/bin/knife +1 -1
- data/chef-universal-mingw32.gemspec +0 -1
- data/chef.gemspec +2 -1
- data/distro/templates/powershell/chef/chef.psm1.erb +18 -18
- data/ext/win32-eventlog/Rakefile +2 -2
- data/ext/win32-eventlog/chef-log.man.erb +4 -4
- data/lib/chef/action_collection.rb +4 -0
- data/lib/chef/api_client/registration.rb +2 -2
- data/lib/chef/application.rb +19 -17
- data/lib/chef/application/apply.rb +17 -12
- data/lib/chef/application/base.rb +26 -23
- data/lib/chef/application/client.rb +10 -4
- data/lib/chef/application/exit_code.rb +13 -4
- data/lib/chef/application/knife.rb +22 -11
- data/lib/chef/application/solo.rb +2 -1
- data/lib/chef/application/windows_service.rb +39 -39
- data/lib/chef/application/windows_service_manager.rb +6 -6
- data/lib/chef/chef_class.rb +0 -1
- data/lib/chef/chef_fs/chef_fs_data_store.rb +54 -54
- data/lib/chef/chef_fs/file_system/chef_server/acl_entry.rb +10 -10
- data/lib/chef/chef_fs/file_system/chef_server/organization_invites_entry.rb +8 -8
- data/lib/chef/chef_fs/file_system/chef_server/organization_members_entry.rb +8 -8
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_dir.rb +2 -2
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_entry.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_root_dir.rb +18 -18
- data/lib/chef/chef_fs/file_system/repository/directory.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/file_system_entry.rb +1 -1
- data/lib/chef/chef_fs/knife.rb +2 -2
- data/lib/chef/chef_fs/parallelizer.rb +0 -1
- data/lib/chef/client.rb +21 -22
- data/lib/chef/cookbook/cookbook_version_loader.rb +1 -1
- data/lib/chef/cookbook/synchronizer.rb +2 -2
- data/lib/chef/cookbook_site_streaming_uploader.rb +13 -11
- data/lib/chef/cookbook_uploader.rb +1 -1
- data/lib/chef/data_collector.rb +6 -5
- data/lib/chef/data_collector/config_validation.rb +22 -13
- data/lib/chef/data_collector/run_end_message.rb +13 -3
- data/lib/chef/data_collector/run_start_message.rb +1 -1
- data/lib/chef/deprecated.rb +1 -1
- data/lib/chef/deprecation/warnings.rb +2 -2
- data/lib/chef/digester.rb +2 -2
- data/lib/chef/dsl/chef_vault.rb +1 -1
- data/lib/chef/dsl/data_query.rb +2 -2
- data/lib/chef/dsl/platform_introspection.rb +9 -9
- data/lib/chef/encrypted_data_bag_item.rb +3 -4
- data/lib/chef/encrypted_data_bag_item/decryptor.rb +3 -3
- data/lib/chef/encrypted_data_bag_item/encryptor.rb +3 -3
- data/lib/chef/environment.rb +4 -4
- data/lib/chef/event_loggers/windows_eventlog.rb +2 -2
- data/lib/chef/exceptions.rb +5 -5
- data/lib/chef/file_access_control/windows.rb +5 -1
- data/lib/chef/file_content_management/tempfile.rb +9 -9
- data/lib/chef/formatters/doc.rb +7 -6
- data/lib/chef/formatters/error_inspectors/api_error_formatting.rb +6 -5
- data/lib/chef/formatters/error_inspectors/node_load_error_inspector.rb +3 -3
- data/lib/chef/formatters/error_inspectors/registration_error_inspector.rb +9 -9
- data/lib/chef/formatters/error_inspectors/resource_failure_inspector.rb +2 -2
- data/lib/chef/formatters/error_inspectors/run_list_expansion_error_inspector.rb +3 -3
- data/lib/chef/formatters/minimal.rb +5 -4
- data/lib/chef/handler.rb +2 -0
- data/lib/chef/http.rb +15 -13
- data/lib/chef/http/auth_credentials.rb +5 -1
- data/lib/chef/http/authenticator.rb +3 -1
- data/lib/chef/http/basic_client.rb +4 -2
- data/lib/chef/http/decompressor.rb +1 -1
- data/lib/chef/http/http_request.rb +7 -5
- data/lib/chef/http/socketless_chef_zero_client.rb +5 -2
- data/lib/chef/http/ssl_policies.rb +1 -1
- data/lib/chef/json_compat.rb +2 -2
- data/lib/chef/knife.rb +4 -4
- data/lib/chef/knife/bootstrap.rb +18 -16
- data/lib/chef/knife/bootstrap/chef_vault_handler.rb +1 -1
- data/lib/chef/knife/bootstrap/templates/chef-full.erb +3 -3
- data/lib/chef/knife/bootstrap/templates/windows-chef-client-msi.erb +7 -7
- data/lib/chef/knife/client_create.rb +3 -3
- data/lib/chef/knife/config_get.rb +8 -97
- data/lib/chef/knife/config_get_profile.rb +9 -9
- data/lib/chef/knife/config_list.rb +139 -0
- data/lib/chef/knife/config_list_profiles.rb +8 -98
- data/lib/chef/knife/config_show.rb +127 -0
- data/lib/chef/knife/config_use.rb +61 -0
- data/lib/chef/knife/config_use_profile.rb +9 -24
- data/lib/chef/knife/configure.rb +4 -2
- data/lib/chef/knife/cookbook_download.rb +1 -1
- data/lib/chef/knife/cookbook_metadata.rb +1 -1
- data/lib/chef/knife/cookbook_upload.rb +23 -23
- data/lib/chef/knife/core/bootstrap_context.rb +2 -2
- data/lib/chef/knife/core/generic_presenter.rb +1 -1
- data/lib/chef/knife/core/hashed_command_loader.rb +2 -2
- data/lib/chef/knife/core/object_loader.rb +1 -1
- data/lib/chef/knife/core/windows_bootstrap_context.rb +42 -34
- data/lib/chef/knife/delete.rb +15 -15
- data/lib/chef/knife/exec.rb +4 -4
- data/lib/chef/knife/node_show.rb +2 -2
- data/lib/chef/knife/serve.rb +3 -3
- data/lib/chef/knife/ssh.rb +22 -7
- data/lib/chef/knife/ssl_check.rb +3 -3
- data/lib/chef/knife/status.rb +2 -2
- data/lib/chef/knife/user_create.rb +2 -2
- data/lib/chef/knife/xargs.rb +19 -19
- data/lib/chef/knife/yaml_convert.rb +1 -1
- data/lib/chef/local_mode.rb +2 -2
- data/lib/chef/log/syslog.rb +2 -2
- data/lib/chef/log/winevt.rb +2 -2
- data/lib/chef/mixin/checksum.rb +0 -1
- data/lib/chef/mixin/deep_merge.rb +35 -18
- data/lib/chef/mixin/openssl_helper.rb +4 -5
- data/lib/chef/mixin/shell_out.rb +1 -1
- data/lib/chef/mixin/template.rb +2 -2
- data/lib/chef/mixin/uris.rb +2 -2
- data/lib/chef/mixin/versioned_api.rb +1 -2
- data/lib/chef/mixin/which.rb +1 -1
- data/lib/chef/monkey_patches/net_http.rb +4 -4
- data/lib/chef/monkey_patches/webrick-utils.rb +10 -10
- data/lib/chef/node/attribute.rb +2 -4
- data/lib/chef/node_map.rb +2 -2
- data/lib/chef/platform/service_helpers.rb +1 -1
- data/lib/chef/policy_builder/policyfile.rb +2 -2
- data/lib/chef/property.rb +1 -1
- data/lib/chef/provider.rb +0 -4
- data/lib/chef/provider/cron/unix.rb +0 -2
- data/lib/chef/provider/file.rb +2 -2
- data/lib/chef/provider/git.rb +5 -5
- data/lib/chef/provider/group.rb +0 -2
- data/lib/chef/provider/group/suse.rb +5 -5
- data/lib/chef/provider/ifconfig.rb +1 -4
- data/lib/chef/provider/launchd.rb +2 -2
- data/lib/chef/provider/mount.rb +0 -2
- data/lib/chef/provider/mount/linux.rb +63 -0
- data/lib/chef/provider/package.rb +0 -2
- data/lib/chef/provider/package/rubygems.rb +22 -19
- data/lib/chef/provider/package/snap.rb +1 -2
- data/lib/chef/provider/package/windows.rb +2 -2
- data/lib/chef/provider/package/windows/registry_uninstall_entry.rb +12 -10
- data/lib/chef/provider/package/zypper.rb +1 -1
- data/lib/chef/provider/powershell_script.rb +21 -5
- data/lib/chef/provider/remote_file/content.rb +3 -0
- data/lib/chef/provider/remote_file/ftp.rb +6 -4
- data/lib/chef/provider/remote_file/sftp.rb +6 -4
- data/lib/chef/provider/route.rb +2 -6
- data/lib/chef/provider/service/arch.rb +1 -1
- data/lib/chef/provider/service/debian.rb +1 -1
- data/lib/chef/provider/service/gentoo.rb +2 -2
- data/lib/chef/provider/service/macosx.rb +4 -4
- data/lib/chef/provider/service/openbsd.rb +1 -4
- data/lib/chef/provider/service/redhat.rb +2 -2
- data/lib/chef/provider/service/upstart.rb +1 -1
- data/lib/chef/provider/service/windows.rb +10 -10
- data/lib/chef/provider/systemd_unit.rb +0 -2
- data/lib/chef/provider/template/content.rb +1 -0
- data/lib/chef/provider/template_finder.rb +2 -10
- data/lib/chef/provider/user/dscl.rb +5 -5
- data/lib/chef/provider/user/mac.rb +10 -10
- data/lib/chef/provider/windows_task.rb +1 -5
- data/lib/chef/provider/zypper_repository.rb +2 -3
- data/lib/chef/provider_resolver.rb +1 -1
- data/lib/chef/providers.rb +1 -1
- data/lib/chef/recipe.rb +2 -2
- data/lib/chef/resource.rb +7 -11
- data/lib/chef/resource/apt_repository.rb +2 -11
- data/lib/chef/resource/bff_package.rb +22 -0
- data/lib/chef/resource/breakpoint.rb +57 -2
- data/lib/chef/resource/build_essential.rb +1 -1
- data/lib/chef/resource/cab_package.rb +29 -0
- data/lib/chef/resource/chef_client_cron.rb +32 -25
- data/lib/chef/resource/chef_client_launchd.rb +194 -0
- data/lib/chef/resource/chef_client_scheduled_task.rb +21 -18
- data/lib/chef/resource/chef_client_systemd_timer.rb +26 -19
- data/lib/chef/resource/chef_client_trusted_certificate.rb +101 -0
- data/lib/chef/resource/chef_gem.rb +10 -10
- data/lib/chef/resource/chef_handler.rb +148 -4
- data/lib/chef/resource/chef_sleep.rb +2 -2
- data/lib/chef/resource/chef_vault_secret.rb +14 -14
- data/lib/chef/resource/cookbook_file.rb +2 -2
- data/lib/chef/resource/cron/cron_d.rb +0 -1
- data/lib/chef/resource/dnf_package.rb +2 -2
- data/lib/chef/resource/dsc_resource.rb +0 -1
- data/lib/chef/resource/dsc_script.rb +2 -2
- data/lib/chef/resource/execute.rb +8 -9
- data/lib/chef/resource/file.rb +4 -4
- data/lib/chef/resource/gem_package.rb +5 -5
- data/lib/chef/resource/homebrew_package.rb +3 -3
- data/lib/chef/resource/homebrew_update.rb +7 -7
- data/lib/chef/resource/hostname.rb +19 -19
- data/lib/chef/resource/launchd.rb +2 -1
- data/lib/chef/resource/locale.rb +2 -2
- data/lib/chef/resource/macos_userdefaults.rb +3 -3
- data/lib/chef/resource/notify_group.rb +0 -1
- data/lib/chef/resource/ohai.rb +46 -3
- data/lib/chef/resource/ohai_hint.rb +33 -0
- data/lib/chef/resource/openssl_dhparam.rb +29 -5
- data/lib/chef/resource/openssl_ec_private_key.rb +8 -3
- data/lib/chef/resource/openssl_ec_public_key.rb +4 -2
- data/lib/chef/resource/openssl_rsa_private_key.rb +8 -3
- data/lib/chef/resource/openssl_rsa_public_key.rb +2 -0
- data/lib/chef/resource/openssl_x509_certificate.rb +38 -35
- data/lib/chef/resource/openssl_x509_crl.rb +21 -10
- data/lib/chef/resource/openssl_x509_request.rb +37 -36
- data/lib/chef/resource/osx_profile.rb +292 -6
- data/lib/chef/resource/plist.rb +1 -1
- data/lib/chef/resource/powershell_package_source.rb +6 -6
- data/lib/chef/resource/powershell_script.rb +24 -30
- data/lib/chef/resource/reboot.rb +2 -2
- data/lib/chef/resource/remote_file.rb +3 -3
- data/lib/chef/resource/rhsm_register.rb +22 -10
- data/lib/chef/resource/ruby_block.rb +2 -2
- data/lib/chef/resource/scm/subversion.rb +2 -2
- data/lib/chef/resource/service.rb +3 -3
- data/lib/chef/resource/ssh_known_hosts_entry.rb +2 -2
- data/lib/chef/resource/sudo.rb +1 -1
- data/lib/chef/resource/support/cron.d.erb +1 -1
- data/lib/chef/resource/support/cron_access.erb +1 -1
- data/lib/chef/resource/support/sudoer.erb +1 -1
- data/lib/chef/resource/support/ulimit.erb +1 -1
- data/lib/chef/resource/sysctl.rb +6 -10
- data/lib/chef/resource/systemd_unit.rb +2 -2
- data/lib/chef/resource/template.rb +2 -2
- data/lib/chef/resource/timezone.rb +112 -73
- data/lib/chef/resource/windows_ad_join.rb +12 -3
- data/lib/chef/resource/windows_audit_policy.rb +3 -0
- data/lib/chef/resource/windows_auto_run.rb +2 -0
- data/lib/chef/resource/windows_certificate.rb +8 -4
- data/lib/chef/resource/windows_dfs_folder.rb +2 -0
- data/lib/chef/resource/windows_dfs_namespace.rb +2 -0
- data/lib/chef/resource/windows_dfs_server.rb +2 -0
- data/lib/chef/resource/windows_dns_record.rb +10 -7
- data/lib/chef/resource/windows_dns_zone.rb +12 -7
- data/lib/chef/resource/windows_feature.rb +2 -0
- data/lib/chef/resource/windows_feature_dism.rb +10 -0
- data/lib/chef/resource/windows_feature_powershell.rb +14 -2
- data/lib/chef/resource/windows_firewall_profile.rb +24 -20
- data/lib/chef/resource/windows_firewall_rule.rb +5 -3
- data/lib/chef/resource/windows_font.rb +3 -1
- data/lib/chef/resource/windows_package.rb +28 -5
- data/lib/chef/resource/windows_pagefile.rb +4 -0
- data/lib/chef/resource/windows_printer.rb +22 -21
- data/lib/chef/resource/windows_printer_port.rb +20 -17
- data/lib/chef/resource/windows_security_policy.rb +2 -0
- data/lib/chef/resource/windows_share.rb +5 -3
- data/lib/chef/resource/windows_shortcut.rb +2 -0
- data/lib/chef/resource/windows_uac.rb +2 -0
- data/lib/chef/resource/windows_user_privilege.rb +54 -53
- data/lib/chef/resource/windows_workgroup.rb +5 -6
- data/lib/chef/resource/yum_package.rb +2 -2
- data/lib/chef/resource_collection/stepable_iterator.rb +1 -2
- data/lib/chef/resources.rb +3 -1
- data/lib/chef/role.rb +2 -2
- data/lib/chef/run_context.rb +2 -2
- data/lib/chef/run_context/cookbook_compiler.rb +21 -21
- data/lib/chef/run_lock.rb +2 -2
- data/lib/chef/run_status.rb +2 -6
- data/lib/chef/search/query.rb +4 -5
- data/lib/chef/server_api_versions.rb +4 -0
- data/lib/chef/shell.rb +32 -27
- data/lib/chef/shell/ext.rb +11 -11
- data/lib/chef/shell/shell_session.rb +2 -2
- data/lib/chef/train_transport.rb +5 -104
- data/lib/chef/util/backup.rb +1 -1
- data/lib/chef/util/diff.rb +14 -14
- data/lib/chef/util/powershell/cmdlet.rb +4 -2
- data/lib/chef/util/powershell/ps_credential.rb +18 -14
- data/lib/chef/util/threaded_job_queue.rb +0 -2
- data/lib/chef/version.rb +1 -1
- data/lib/chef/win32/crypto.rb +1 -1
- data/lib/chef/win32/file.rb +2 -2
- data/lib/chef/win32/file/version_info.rb +5 -5
- data/lib/chef/win32/registry.rb +1 -2
- data/spec/data/shef-config.rb +1 -1
- data/spec/data/ssl/chef-rspec.cert +15 -15
- data/spec/functional/event_loggers/windows_eventlog_spec.rb +6 -5
- data/spec/functional/resource/aix_service_spec.rb +2 -2
- data/spec/functional/resource/aixinit_service_spec.rb +8 -8
- data/spec/functional/resource/bff_spec.rb +2 -2
- data/spec/functional/resource/cookbook_file_spec.rb +1 -1
- data/spec/functional/resource/dsc_resource_spec.rb +1 -1
- data/spec/functional/resource/dsc_script_spec.rb +0 -1
- data/spec/functional/resource/group_spec.rb +6 -6
- data/spec/functional/resource/insserv_spec.rb +5 -5
- data/spec/functional/resource/link_spec.rb +20 -20
- data/spec/functional/resource/powershell_script_spec.rb +4 -4
- data/spec/functional/resource/rpm_spec.rb +2 -2
- data/spec/functional/resource/user/dscl_spec.rb +1 -1
- data/spec/functional/resource/user/mac_user_spec.rb +1 -1
- data/spec/functional/resource/windows_certificate_spec.rb +3 -3
- data/spec/functional/resource/windows_font_spec.rb +49 -0
- data/spec/functional/resource/windows_security_policy_spec.rb +0 -3
- data/spec/functional/resource/windows_task_spec.rb +13 -13
- data/spec/functional/run_lock_spec.rb +24 -24
- data/spec/functional/version_spec.rb +3 -3
- data/spec/functional/win32/registry_spec.rb +8 -8
- data/spec/functional/win32/service_manager_spec.rb +1 -1
- data/spec/integration/client/client_spec.rb +4 -4
- data/spec/integration/client/exit_code_spec.rb +3 -2
- data/spec/integration/client/ipv6_spec.rb +1 -1
- data/spec/integration/knife/common_options_spec.rb +12 -12
- data/spec/integration/knife/config_list_spec.rb +220 -0
- data/spec/integration/knife/config_show_spec.rb +192 -0
- data/spec/integration/knife/config_use_spec.rb +198 -0
- data/spec/integration/knife/cookbook_api_ipv6_spec.rb +1 -1
- data/spec/integration/knife/diff_spec.rb +3 -1
- data/spec/integration/knife/download_spec.rb +3 -1
- data/spec/integration/knife/serve_spec.rb +5 -5
- data/spec/integration/knife/upload_spec.rb +3 -1
- data/spec/integration/ohai/ohai_spec.rb +61 -0
- data/spec/integration/recipes/lwrp_inline_resources_spec.rb +1 -1
- data/spec/integration/recipes/remote_directory.rb +1 -1
- data/spec/integration/solo/solo_spec.rb +5 -5
- data/spec/spec_helper.rb +12 -9
- data/spec/stress/win32/file_spec.rb +1 -1
- data/spec/support/chef_helpers.rb +2 -2
- data/spec/support/matchers/leak.rb +2 -2
- data/spec/support/platform_helpers.rb +17 -35
- data/spec/support/platforms/win32/spec_service.rb +1 -1
- data/spec/support/shared/functional/directory_resource.rb +1 -1
- data/spec/support/shared/functional/execute_resource.rb +1 -1
- data/spec/support/shared/functional/file_resource.rb +20 -20
- data/spec/support/shared/functional/securable_resource.rb +108 -27
- data/spec/support/shared/functional/win32_service.rb +2 -2
- data/spec/support/shared/functional/windows_script.rb +3 -3
- data/spec/support/shared/integration/integration_helper.rb +22 -52
- data/spec/support/shared/unit/application_dot_d.rb +5 -3
- data/spec/support/shared/unit/script_resource.rb +6 -20
- data/spec/support/shared/unit/windows_script_resource.rb +15 -28
- data/spec/tiny_server.rb +0 -1
- data/spec/unit/application/client_spec.rb +2 -2
- data/spec/unit/application/exit_code_spec.rb +10 -0
- data/spec/unit/application_spec.rb +4 -6
- data/spec/unit/chef_fs/parallelizer_spec.rb +5 -1
- data/spec/unit/chef_fs/path_util_spec.rb +1 -1
- data/spec/unit/cookbook/synchronizer_spec.rb +2 -2
- data/spec/unit/cookbook_spec.rb +2 -2
- data/spec/unit/data_collector/config_validation_spec.rb +208 -0
- data/spec/unit/data_collector_spec.rb +28 -113
- data/spec/unit/dsl/declare_resource_spec.rb +1 -1
- data/spec/unit/environment_spec.rb +7 -7
- data/spec/unit/file_access_control_spec.rb +1 -1
- data/spec/unit/http/api_versions_spec.rb +19 -1
- data/spec/unit/knife/bootstrap_spec.rb +20 -20
- data/spec/unit/knife/cookbook_download_spec.rb +4 -4
- data/spec/unit/knife/cookbook_metadata_from_file_spec.rb +1 -1
- data/spec/unit/knife/core/hashed_command_loader_spec.rb +3 -3
- data/spec/unit/knife/core/ui_spec.rb +1 -0
- data/spec/unit/knife/core/windows_bootstrap_context_spec.rb +21 -12
- data/spec/unit/knife/ssh_spec.rb +2 -2
- data/spec/unit/knife/supermarket_share_spec.rb +1 -1
- data/spec/unit/lwrp_spec.rb +3 -3
- data/spec/unit/mixin/deep_merge_spec.rb +15 -0
- data/spec/unit/mixin/openssl_helper_spec.rb +1 -1
- data/spec/unit/mixin/powershell_exec_spec.rb +1 -1
- data/spec/unit/mixin/securable_spec.rb +2 -2
- data/spec/unit/mixin/template_spec.rb +30 -30
- data/spec/unit/mixin/windows_architecture_helper_spec.rb +4 -4
- data/spec/unit/node/immutable_collections_spec.rb +8 -4
- data/spec/unit/node_spec.rb +5 -5
- data/spec/unit/provider/mount/linux_spec.rb +97 -0
- data/spec/unit/provider/package/chocolatey_spec.rb +1 -1
- data/spec/unit/provider/package/powershell_spec.rb +1 -1
- data/spec/unit/provider/package/rubygems_spec.rb +4 -1
- data/spec/unit/provider/powershell_script_spec.rb +11 -4
- data/spec/unit/provider/remote_directory_spec.rb +9 -9
- data/spec/unit/provider/route_spec.rb +0 -2
- data/spec/unit/provider/service/arch_service_spec.rb +3 -2
- data/spec/unit/provider/service/debian_service_spec.rb +1 -1
- data/spec/unit/provider/service/gentoo_service_spec.rb +7 -7
- data/spec/unit/provider/service/macosx_spec.rb +3 -3
- data/spec/unit/provider/service/redhat_spec.rb +2 -2
- data/spec/unit/provider/service/upstart_service_spec.rb +3 -3
- data/spec/unit/provider_resolver_spec.rb +6 -6
- data/spec/unit/recipe_spec.rb +1 -1
- data/spec/unit/resource/batch_spec.rb +6 -6
- data/spec/unit/resource/chef_client_cron_spec.rb +35 -14
- data/spec/unit/resource/chef_client_launchd_spec.rb +127 -0
- data/spec/unit/resource/chef_client_systemd_timer_spec.rb +36 -1
- data/spec/unit/resource/chef_client_trusted_certificate_spec.rb +54 -0
- data/spec/unit/resource/execute_spec.rb +113 -118
- data/spec/unit/resource/launchd_spec.rb +8 -0
- data/spec/unit/resource/osx_profile_spec.rb +299 -0
- data/spec/unit/resource/powershell_script_spec.rb +11 -29
- data/spec/unit/resource/rhsm_register_spec.rb +56 -18
- data/spec/unit/resource/script_spec.rb +6 -1
- data/spec/unit/resource/timezone_spec.rb +63 -0
- data/spec/unit/resource/windows_feature_powershell_spec.rb +30 -4
- data/spec/unit/resource/windows_uac_spec.rb +1 -1
- data/spec/unit/resource/windows_user_privilege_spec.rb +55 -0
- data/spec/unit/role_spec.rb +11 -11
- data/spec/unit/run_lock_spec.rb +5 -1
- data/spec/unit/runner_spec.rb +1 -2
- data/spec/unit/server_api_spec.rb +43 -16
- data/spec/unit/shell/shell_ext_spec.rb +46 -3
- data/spec/unit/shell/shell_session_spec.rb +35 -64
- data/spec/unit/shell_spec.rb +16 -19
- data/spec/unit/train_transport_spec.rb +14 -13
- data/spec/unit/util/selinux_spec.rb +2 -0
- data/tasks/rspec.rb +1 -3
- metadata +42 -33
- data/lib/chef/dist.rb +0 -68
- data/lib/chef/provider/osx_profile.rb +0 -255
- data/spec/integration/knife/config_get_profile_spec.rb +0 -113
- data/spec/integration/knife/config_get_spec.rb +0 -191
- data/spec/integration/knife/config_list_profiles_spec.rb +0 -218
- data/spec/integration/knife/config_use_profile_spec.rb +0 -154
- data/spec/unit/provider/osx_profile_spec.rb +0 -255
data/lib/chef/knife/delete.rb
CHANGED
@@ -96,21 +96,21 @@ class Chef
|
|
96
96
|
found_any = false
|
97
97
|
error = false
|
98
98
|
results.each do |result|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
99
|
+
|
100
|
+
result.delete(config[:recurse])
|
101
|
+
deleted_any = true
|
102
|
+
found_any = true
|
103
|
+
rescue Chef::ChefFS::FileSystem::NotFoundError
|
104
|
+
# This is not an error unless *all* of them were not found
|
105
|
+
rescue Chef::ChefFS::FileSystem::MustDeleteRecursivelyError => e
|
106
|
+
ui.error "#{format_path_with_root(e.entry)} must be deleted recursively! Pass -r to knife delete."
|
107
|
+
found_any = true
|
108
|
+
error = true
|
109
|
+
rescue Chef::ChefFS::FileSystem::OperationNotAllowedError => e
|
110
|
+
ui.error "#{format_path_with_root(e.entry)} #{e.reason}."
|
111
|
+
found_any = true
|
112
|
+
error = true
|
113
|
+
|
114
114
|
end
|
115
115
|
if deleted_any
|
116
116
|
output("Deleted #{format_path(results[0])}")
|
data/lib/chef/knife/exec.rb
CHANGED
@@ -17,7 +17,7 @@
|
|
17
17
|
#
|
18
18
|
|
19
19
|
require_relative "../knife"
|
20
|
-
|
20
|
+
require "chef-utils/dist" unless defined?(ChefUtils::Dist)
|
21
21
|
|
22
22
|
class Chef::Knife::Exec < Chef::Knife
|
23
23
|
|
@@ -30,7 +30,7 @@ class Chef::Knife::Exec < Chef::Knife
|
|
30
30
|
option :exec,
|
31
31
|
short: "-E CODE",
|
32
32
|
long: "--exec CODE",
|
33
|
-
description: "A string of #{
|
33
|
+
description: "A string of #{ChefUtils::Dist::Infra::PRODUCT} code to execute."
|
34
34
|
|
35
35
|
option :script_path,
|
36
36
|
short: "-p PATH:PATH",
|
@@ -76,7 +76,7 @@ class Chef::Knife::Exec < Chef::Knife
|
|
76
76
|
def find_script(x)
|
77
77
|
# Try to find a script. First try expanding the path given.
|
78
78
|
script = File.expand_path(x)
|
79
|
-
return script if File.
|
79
|
+
return script if File.exist?(script)
|
80
80
|
|
81
81
|
# Failing that, try searching the script path. If we can't find
|
82
82
|
# anything, fail gracefully.
|
@@ -86,7 +86,7 @@ class Chef::Knife::Exec < Chef::Knife
|
|
86
86
|
path = File.expand_path(path)
|
87
87
|
test = File.join(path, x)
|
88
88
|
Chef::Log.trace("Testing: #{test}")
|
89
|
-
if File.
|
89
|
+
if File.exist?(test)
|
90
90
|
script = test
|
91
91
|
Chef::Log.trace("Found: #{test}")
|
92
92
|
return script
|
data/lib/chef/knife/node_show.rb
CHANGED
@@ -18,7 +18,7 @@
|
|
18
18
|
|
19
19
|
require_relative "../knife"
|
20
20
|
require_relative "core/node_presenter"
|
21
|
-
|
21
|
+
require "chef-utils/dist" unless defined?(ChefUtils::Dist)
|
22
22
|
|
23
23
|
class Chef
|
24
24
|
class Knife
|
@@ -42,7 +42,7 @@ class Chef
|
|
42
42
|
option :environment,
|
43
43
|
short: "-E",
|
44
44
|
long: "--environment",
|
45
|
-
description: "Show only the #{
|
45
|
+
description: "Show only the #{ChefUtils::Dist::Infra::PRODUCT} environment."
|
46
46
|
|
47
47
|
def run
|
48
48
|
ui.use_presenter Knife::Core::NodePresenter
|
data/lib/chef/knife/serve.rb
CHANGED
@@ -16,7 +16,7 @@
|
|
16
16
|
|
17
17
|
require_relative "../knife"
|
18
18
|
require_relative "../local_mode"
|
19
|
-
|
19
|
+
require "chef-utils/dist" unless defined?(ChefUtils::Dist)
|
20
20
|
|
21
21
|
class Chef
|
22
22
|
class Knife
|
@@ -30,11 +30,11 @@ class Chef
|
|
30
30
|
|
31
31
|
option :chef_repo_path,
|
32
32
|
long: "--chef-repo-path PATH",
|
33
|
-
description: "Overrides the location of #{
|
33
|
+
description: "Overrides the location of #{ChefUtils::Dist::Infra::PRODUCT} repo. Default is specified by chef_repo_path in the config."
|
34
34
|
|
35
35
|
option :chef_zero_host,
|
36
36
|
long: "--chef-zero-host IP",
|
37
|
-
description: "Overrides the host upon which #{
|
37
|
+
description: "Overrides the host upon which #{ChefUtils::Dist::Zero::PRODUCT} listens. Default is 127.0.0.1."
|
38
38
|
|
39
39
|
def configure_chef
|
40
40
|
super
|
data/lib/chef/knife/ssh.rb
CHANGED
@@ -358,11 +358,21 @@ class Chef
|
|
358
358
|
subsession ||= session
|
359
359
|
command = fixup_sudo(command)
|
360
360
|
command.force_encoding("binary") if command.respond_to?(:force_encoding)
|
361
|
+
begin
|
362
|
+
open_session(subsession, command)
|
363
|
+
rescue => e
|
364
|
+
open_session(subsession, command, true)
|
365
|
+
end
|
366
|
+
end
|
367
|
+
|
368
|
+
def open_session(subsession, command, pty = false)
|
369
|
+
stderr = ""
|
370
|
+
exit_status = 0
|
361
371
|
subsession.open_channel do |chan|
|
362
372
|
if config[:on_error] && exit_status != 0
|
363
373
|
chan.close
|
364
374
|
else
|
365
|
-
chan.request_pty
|
375
|
+
chan.request_pty if pty
|
366
376
|
chan.exec command do |ch, success|
|
367
377
|
raise ArgumentError, "Cannot execute #{command}" unless success
|
368
378
|
|
@@ -373,6 +383,11 @@ class Chef
|
|
373
383
|
ichannel.send_data("#{get_password}\n")
|
374
384
|
end
|
375
385
|
end
|
386
|
+
|
387
|
+
ch.on_extended_data do |_, _type, data|
|
388
|
+
stderr += data
|
389
|
+
end
|
390
|
+
|
376
391
|
ch.on_request "exit-status" do |ichannel, data|
|
377
392
|
exit_status = [exit_status, data.read_long].max
|
378
393
|
end
|
@@ -525,12 +540,12 @@ class Chef
|
|
525
540
|
def cssh
|
526
541
|
cssh_cmd = nil
|
527
542
|
%w{csshX cssh}.each do |cmd|
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
543
|
+
|
544
|
+
# Unix and Mac only
|
545
|
+
cssh_cmd = shell_out!("which #{cmd}").stdout.strip
|
546
|
+
break
|
547
|
+
rescue Mixlib::ShellOut::ShellCommandFailed
|
548
|
+
|
534
549
|
end
|
535
550
|
raise Chef::Exceptions::Exec, "no command found for cssh" unless cssh_cmd
|
536
551
|
|
data/lib/chef/knife/ssl_check.rb
CHANGED
@@ -17,7 +17,7 @@
|
|
17
17
|
#
|
18
18
|
|
19
19
|
require_relative "../knife"
|
20
|
-
|
20
|
+
require "chef-utils/dist" unless defined?(ChefUtils::Dist)
|
21
21
|
|
22
22
|
class Chef
|
23
23
|
class Knife
|
@@ -190,7 +190,7 @@ class Chef
|
|
190
190
|
#{ui.color("TO FIX THIS ERROR:", :bold)}
|
191
191
|
|
192
192
|
If the server you are connecting to uses a self-signed certificate, you must
|
193
|
-
configure #{
|
193
|
+
configure #{ChefUtils::Dist::Infra::PRODUCT} to trust that server's certificate.
|
194
194
|
|
195
195
|
By default, the certificate is stored in the following location on the host
|
196
196
|
where your chef-server runs:
|
@@ -234,7 +234,7 @@ class Chef
|
|
234
234
|
end
|
235
235
|
|
236
236
|
def debug_chef_ssl_config
|
237
|
-
ui.err "#{
|
237
|
+
ui.err "#{ChefUtils::Dist::Infra::PRODUCT} SSL Configuration:"
|
238
238
|
ui.err "* ssl_ca_path: #{configuration.ssl_ca_path.inspect}"
|
239
239
|
ui.err "* ssl_ca_file: #{configuration.ssl_ca_file.inspect}"
|
240
240
|
ui.err "* trusted_certs_dir: #{configuration.trusted_certs_dir.inspect}"
|
data/lib/chef/knife/status.rb
CHANGED
@@ -19,7 +19,7 @@
|
|
19
19
|
require_relative "../knife"
|
20
20
|
require_relative "core/status_presenter"
|
21
21
|
require_relative "core/node_presenter"
|
22
|
-
|
22
|
+
require "chef-utils/dist" unless defined?(ChefUtils::Dist)
|
23
23
|
|
24
24
|
class Chef
|
25
25
|
class Knife
|
@@ -44,7 +44,7 @@ class Chef
|
|
44
44
|
|
45
45
|
option :hide_by_mins,
|
46
46
|
long: "--hide-by-mins MINS",
|
47
|
-
description: "Hide nodes that have run #{
|
47
|
+
description: "Hide nodes that have run #{ChefUtils::Dist::Infra::CLIENT} in the last MINS minutes"
|
48
48
|
|
49
49
|
def append_to_query(term)
|
50
50
|
@query << " AND " unless @query.empty?
|
@@ -18,7 +18,7 @@
|
|
18
18
|
#
|
19
19
|
|
20
20
|
require_relative "../knife"
|
21
|
-
|
21
|
+
require "chef-utils/dist" unless defined?(ChefUtils::Dist)
|
22
22
|
|
23
23
|
class Chef
|
24
24
|
class Knife
|
@@ -42,7 +42,7 @@ class Chef
|
|
42
42
|
option :prevent_keygen,
|
43
43
|
short: "-k",
|
44
44
|
long: "--prevent-keygen",
|
45
|
-
description: "API V1 (#{
|
45
|
+
description: "API V1 (#{ChefUtils::Dist::Server::PRODUCT} 12.1+) only. Prevent server from generating a default key pair for you. Cannot be passed with --user-key.",
|
46
46
|
boolean: true
|
47
47
|
|
48
48
|
banner "knife user create USERNAME DISPLAY_NAME FIRST_NAME LAST_NAME EMAIL PASSWORD (options)"
|
data/lib/chef/knife/xargs.rb
CHANGED
@@ -204,25 +204,25 @@ class Chef
|
|
204
204
|
error = false
|
205
205
|
# Create the temporary files
|
206
206
|
tempfiles.each_pair do |tempfile, file|
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
207
|
+
|
208
|
+
value = file[:file].read
|
209
|
+
file[:value] = value
|
210
|
+
tempfile.open
|
211
|
+
tempfile.write(value)
|
212
|
+
tempfile.close
|
213
|
+
rescue Chef::ChefFS::FileSystem::OperationNotAllowedError => e
|
214
|
+
ui.error "#{format_path(e.entry)}: #{e.reason}."
|
215
|
+
error = true
|
216
|
+
tempfile.close!
|
217
|
+
tempfiles.delete(tempfile)
|
218
|
+
next
|
219
|
+
rescue Chef::ChefFS::FileSystem::NotFoundError => e
|
220
|
+
ui.error "#{format_path(e.entry)}: No such file or directory"
|
221
|
+
error = true
|
222
|
+
tempfile.close!
|
223
|
+
tempfiles.delete(tempfile)
|
224
|
+
next
|
225
|
+
|
226
226
|
end
|
227
227
|
|
228
228
|
return error if error && tempfiles.size == 0
|
data/lib/chef/local_mode.rb
CHANGED
@@ -15,9 +15,9 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
|
18
|
+
require "chef-utils" unless defined?(ChefUtils)
|
18
19
|
require_relative "config"
|
19
20
|
require_relative "monkey_patches/webrick-utils" if ChefUtils.windows?
|
20
|
-
require_relative "dist"
|
21
21
|
|
22
22
|
class Chef
|
23
23
|
module LocalMode
|
@@ -79,7 +79,7 @@ class Chef
|
|
79
79
|
|
80
80
|
local_mode_url = @chef_zero_server.local_mode_url
|
81
81
|
|
82
|
-
Chef::Log.info("Started #{
|
82
|
+
Chef::Log.info("Started #{ChefUtils::Dist::Zero::PRODUCT} at #{local_mode_url} with #{@chef_fs.fs_description}")
|
83
83
|
Chef::Config.chef_server_url = local_mode_url
|
84
84
|
end
|
85
85
|
end
|
data/lib/chef/log/syslog.rb
CHANGED
@@ -19,7 +19,7 @@
|
|
19
19
|
require "logger"
|
20
20
|
require "syslog-logger"
|
21
21
|
require_relative "../mixin/unformatter"
|
22
|
-
|
22
|
+
require "chef-utils/dist" unless defined?(ChefUtils::Dist)
|
23
23
|
|
24
24
|
class Chef
|
25
25
|
class Log
|
@@ -33,7 +33,7 @@ class Chef
|
|
33
33
|
|
34
34
|
attr_accessor :sync, :formatter
|
35
35
|
|
36
|
-
def initialize(program_name =
|
36
|
+
def initialize(program_name = ChefUtils::Dist::Infra::CLIENT, facility = ::Syslog::LOG_DAEMON, logopts = nil)
|
37
37
|
super
|
38
38
|
return if defined? ::Logger::Syslog::SYSLOG
|
39
39
|
|
data/lib/chef/log/winevt.rb
CHANGED
@@ -19,7 +19,7 @@
|
|
19
19
|
require_relative "../event_loggers/base"
|
20
20
|
require_relative "../platform/query_helpers"
|
21
21
|
require_relative "../mixin/unformatter"
|
22
|
-
|
22
|
+
require "chef-utils/dist" unless defined?(ChefUtils::Dist)
|
23
23
|
|
24
24
|
class Chef
|
25
25
|
class Log
|
@@ -37,7 +37,7 @@ class Chef
|
|
37
37
|
FATAL_EVENT_ID = 10104
|
38
38
|
|
39
39
|
# Since we must install the event logger, this is not really configurable
|
40
|
-
SOURCE =
|
40
|
+
SOURCE = ChefUtils::Dist::Infra::SHORT.freeze
|
41
41
|
|
42
42
|
include Chef::Mixin::Unformatter
|
43
43
|
|
data/lib/chef/mixin/checksum.rb
CHANGED
@@ -19,16 +19,33 @@
|
|
19
19
|
|
20
20
|
class Chef
|
21
21
|
module Mixin
|
22
|
-
# == Chef::Mixin::DeepMerge
|
23
22
|
# Implements a deep merging algorithm for nested data structures.
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
#
|
23
|
+
#
|
24
|
+
# This code was originally imported from deep_merge by Steve Midgley.
|
25
|
+
# deep_merge is available under the MIT license from
|
26
|
+
# http://trac.misuse.org/science/wiki/DeepMerge
|
27
|
+
#
|
28
|
+
# Note that this is not considered a public interface. It is technically
|
29
|
+
# public and has been used and we cannot break the API, but continued
|
30
|
+
# external use is discouraged. We are unlikely to change the shape of
|
31
|
+
# the API and break anyone, but this code does not serve the purposes of
|
32
|
+
# cookbook authors and customers. It is intended only for the purposes
|
33
|
+
# of the internal use in the chef-client codebase. We do not accept
|
34
|
+
# pull requests to extend the functionality of this algorithm. Users
|
35
|
+
# who find this does nearly what they want, should copy and paste the
|
36
|
+
# algorithm and tune to their needs. We will not maintain any additional
|
37
|
+
# use cases.
|
38
|
+
#
|
39
|
+
# "It is what it is, and if it isn't what you want, you need to build
|
40
|
+
# that yourself"
|
41
|
+
#
|
42
|
+
# @api private
|
43
|
+
#
|
28
44
|
module DeepMerge
|
29
45
|
|
30
46
|
extend self
|
31
47
|
|
48
|
+
# @api private
|
32
49
|
def merge(first, second)
|
33
50
|
first = Mash.new(first) unless first.is_a?(Mash)
|
34
51
|
second = Mash.new(second) unless second.is_a?(Mash)
|
@@ -38,29 +55,27 @@ class Chef
|
|
38
55
|
|
39
56
|
class InvalidParameter < StandardError; end
|
40
57
|
|
41
|
-
# Deep Merge core documentation.
|
42
58
|
# deep_merge! method permits merging of arbitrary child elements. The two top level
|
43
59
|
# elements must be hashes. These hashes can contain unlimited (to stack limit) levels
|
44
60
|
# of child elements. These child elements to not have to be of the same types.
|
45
61
|
# Where child elements are of the same type, deep_merge will attempt to merge them together.
|
46
62
|
# Where child elements are not of the same type, deep_merge will skip or optionally overwrite
|
47
63
|
# the destination element with the contents of the source element at that level.
|
64
|
+
#
|
48
65
|
# So if you have two hashes like this:
|
66
|
+
#
|
49
67
|
# source = {:x => [1,2,3], :y => 2}
|
50
68
|
# dest = {:x => [4,5,'6'], :y => [7,8,9]}
|
51
69
|
# dest.deep_merge!(source)
|
52
70
|
# Results: {:x => [1,2,3,4,5,'6'], :y => 2}
|
71
|
+
#
|
53
72
|
# By default, "deep_merge!" will overwrite any unmergeables and merge everything else.
|
54
73
|
# To avoid this, use "deep_merge" (no bang/exclamation mark)
|
74
|
+
#
|
75
|
+
# @api private
|
76
|
+
#
|
55
77
|
def deep_merge!(source, dest)
|
56
|
-
# if dest doesn't exist, then simply copy source to it
|
57
|
-
if dest.nil?
|
58
|
-
dest = source; return dest
|
59
|
-
end
|
60
|
-
|
61
78
|
case source
|
62
|
-
when nil
|
63
|
-
dest
|
64
79
|
when Hash
|
65
80
|
if dest.is_a?(Hash)
|
66
81
|
source.each do |src_key, src_value|
|
@@ -87,10 +102,12 @@ class Chef
|
|
87
102
|
dest
|
88
103
|
end # deep_merge!
|
89
104
|
|
105
|
+
# @api private
|
90
106
|
def hash_only_merge(merge_onto, merge_with)
|
91
107
|
hash_only_merge!(safe_dup(merge_onto), safe_dup(merge_with))
|
92
108
|
end
|
93
109
|
|
110
|
+
# @api private
|
94
111
|
def safe_dup(thing)
|
95
112
|
thing.dup
|
96
113
|
rescue TypeError
|
@@ -101,6 +118,9 @@ class Chef
|
|
101
118
|
# `merge_onto` is the object that will "lose" in case of conflict.
|
102
119
|
# `merge_with` is the object whose values will replace `merge_onto`s
|
103
120
|
# values when there is a conflict.
|
121
|
+
#
|
122
|
+
# @api private
|
123
|
+
#
|
104
124
|
def hash_only_merge!(merge_onto, merge_with)
|
105
125
|
# If there are two Hashes, recursively merge.
|
106
126
|
if merge_onto.is_a?(Hash) && merge_with.is_a?(Hash)
|
@@ -120,17 +140,14 @@ class Chef
|
|
120
140
|
end
|
121
141
|
end
|
122
142
|
merge_onto
|
123
|
-
|
124
|
-
# If merge_with is nil, don't replace merge_onto
|
125
|
-
elsif merge_with.nil?
|
126
|
-
merge_onto
|
127
|
-
|
128
143
|
# In all other cases, replace merge_onto with merge_with
|
129
144
|
else
|
130
145
|
merge_with
|
131
146
|
end
|
132
147
|
end
|
133
148
|
|
149
|
+
# @api private
|
150
|
+
#
|
134
151
|
def deep_merge(source, dest)
|
135
152
|
deep_merge!(safe_dup(source), safe_dup(dest))
|
136
153
|
end
|