chef 16.3.45-universal-mingw32 → 16.5.77-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 +20 -18
- 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 +55 -55
- 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 +2 -2
- 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/gem_installer.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 +10 -10
- 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/indentable_output_stream.rb +2 -2
- data/lib/chef/formatters/minimal.rb +5 -4
- data/lib/chef/http.rb +6 -3
- data/lib/chef/http/auth_credentials.rb +5 -1
- data/lib/chef/http/authenticator.rb +1 -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/ui.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_policy_set.rb +2 -2
- data/lib/chef/knife/node_run_list_add.rb +1 -1
- data/lib/chef/knife/node_run_list_remove.rb +1 -1
- data/lib/chef/knife/node_run_list_set.rb +1 -1
- data/lib/chef/knife/node_show.rb +2 -2
- data/lib/chef/knife/role_env_run_list_add.rb +1 -1
- data/lib/chef/knife/role_env_run_list_set.rb +1 -1
- data/lib/chef/knife/role_run_list_add.rb +1 -1
- data/lib/chef/knife/role_run_list_set.rb +1 -1
- data/lib/chef/knife/search.rb +0 -1
- data/lib/chef/knife/serve.rb +3 -3
- data/lib/chef/knife/ssh.rb +24 -9
- data/lib/chef/knife/ssl_check.rb +3 -3
- data/lib/chef/knife/status.rb +2 -2
- data/lib/chef/knife/tag_create.rb +1 -1
- data/lib/chef/knife/tag_delete.rb +1 -1
- 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 +3 -3
- data/lib/chef/mixin/uris.rb +4 -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 +4 -4
- data/lib/chef/platform/service_helpers.rb +1 -1
- data/lib/chef/policy_builder/dynamic.rb +2 -0
- data/lib/chef/policy_builder/policyfile.rb +2 -2
- data/lib/chef/property.rb +1 -1
- data/lib/chef/provider.rb +1 -5
- 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/link.rb +0 -9
- 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/dpkg.rb +3 -12
- data/lib/chef/provider/package/homebrew.rb +1 -1
- 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 +3 -3
- 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 +7 -7
- data/lib/chef/provider/user/mac.rb +12 -12
- 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 +8 -12
- data/lib/chef/resource/apt_repository.rb +5 -12
- 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 +149 -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_shared.rb +1 -0
- 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 +2 -2
- 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/resource_reporter.rb +0 -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 +6 -5
- 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 +2 -2
- 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 +3 -3
- data/lib/chef/win32/file/version_info.rb +5 -5
- data/lib/chef/win32/registry.rb +1 -2
- data/lib/chef/win32/unicode.rb +1 -1
- 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 -11
- 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/config_spec.rb +1 -1
- data/spec/unit/chef_fs/data_handler/data_bag_item_data_handler.rb +1 -1
- 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 -117
- 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/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/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
@@ -26,10 +26,6 @@ require "socket"
|
|
26
26
|
# actually running -- another testing requirement similar to the integration testing framework in cheffish as well)
|
27
27
|
#
|
28
28
|
describe Chef::DataCollector do
|
29
|
-
before(:each) do
|
30
|
-
Chef::Config[:enable_reporting] = true
|
31
|
-
end
|
32
|
-
|
33
29
|
let(:node) { Chef::Node.new }
|
34
30
|
|
35
31
|
let(:rest_client) { double("Chef::ServerAPI (mock)") }
|
@@ -39,6 +35,13 @@ describe Chef::DataCollector do
|
|
39
35
|
let(:new_resource) do
|
40
36
|
new_resource = Chef::Resource::File.new("/tmp/a-file.txt")
|
41
37
|
new_resource.checksum nil
|
38
|
+
# This next line is a hack to work around the fact that the name property will not have been autovivified yet
|
39
|
+
# in these unit tests which breaks some assumptions. Really the Formatters::ErrorMapper.resource_failed and
|
40
|
+
# related APIs need to properly walk and get properties on the resource rather than walking through instance
|
41
|
+
# variables, but the ErrorMappers probably pre-date the conversion to properties. But this next line is necesary
|
42
|
+
# to populate the name_property instance variable (which will happen naturally during the course of running the
|
43
|
+
# provider, so I don't think this is a user-visibile bug).
|
44
|
+
new_resource.path
|
42
45
|
new_resource
|
43
46
|
end
|
44
47
|
|
@@ -289,119 +292,6 @@ describe Chef::DataCollector do
|
|
289
292
|
end
|
290
293
|
end
|
291
294
|
|
292
|
-
describe "#should_be_enabled?" do
|
293
|
-
shared_examples_for "a solo-like run" do
|
294
|
-
it "is disabled in solo-legacy without a data_collector url and token" do
|
295
|
-
expect(Chef::DataCollector::ConfigValidation.should_be_enabled?).to be false
|
296
|
-
end
|
297
|
-
|
298
|
-
it "is disabled in solo-legacy with only a url" do
|
299
|
-
Chef::Config[:data_collector][:server_url] = "https://www.esa.local/ariane5"
|
300
|
-
expect(Chef::DataCollector::ConfigValidation.should_be_enabled?).to be false
|
301
|
-
end
|
302
|
-
|
303
|
-
it "is disabled in solo-legacy with only a token" do
|
304
|
-
Chef::Config[:data_collector][:token] = "admit_one"
|
305
|
-
expect(Chef::DataCollector::ConfigValidation.should_be_enabled?).to be false
|
306
|
-
end
|
307
|
-
|
308
|
-
it "is enabled in solo-legacy with both a token and url" do
|
309
|
-
Chef::Config[:data_collector][:server_url] = "https://www.esa.local/ariane5"
|
310
|
-
Chef::Config[:data_collector][:token] = "no_cash_value"
|
311
|
-
expect(Chef::DataCollector::ConfigValidation.should_be_enabled?).to be true
|
312
|
-
end
|
313
|
-
|
314
|
-
it "is enabled in solo-legacy with only an output location to a file" do
|
315
|
-
Chef::Config[:data_collector][:output_locations] = { files: [ "/always/be/counting/down" ] }
|
316
|
-
expect(Chef::DataCollector::ConfigValidation.should_be_enabled?).to be true
|
317
|
-
end
|
318
|
-
|
319
|
-
it "is disabled in solo-legacy with only an output location to a uri" do
|
320
|
-
Chef::Config[:data_collector][:output_locations] = { urls: [ "https://esa.local/ariane5" ] }
|
321
|
-
expect(Chef::DataCollector::ConfigValidation.should_be_enabled?).to be false
|
322
|
-
end
|
323
|
-
|
324
|
-
it "is enabled in solo-legacy with only an output location to a uri with a token" do
|
325
|
-
Chef::Config[:data_collector][:output_locations] = { urls: [ "https://esa.local/ariane5" ] }
|
326
|
-
Chef::Config[:data_collector][:token] = "good_for_one_fare"
|
327
|
-
expect(Chef::DataCollector::ConfigValidation.should_be_enabled?).to be true
|
328
|
-
end
|
329
|
-
|
330
|
-
it "is enabled in solo-legacy when the mode is :solo" do
|
331
|
-
Chef::Config[:data_collector][:server_url] = "https://www.esa.local/ariane5"
|
332
|
-
Chef::Config[:data_collector][:token] = "non_redeemable"
|
333
|
-
Chef::Config[:data_collector][:mode] = :solo
|
334
|
-
expect(Chef::DataCollector::ConfigValidation.should_be_enabled?).to be true
|
335
|
-
end
|
336
|
-
|
337
|
-
it "is enabled in solo-legacy when the mode is :both" do
|
338
|
-
Chef::Config[:data_collector][:server_url] = "https://www.esa.local/ariane5"
|
339
|
-
Chef::Config[:data_collector][:token] = "non_negotiable"
|
340
|
-
Chef::Config[:data_collector][:mode] = :both
|
341
|
-
expect(Chef::DataCollector::ConfigValidation.should_be_enabled?).to be true
|
342
|
-
end
|
343
|
-
|
344
|
-
it "is disabled in solo-legacy when the mode is :client" do
|
345
|
-
Chef::Config[:data_collector][:server_url] = "https://www.esa.local/ariane5"
|
346
|
-
Chef::Config[:data_collector][:token] = "NYCTA"
|
347
|
-
Chef::Config[:data_collector][:mode] = :client
|
348
|
-
expect(Chef::DataCollector::ConfigValidation.should_be_enabled?).to be false
|
349
|
-
end
|
350
|
-
|
351
|
-
it "is disabled in solo-legacy mode when the mode is :nonsense" do
|
352
|
-
Chef::Config[:data_collector][:server_url] = "https://www.esa.local/ariane5"
|
353
|
-
Chef::Config[:data_collector][:token] = "MTA"
|
354
|
-
Chef::Config[:data_collector][:mode] = :nonsense
|
355
|
-
expect(Chef::DataCollector::ConfigValidation.should_be_enabled?).to be false
|
356
|
-
end
|
357
|
-
end
|
358
|
-
|
359
|
-
it "by default it is enabled" do
|
360
|
-
expect(Chef::DataCollector::ConfigValidation.should_be_enabled?).to be true
|
361
|
-
end
|
362
|
-
|
363
|
-
it "is disabled in why-run" do
|
364
|
-
Chef::Config[:why_run] = true
|
365
|
-
expect(Chef::DataCollector::ConfigValidation.should_be_enabled?).to be false
|
366
|
-
end
|
367
|
-
|
368
|
-
describe "a solo legacy run" do
|
369
|
-
before(:each) do
|
370
|
-
Chef::Config[:solo_legacy_mode] = true
|
371
|
-
end
|
372
|
-
|
373
|
-
it_behaves_like "a solo-like run"
|
374
|
-
end
|
375
|
-
|
376
|
-
describe "a local mode run" do
|
377
|
-
before(:each) do
|
378
|
-
Chef::Config[:local_mode] = true
|
379
|
-
end
|
380
|
-
|
381
|
-
it_behaves_like "a solo-like run"
|
382
|
-
end
|
383
|
-
|
384
|
-
it "is enabled in client mode when the mode is :both" do
|
385
|
-
Chef::Config[:data_collector][:mode] = :both
|
386
|
-
expect(Chef::DataCollector::ConfigValidation.should_be_enabled?).to be true
|
387
|
-
end
|
388
|
-
|
389
|
-
it "is disabled in client mode when the mode is :solo" do
|
390
|
-
Chef::Config[:data_collector][:mode] = :solo
|
391
|
-
expect(Chef::DataCollector::ConfigValidation.should_be_enabled?).to be false
|
392
|
-
end
|
393
|
-
|
394
|
-
it "is disabled in client mode when the mode is :nonsense" do
|
395
|
-
Chef::Config[:data_collector][:mode] = :nonsense
|
396
|
-
expect(Chef::DataCollector::ConfigValidation.should_be_enabled?).to be false
|
397
|
-
end
|
398
|
-
|
399
|
-
it "is still enabled if you set a token in client mode" do
|
400
|
-
Chef::Config[:data_collector][:token] = "good_for_one_ride"
|
401
|
-
expect(Chef::DataCollector::ConfigValidation.should_be_enabled?).to be true
|
402
|
-
end
|
403
|
-
end
|
404
|
-
|
405
295
|
describe "when the run fails during node load" do
|
406
296
|
let(:exception) { Exception.new("imperial to metric conversion error") }
|
407
297
|
let(:error_description) { Chef::Formatters::ErrorMapper.registration_failed(node_name, exception, Chef::Config).for_json }
|
@@ -780,6 +670,13 @@ describe Chef::DataCollector do
|
|
780
670
|
let(:resource_record) do
|
781
671
|
rec = resource_record_for(new_resource, current_resource, nil, :create, "failed", "1234")
|
782
672
|
rec["error_message"] = "imperial to metric conversion error"
|
673
|
+
rec["error"] = {
|
674
|
+
"class" => exception.class,
|
675
|
+
"message" => exception.message,
|
676
|
+
"backtrace" => exception.backtrace,
|
677
|
+
"description" => error_description,
|
678
|
+
}
|
679
|
+
|
783
680
|
[ rec ]
|
784
681
|
end
|
785
682
|
let(:status) { "failure" }
|
@@ -808,6 +705,13 @@ describe Chef::DataCollector do
|
|
808
705
|
rec = resource_record_for(new_resource, nil, nil, :create, "failed", "1234")
|
809
706
|
rec["before"] = {}
|
810
707
|
rec["error_message"] = "imperial to metric conversion error"
|
708
|
+
rec["error"] = {
|
709
|
+
"class" => exception.class,
|
710
|
+
"message" => exception.message,
|
711
|
+
"backtrace" => exception.backtrace,
|
712
|
+
"description" => error_description,
|
713
|
+
}
|
714
|
+
|
811
715
|
[ rec ]
|
812
716
|
end
|
813
717
|
let(:status) { "failure" }
|
@@ -842,6 +746,13 @@ describe Chef::DataCollector do
|
|
842
746
|
let(:resource_record) do
|
843
747
|
rec1 = resource_record_for(new_resource, current_resource, nil, :create, "failed", "1234")
|
844
748
|
rec1["error_message"] = "imperial to metric conversion error"
|
749
|
+
rec1["error"] = {
|
750
|
+
"class" => exception.class,
|
751
|
+
"message" => exception.message,
|
752
|
+
"backtrace" => exception.backtrace,
|
753
|
+
"description" => error_description,
|
754
|
+
}
|
755
|
+
|
845
756
|
rec2 = resource_record_for(unprocessed_resource, nil, nil, :nothing, "unprocessed", "")
|
846
757
|
[ rec1, rec2 ]
|
847
758
|
end
|
@@ -19,7 +19,7 @@ require "spec_helper"
|
|
19
19
|
|
20
20
|
describe Chef::ResourceCollection do
|
21
21
|
let(:run_context) do
|
22
|
-
cookbook_repo = File.expand_path(File.join(
|
22
|
+
cookbook_repo = File.expand_path(File.join(__dir__, "..", "..", "data", "cookbooks"))
|
23
23
|
cookbook_loader = Chef::CookbookLoader.new(cookbook_repo)
|
24
24
|
cookbook_loader.load_cookbooks
|
25
25
|
node = Chef::Node.new
|
@@ -402,8 +402,8 @@ describe Chef::Environment do
|
|
402
402
|
|
403
403
|
it "should get the environment from the environment_path" do
|
404
404
|
expect(File).to receive(:directory?).with(Chef::Config[:environment_path]).and_return(true)
|
405
|
-
expect(File).to receive(:
|
406
|
-
expect(File).to receive(:
|
405
|
+
expect(File).to receive(:exist?).with(File.join(Chef::Config[:environment_path], "foo.json")).and_return(false)
|
406
|
+
expect(File).to receive(:exist?).with(File.join(Chef::Config[:environment_path], "foo.rb")).exactly(1).times.and_return(true)
|
407
407
|
expect(File).to receive(:readable?).with(File.join(Chef::Config[:environment_path], "foo.rb")).and_return(true)
|
408
408
|
expect(File).to receive(:file?).with(File.join(Chef::Config[:environment_path], "foo.rb")).and_return(true)
|
409
409
|
role_dsl = "name \"foo\"\ndescription \"desc\"\n"
|
@@ -413,7 +413,7 @@ describe Chef::Environment do
|
|
413
413
|
|
414
414
|
it "should return a Chef::Environment object from JSON" do
|
415
415
|
expect(File).to receive(:directory?).with(Chef::Config[:environment_path]).and_return(true)
|
416
|
-
expect(File).to receive(:
|
416
|
+
expect(File).to receive(:exist?).with(File.join(Chef::Config[:environment_path], "foo.json")).and_return(true)
|
417
417
|
environment_hash = {
|
418
418
|
"name" => "foo",
|
419
419
|
"default_attributes" => {
|
@@ -436,8 +436,8 @@ describe Chef::Environment do
|
|
436
436
|
|
437
437
|
it "should return a Chef::Environment object from Ruby DSL" do
|
438
438
|
expect(File).to receive(:directory?).with(Chef::Config[:environment_path]).and_return(true)
|
439
|
-
expect(File).to receive(:
|
440
|
-
expect(File).to receive(:
|
439
|
+
expect(File).to receive(:exist?).with(File.join(Chef::Config[:environment_path], "foo.json")).and_return(false)
|
440
|
+
expect(File).to receive(:exist?).with(File.join(Chef::Config[:environment_path], "foo.rb")).exactly(1).times.and_return(true)
|
441
441
|
expect(File).to receive(:readable?).with(File.join(Chef::Config[:environment_path], "foo.rb")).and_return(true)
|
442
442
|
expect(File).to receive(:file?).with(File.join(Chef::Config[:environment_path], "foo.rb")).and_return(true)
|
443
443
|
role_dsl = "name \"foo\"\ndescription \"desc\"\n"
|
@@ -463,8 +463,8 @@ describe Chef::Environment do
|
|
463
463
|
|
464
464
|
it "should raise an error if the file does not exist" do
|
465
465
|
expect(File).to receive(:directory?).with(Chef::Config[:environment_path]).and_return(true)
|
466
|
-
expect(File).to receive(:
|
467
|
-
expect(File).to receive(:
|
466
|
+
expect(File).to receive(:exist?).with(File.join(Chef::Config[:environment_path], "foo.json")).and_return(false)
|
467
|
+
expect(File).to receive(:exist?).with(File.join(Chef::Config[:environment_path], "foo.rb")).and_return(false)
|
468
468
|
|
469
469
|
expect do
|
470
470
|
Chef::Environment.load("foo")
|
@@ -26,7 +26,7 @@ describe Chef::FileAccessControl do
|
|
26
26
|
# we have to re-load the file so the proper
|
27
27
|
# platform specific module is mixed in
|
28
28
|
@node = Chef::Node.new
|
29
|
-
load File.join(
|
29
|
+
load File.join(__dir__, "..", "..", "lib", "chef", "file_access_control.rb")
|
30
30
|
@resource = Chef::Resource::File.new("/tmp/a_file.txt")
|
31
31
|
@resource.owner("toor")
|
32
32
|
@resource.group("wheel")
|
@@ -185,7 +185,7 @@ describe Chef::Knife::Bootstrap do
|
|
185
185
|
context "when :bootstrap_template config is set to a template name" do
|
186
186
|
let(:bootstrap_template) { "example" }
|
187
187
|
|
188
|
-
let(:builtin_template_path) { File.expand_path(File.join(
|
188
|
+
let(:builtin_template_path) { File.expand_path(File.join(__dir__, "../../../lib/chef/knife/bootstrap/templates", "example.erb")) }
|
189
189
|
|
190
190
|
let(:chef_config_dir_template_path) { "/knife/chef/config/bootstrap/example.erb" }
|
191
191
|
|
@@ -206,7 +206,7 @@ describe Chef::Knife::Bootstrap do
|
|
206
206
|
end
|
207
207
|
|
208
208
|
before(:each) do
|
209
|
-
expect(File).to receive(:
|
209
|
+
expect(File).to receive(:exist?).with(bootstrap_template).and_return(false)
|
210
210
|
end
|
211
211
|
|
212
212
|
context "when file is available everywhere" do
|
@@ -215,7 +215,7 @@ describe Chef::Knife::Bootstrap do
|
|
215
215
|
configure_env_home
|
216
216
|
configure_gem_files
|
217
217
|
|
218
|
-
expect(File).to receive(:
|
218
|
+
expect(File).to receive(:exist?).with(builtin_template_path).and_return(true)
|
219
219
|
end
|
220
220
|
|
221
221
|
it "should load the template from built-in templates" do
|
@@ -229,8 +229,8 @@ describe Chef::Knife::Bootstrap do
|
|
229
229
|
configure_env_home
|
230
230
|
configure_gem_files
|
231
231
|
|
232
|
-
expect(File).to receive(:
|
233
|
-
expect(File).to receive(:
|
232
|
+
expect(File).to receive(:exist?).with(builtin_template_path).and_return(false)
|
233
|
+
expect(File).to receive(:exist?).with(chef_config_dir_template_path).and_return(true)
|
234
234
|
|
235
235
|
it "should load the template from chef_config_dir" do
|
236
236
|
knife.find_template.should eq(chef_config_dir_template_path)
|
@@ -244,9 +244,9 @@ describe Chef::Knife::Bootstrap do
|
|
244
244
|
configure_env_home
|
245
245
|
configure_gem_files
|
246
246
|
|
247
|
-
expect(File).to receive(:
|
248
|
-
expect(File).to receive(:
|
249
|
-
expect(File).to receive(:
|
247
|
+
expect(File).to receive(:exist?).with(builtin_template_path).and_return(false)
|
248
|
+
expect(File).to receive(:exist?).with(chef_config_dir_template_path).and_return(false)
|
249
|
+
expect(File).to receive(:exist?).with(env_home_template_path).and_return(true)
|
250
250
|
end
|
251
251
|
|
252
252
|
it "should load the template from chef_config_dir" do
|
@@ -260,10 +260,10 @@ describe Chef::Knife::Bootstrap do
|
|
260
260
|
configure_env_home
|
261
261
|
configure_gem_files
|
262
262
|
|
263
|
-
expect(File).to receive(:
|
264
|
-
expect(File).to receive(:
|
265
|
-
expect(File).to receive(:
|
266
|
-
expect(File).to receive(:
|
263
|
+
expect(File).to receive(:exist?).with(builtin_template_path).and_return(false)
|
264
|
+
expect(File).to receive(:exist?).with(chef_config_dir_template_path).and_return(false)
|
265
|
+
expect(File).to receive(:exist?).with(env_home_template_path).and_return(false)
|
266
|
+
expect(File).to receive(:exist?).with(gem_files_template_path).and_return(true)
|
267
267
|
end
|
268
268
|
|
269
269
|
it "should load the template from Gem files" do
|
@@ -277,9 +277,9 @@ describe Chef::Knife::Bootstrap do
|
|
277
277
|
configure_gem_files
|
278
278
|
allow(Chef::Util::PathHelper).to receive(:home).with(".chef", "bootstrap", "example.erb").and_return(nil)
|
279
279
|
|
280
|
-
expect(File).to receive(:
|
281
|
-
expect(File).to receive(:
|
282
|
-
expect(File).to receive(:
|
280
|
+
expect(File).to receive(:exist?).with(builtin_template_path).and_return(false)
|
281
|
+
expect(File).to receive(:exist?).with(chef_config_dir_template_path).and_return(false)
|
282
|
+
expect(File).to receive(:exist?).with(gem_files_template_path).and_return(true)
|
283
283
|
end
|
284
284
|
|
285
285
|
it "should load the template from Gem files" do
|
@@ -472,7 +472,7 @@ describe Chef::Knife::Bootstrap do
|
|
472
472
|
end
|
473
473
|
|
474
474
|
describe "when transferring trusted certificates" do
|
475
|
-
let(:trusted_certs_dir) { Chef::Util::PathHelper.cleanpath(File.join(
|
475
|
+
let(:trusted_certs_dir) { Chef::Util::PathHelper.cleanpath(File.join(__dir__, "../../data/trusted_certs")) }
|
476
476
|
|
477
477
|
let(:rendered_template) do
|
478
478
|
knife.merge_configs
|
@@ -504,7 +504,7 @@ describe Chef::Knife::Bootstrap do
|
|
504
504
|
end
|
505
505
|
|
506
506
|
context "when :trusted_cets_dir is empty" do
|
507
|
-
let(:trusted_certs_dir) { Chef::Util::PathHelper.cleanpath(File.join(
|
507
|
+
let(:trusted_certs_dir) { Chef::Util::PathHelper.cleanpath(File.join(__dir__, "../../data/trusted_certs_empty")) }
|
508
508
|
it "doesn't create /etc/chef/trusted_certs if :trusted_certs_dir is empty" do
|
509
509
|
expect(rendered_template).not_to match(%r{mkdir -p /etc/chef/trusted_certs})
|
510
510
|
end
|
@@ -514,7 +514,7 @@ describe Chef::Knife::Bootstrap do
|
|
514
514
|
|
515
515
|
context "when doing fips things" do
|
516
516
|
let(:template_file) { File.expand_path(File.join(CHEF_SPEC_DATA, "bootstrap", "no_proxy.erb")) }
|
517
|
-
let(:trusted_certs_dir) { Chef::Util::PathHelper.cleanpath(File.join(
|
517
|
+
let(:trusted_certs_dir) { Chef::Util::PathHelper.cleanpath(File.join(__dir__, "../../data/trusted_certs")) }
|
518
518
|
|
519
519
|
before do
|
520
520
|
Chef::Config[:knife][:bootstrap_template] = template_file
|
@@ -570,7 +570,7 @@ describe Chef::Knife::Bootstrap do
|
|
570
570
|
context "when client_d_dir is set" do
|
571
571
|
let(:client_d_dir) do
|
572
572
|
Chef::Util::PathHelper.cleanpath(
|
573
|
-
File.join(
|
573
|
+
File.join(__dir__, "../../data/client.d_00")
|
574
574
|
)
|
575
575
|
end
|
576
576
|
|
@@ -597,7 +597,7 @@ describe Chef::Knife::Bootstrap do
|
|
597
597
|
context "a nested directory structure" do
|
598
598
|
let(:client_d_dir) do
|
599
599
|
Chef::Util::PathHelper.cleanpath(
|
600
|
-
File.join(
|
600
|
+
File.join(__dir__, "../../data/client.d_01")
|
601
601
|
)
|
602
602
|
end
|
603
603
|
it "creates a file foo/bar.rb" do
|
@@ -94,7 +94,7 @@ describe Chef::Knife::CookbookDownload do
|
|
94
94
|
let(:manifest_data) { { all_files: [] } }
|
95
95
|
it "should determine which version to download" do
|
96
96
|
expect(@knife).to receive(:determine_version).and_return("1.0.0")
|
97
|
-
expect(File).to receive(:
|
97
|
+
expect(File).to receive(:exist?).with("/var/tmp/chef/foobar-1.0.0").and_return(false)
|
98
98
|
@knife.run
|
99
99
|
end
|
100
100
|
end
|
@@ -111,7 +111,7 @@ describe Chef::Knife::CookbookDownload do
|
|
111
111
|
end
|
112
112
|
|
113
113
|
it "should print an error and exit if the cookbook download directory already exists" do
|
114
|
-
expect(File).to receive(:
|
114
|
+
expect(File).to receive(:exist?).with("/var/tmp/chef/foobar-1.0.0").and_return(true)
|
115
115
|
expect(@knife.ui).to receive(:fatal).with(%r{/var/tmp/chef/foobar-1\.0\.0 exists}i)
|
116
116
|
expect { @knife.run }.to raise_error(SystemExit)
|
117
117
|
end
|
@@ -135,7 +135,7 @@ describe Chef::Knife::CookbookDownload do
|
|
135
135
|
end
|
136
136
|
|
137
137
|
it "should download the cookbook when the cookbook download directory doesn't exist" do
|
138
|
-
expect(File).to receive(:
|
138
|
+
expect(File).to receive(:exist?).with("/var/tmp/chef/foobar-1.0.0").and_return(false)
|
139
139
|
@knife.run
|
140
140
|
%w{attributes recipes templates}.each do |segment|
|
141
141
|
expect(@stderr.string).to match /downloading #{segment}/im
|
@@ -147,7 +147,7 @@ describe Chef::Knife::CookbookDownload do
|
|
147
147
|
describe "with -f or --force" do
|
148
148
|
it "should remove the existing the cookbook download directory if it exists" do
|
149
149
|
@knife.config[:force] = true
|
150
|
-
expect(File).to receive(:
|
150
|
+
expect(File).to receive(:exist?).with("/var/tmp/chef/foobar-1.0.0").and_return(true)
|
151
151
|
expect(FileUtils).to receive(:rm_rf).with("/var/tmp/chef/foobar-1.0.0")
|
152
152
|
@knife.run
|
153
153
|
end
|
@@ -50,7 +50,7 @@ describe Chef::Knife::SubcommandLoader::HashedCommandLoader do
|
|
50
50
|
|
51
51
|
describe "#list_commands" do
|
52
52
|
before do
|
53
|
-
allow(File).to receive(:
|
53
|
+
allow(File).to receive(:exist?).and_return(true)
|
54
54
|
end
|
55
55
|
|
56
56
|
it "lists all commands by category when no argument is given" do
|
@@ -63,7 +63,7 @@ describe Chef::Knife::SubcommandLoader::HashedCommandLoader do
|
|
63
63
|
|
64
64
|
context "when the plugin path is invalid" do
|
65
65
|
before do
|
66
|
-
expect(File).to receive(:
|
66
|
+
expect(File).to receive(:exist?).with("/file/for/plugin/b").and_return(false)
|
67
67
|
end
|
68
68
|
|
69
69
|
it "lists all commands by category when no argument is given" do
|
@@ -90,7 +90,7 @@ describe Chef::Knife::SubcommandLoader::HashedCommandLoader do
|
|
90
90
|
end
|
91
91
|
|
92
92
|
it "loads the correct file and returns true if the command exists" do
|
93
|
-
allow(File).to receive(:
|
93
|
+
allow(File).to receive(:exist?).and_return(true)
|
94
94
|
expect(Kernel).to receive(:load).with("/file/for/plugin/a").and_return(true)
|
95
95
|
expect(loader.load_command(["cool_a"])).to eq(true)
|
96
96
|
end
|
@@ -510,6 +510,7 @@ describe Chef::Knife::UI do
|
|
510
510
|
describe "color" do
|
511
511
|
context "when ui.color? => true" do
|
512
512
|
it "returns colored output" do
|
513
|
+
skip "doesn't work on systems that don't correctly have terminals setup for color"
|
513
514
|
expect(@ui).to receive(:color?).and_return(true)
|
514
515
|
expect(@ui.color("a_bus_is", :yellow)).to eql("\e[33ma_bus_is\e[0m")
|
515
516
|
end
|
@@ -148,24 +148,28 @@ describe Chef::Knife::Core::WindowsBootstrapContext do
|
|
148
148
|
|
149
149
|
describe "#config_content" do
|
150
150
|
before do
|
151
|
-
bootstrap_context.instance_variable_set(
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
151
|
+
bootstrap_context.instance_variable_set(
|
152
|
+
:@chef_config, Mash.new(
|
153
|
+
config_log_level: :info,
|
154
|
+
config_log_location: STDOUT,
|
155
|
+
chef_server_url: "http://chef.example.com:4444",
|
156
|
+
validation_client_name: "chef-validator-testing",
|
157
|
+
file_cache_path: "c:/chef/cache",
|
158
|
+
file_backup_path: "c:/chef/backup",
|
159
|
+
cache_options: ({ path: "c:/chef/cache/checksums", skip_expires: true })
|
160
|
+
)
|
161
|
+
)
|
158
162
|
end
|
159
163
|
|
160
164
|
it "generates the config file data" do
|
161
165
|
expected = <<~EXPECTED
|
162
166
|
echo.chef_server_url "http://chef.example.com:4444"
|
163
167
|
echo.validation_client_name "chef-validator-testing"
|
164
|
-
echo.file_cache_path "C
|
165
|
-
echo.file_backup_path "C
|
166
|
-
echo.cache_options ^({:path =^> "C
|
168
|
+
echo.file_cache_path "C:\\\\chef\\\\cache"
|
169
|
+
echo.file_backup_path "C:\\\\chef\\\\backup"
|
170
|
+
echo.cache_options ^({:path =^> "C:\\\\chef\\\\cache\\\\checksums", :skip_expires =^> true}^)
|
167
171
|
echo.# Using default node name ^(fqdn^)
|
168
|
-
echo.log_level
|
172
|
+
echo.log_level :auto
|
169
173
|
echo.log_location STDOUT
|
170
174
|
EXPECTED
|
171
175
|
expect(bootstrap_context.config_content).to eq expected
|
@@ -183,7 +187,12 @@ describe Chef::Knife::Core::WindowsBootstrapContext do
|
|
183
187
|
|
184
188
|
describe "#start_chef" do
|
185
189
|
it "returns the expected string" do
|
186
|
-
expect(bootstrap_context.start_chef).to
|
190
|
+
expect(bootstrap_context.start_chef).to eq(
|
191
|
+
<<~EOH
|
192
|
+
SET "PATH=%SYSTEM32%;%SystemRoot%;%SYSTEM32%\\Wbem;%SYSTEM32%\\WindowsPowerShell\\v1.0\\;C:\\ruby\\bin;C:\\opscode\\chef\\bin;C:\\opscode\\chef\\embedded\\bin;%PATH%"
|
193
|
+
chef-client -c C:\\chef\\client.rb -j C:\\chef\\first-boot.json
|
194
|
+
EOH
|
195
|
+
)
|
187
196
|
end
|
188
197
|
end
|
189
198
|
|