chef 16.4.38 → 16.7.61
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +5 -12
- data/Rakefile +22 -15
- data/bin/knife +1 -1
- data/chef-universal-mingw32.gemspec +1 -1
- data/chef.gemspec +2 -1
- data/lib/chef/application.rb +19 -17
- data/lib/chef/application/apply.rb +12 -7
- data/lib/chef/application/base.rb +26 -23
- data/lib/chef/application/client.rb +16 -5
- 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 +14 -14
- data/lib/chef/application/windows_service_manager.rb +6 -6
- data/lib/chef/chef_fs/chef_fs_data_store.rb +1 -1
- data/lib/chef/chef_fs/data_handler/cookbook_data_handler.rb +1 -1
- data/lib/chef/chef_fs/file_pattern.rb +1 -1
- data/lib/chef/chef_fs/file_system/repository/chef_repository_file_system_cookbook_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 +13 -43
- 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_manifest.rb +1 -1
- data/lib/chef/cookbook_site_streaming_uploader.rb +13 -11
- data/lib/chef/cookbook_uploader.rb +1 -1
- data/lib/chef/cookbook_version.rb +2 -5
- data/lib/chef/data_collector.rb +7 -6
- data/lib/chef/data_collector/config_validation.rb +22 -13
- data/lib/chef/data_collector/run_end_message.rb +2 -2
- 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 +1 -1
- 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 +3 -3
- 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 +6 -5
- data/lib/chef/file_content_management/tempfile.rb +1 -1
- 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/compile_error_inspector.rb +2 -2
- 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 +6 -6
- 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/guard_interpreter/resource_guard_interpreter.rb +28 -39
- data/lib/chef/http.rb +6 -14
- 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 +3 -8
- data/lib/chef/key.rb +1 -1
- data/lib/chef/knife.rb +4 -4
- data/lib/chef/knife/bootstrap.rb +18 -15
- 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 +9 -9
- 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/core/bootstrap_context.rb +2 -2
- data/lib/chef/knife/core/cookbook_scm_repo.rb +1 -1
- data/lib/chef/knife/core/gem_glob_loader.rb +1 -1
- 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 +18 -15
- data/lib/chef/knife/exec.rb +2 -2
- 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 +18 -3
- 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/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/convert_to_class_name.rb +0 -56
- data/lib/chef/mixin/deep_merge.rb +0 -12
- data/lib/chef/mixin/openssl_helper.rb +2 -5
- data/lib/chef/mixin/powershell_exec.rb +22 -10
- data/lib/chef/mixin/powershell_out.rb +12 -5
- data/lib/chef/mixin/properties.rb +2 -0
- data/lib/chef/mixin/template.rb +3 -3
- data/lib/chef/mixin/unformatter.rb +1 -1
- data/lib/chef/mixin/uris.rb +4 -2
- data/lib/chef/mixin/versioned_api.rb +1 -2
- data/lib/chef/node/attribute_collections.rb +2 -6
- data/lib/chef/node/mixin/immutablize_hash.rb +2 -0
- data/lib/chef/node_map.rb +4 -4
- data/lib/chef/policy_builder/dynamic.rb +2 -0
- data/lib/chef/policy_builder/policyfile.rb +2 -2
- data/lib/chef/powershell.rb +8 -4
- data/lib/chef/property.rb +1 -1
- data/lib/chef/provider.rb +1 -5
- data/lib/chef/provider/cron.rb +2 -13
- data/lib/chef/provider/file.rb +2 -2
- data/lib/chef/provider/group.rb +14 -6
- data/lib/chef/provider/group/windows.rb +12 -1
- data/lib/chef/provider/ifconfig.rb +9 -9
- data/lib/chef/provider/ifconfig/debian.rb +38 -22
- data/lib/chef/provider/ifconfig/redhat.rb +54 -18
- data/lib/chef/provider/launchd.rb +3 -13
- data/lib/chef/provider/link.rb +0 -9
- data/lib/chef/provider/mount.rb +18 -1
- data/lib/chef/provider/mount/linux.rb +67 -0
- data/lib/chef/provider/mount/mount.rb +41 -43
- data/lib/chef/provider/package.rb +3 -0
- data/lib/chef/provider/package/apt.rb +1 -1
- data/lib/chef/provider/package/chocolatey.rb +6 -6
- data/lib/chef/provider/package/dpkg.rb +3 -12
- data/lib/chef/provider/package/freebsd/base.rb +3 -2
- data/lib/chef/provider/package/freebsd/pkgng.rb +1 -1
- data/lib/chef/provider/package/homebrew.rb +1 -1
- data/lib/chef/provider/package/ips.rb +1 -1
- data/lib/chef/provider/package/powershell.rb +2 -3
- data/lib/chef/provider/package/rubygems.rb +22 -19
- data/lib/chef/provider/package/snap.rb +1 -4
- data/lib/chef/provider/package/solaris.rb +0 -2
- data/lib/chef/provider/package/windows.rb +2 -2
- data/lib/chef/provider/package/windows/registry_uninstall_entry.rb +3 -1
- data/lib/chef/provider/package/yum/rpm_utils.rb +1 -1
- data/lib/chef/provider/package/zypper.rb +99 -72
- data/lib/chef/provider/powershell_script.rb +12 -1
- data/lib/chef/provider/registry_key.rb +4 -3
- 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 +4 -8
- data/lib/chef/provider/service/debian.rb +2 -1
- data/lib/chef/provider/service/macosx.rb +2 -2
- data/lib/chef/provider/service/redhat.rb +1 -1
- data/lib/chef/provider/template_finder.rb +2 -10
- data/lib/chef/provider/user.rb +17 -9
- data/lib/chef/provider/user/aix.rb +1 -1
- data/lib/chef/provider/user/dscl.rb +5 -5
- data/lib/chef/provider/user/mac.rb +15 -7
- data/lib/chef/provider/user/solaris.rb +1 -1
- data/lib/chef/provider/user/windows.rb +10 -3
- data/lib/chef/provider/zypper_repository.rb +2 -2
- data/lib/chef/provider_resolver.rb +1 -1
- data/lib/chef/providers.rb +1 -3
- data/lib/chef/pwsh.rb +71 -0
- data/lib/chef/recipe.rb +2 -2
- data/lib/chef/resource.rb +2 -2
- data/lib/chef/resource/apt_repository.rb +6 -5
- data/lib/chef/resource/bash.rb +119 -1
- data/lib/chef/resource/batch.rb +1 -1
- data/lib/chef/resource/bff_package.rb +22 -0
- data/lib/chef/resource/breakpoint.rb +59 -2
- data/lib/chef/resource/build_essential.rb +5 -8
- data/lib/chef/resource/cab_package.rb +29 -0
- data/lib/chef/resource/chef_client_config.rb +313 -0
- data/lib/chef/resource/chef_client_cron.rb +35 -28
- data/lib/chef/resource/chef_client_launchd.rb +194 -0
- data/lib/chef/resource/chef_client_scheduled_task.rb +24 -21
- data/lib/chef/resource/chef_client_systemd_timer.rb +27 -20
- 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 +3 -3
- data/lib/chef/resource/chef_vault_secret.rb +1 -1
- 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 +2 -3
- data/lib/chef/resource/csh.rb +2 -2
- 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 +10 -8
- 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 +9 -6
- data/lib/chef/resource/hostname.rb +4 -4
- data/lib/chef/resource/ifconfig.rb +52 -5
- data/lib/chef/resource/kernel_module.rb +1 -1
- data/lib/chef/resource/ksh.rb +3 -3
- data/lib/chef/resource/launchd.rb +17 -16
- data/lib/chef/resource/locale.rb +2 -2
- data/lib/chef/resource/lwrp_base.rb +3 -5
- data/lib/chef/resource/macos_userdefaults.rb +3 -3
- data/lib/chef/resource/mount.rb +8 -2
- 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 +27 -5
- data/lib/chef/resource/openssl_ec_private_key.rb +6 -3
- data/lib/chef/resource/openssl_ec_public_key.rb +2 -2
- data/lib/chef/resource/openssl_rsa_private_key.rb +6 -3
- data/lib/chef/resource/openssl_x509_certificate.rb +14 -14
- data/lib/chef/resource/openssl_x509_crl.rb +19 -10
- data/lib/chef/resource/openssl_x509_request.rb +14 -16
- data/lib/chef/resource/osx_profile.rb +77 -13
- data/lib/chef/resource/perl.rb +2 -2
- data/lib/chef/resource/plist.rb +3 -7
- data/lib/chef/resource/powershell_package_source.rb +24 -23
- data/lib/chef/resource/powershell_script.rb +14 -11
- data/lib/chef/resource/python.rb +2 -2
- data/lib/chef/resource/reboot.rb +2 -2
- data/lib/chef/resource/registry_key.rb +93 -2
- data/lib/chef/resource/remote_file.rb +3 -3
- data/lib/chef/resource/rhsm_register.rb +22 -10
- data/lib/chef/resource/route.rb +1 -1
- data/lib/chef/resource/ruby.rb +2 -2
- data/lib/chef/resource/ruby_block.rb +2 -2
- data/lib/chef/resource/scm/_scm.rb +2 -1
- data/lib/chef/resource/scm/git.rb +82 -1
- data/lib/chef/resource/scm/subversion.rb +14 -2
- data/lib/chef/resource/script.rb +2 -2
- data/lib/chef/resource/service.rb +3 -3
- data/lib/chef/resource/solaris_package.rb +0 -2
- data/lib/chef/resource/ssh_known_hosts_entry.rb +2 -2
- data/lib/chef/resource/sudo.rb +1 -1
- data/lib/chef/resource/support/client.erb +64 -0
- 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 +1 -5
- data/lib/chef/resource/systemd_unit.rb +44 -3
- data/lib/chef/resource/template.rb +2 -2
- data/lib/chef/resource/timezone.rb +112 -73
- data/lib/chef/resource/windows_ad_join.rb +19 -12
- data/lib/chef/resource/windows_audit_policy.rb +26 -24
- data/lib/chef/resource/windows_certificate.rb +12 -10
- data/lib/chef/resource/windows_dfs_server.rb +7 -4
- data/lib/chef/resource/windows_env.rb +173 -0
- data/lib/chef/resource/windows_feature.rb +2 -0
- data/lib/chef/resource/windows_firewall_profile.rb +28 -31
- data/lib/chef/resource/windows_firewall_rule.rb +9 -11
- data/lib/chef/resource/windows_font.rb +1 -1
- data/lib/chef/resource/windows_package.rb +29 -5
- data/lib/chef/resource/windows_path.rb +38 -0
- data/lib/chef/resource/windows_printer.rb +5 -3
- data/lib/chef/resource/windows_printer_port.rb +6 -4
- data/lib/chef/resource/windows_security_policy.rb +5 -5
- data/lib/chef/resource/windows_service.rb +108 -0
- data/lib/chef/resource/windows_share.rb +18 -18
- data/lib/chef/resource/windows_task.rb +629 -28
- data/lib/chef/resource/windows_user_privilege.rb +53 -54
- data/lib/chef/resource/windows_workgroup.rb +9 -7
- data/lib/chef/resource/yum_package.rb +2 -2
- data/lib/chef/resource/yum_repository.rb +1 -1
- data/lib/chef/resource_collection/resource_set.rb +1 -5
- data/lib/chef/resource_inspector.rb +77 -75
- data/lib/chef/resource_reporter.rb +0 -2
- data/lib/chef/resources.rb +4 -1
- data/lib/chef/run_context.rb +2 -2
- data/lib/chef/run_context/cookbook_compiler.rb +1 -1
- data/lib/chef/run_lock.rb +3 -3
- data/lib/chef/search/query.rb +6 -5
- data/lib/chef/server_api.rb +0 -4
- data/lib/chef/shell.rb +31 -26
- data/lib/chef/shell/ext.rb +12 -12
- 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 +3 -3
- data/lib/chef/util/dsc/lcm_output_parser.rb +1 -3
- data/lib/chef/util/dsc/local_configuration_manager.rb +1 -1
- data/lib/chef/util/powershell/cmdlet.rb +6 -10
- 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 +1 -1
- data/lib/chef/win32/registry.rb +1 -2
- data/lib/chef/win32/security/sid.rb +1 -1
- data/lib/chef/win32/unicode.rb +1 -1
- data/spec/data/shef-config.rb +1 -1
- data/spec/functional/event_loggers/windows_eventlog_spec.rb +6 -5
- data/spec/functional/mixin/powershell_out_spec.rb +11 -3
- data/spec/functional/resource/aix_service_spec.rb +2 -2
- data/spec/functional/resource/aixinit_service_spec.rb +1 -1
- data/spec/functional/resource/apt_package_spec.rb +4 -6
- data/spec/functional/resource/chocolatey_package_spec.rb +3 -3
- data/spec/functional/resource/cron_spec.rb +3 -3
- data/spec/functional/resource/dsc_script_spec.rb +3 -3
- data/spec/functional/resource/insserv_spec.rb +1 -1
- data/spec/functional/resource/mount_spec.rb +10 -2
- data/spec/functional/resource/powershell_package_source_spec.rb +107 -0
- data/spec/functional/resource/powershell_script_spec.rb +57 -14
- 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 +10 -6
- data/spec/functional/resource/windows_firewall_rule_spec.rb +93 -0
- data/spec/functional/resource/windows_package_spec.rb +36 -10
- data/spec/functional/resource/windows_share_spec.rb +103 -0
- data/spec/functional/resource/windows_task_spec.rb +15 -16
- data/spec/functional/resource/zypper_package_spec.rb +11 -0
- data/spec/functional/version_spec.rb +3 -3
- 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/client_key_create_spec.rb +1 -1
- data/spec/integration/knife/{config_list_profiles_spec.rb → config_list_spec.rb} +30 -29
- data/spec/integration/knife/{config_get_spec.rb → config_show_spec.rb} +3 -3
- data/spec/integration/knife/{config_use_profile_spec.rb → config_use_spec.rb} +53 -10
- data/spec/integration/knife/cookbook_api_ipv6_spec.rb +1 -1
- data/spec/integration/knife/node_create_spec.rb +1 -1
- data/spec/integration/knife/node_environment_set_spec.rb +1 -1
- data/spec/integration/knife/node_run_list_add_spec.rb +4 -4
- data/spec/integration/knife/node_run_list_remove_spec.rb +1 -1
- data/spec/integration/knife/node_run_list_set_spec.rb +1 -1
- data/spec/integration/knife/node_show_spec.rb +1 -1
- data/spec/integration/ohai/ohai_spec.rb +61 -0
- data/spec/integration/recipes/notifies_spec.rb +1 -1
- data/spec/integration/recipes/provider_choice.rb +2 -2
- data/spec/integration/recipes/remote_directory.rb +1 -1
- data/spec/integration/solo/solo_spec.rb +5 -5
- data/spec/spec_helper.rb +8 -6
- data/spec/stress/win32/file_spec.rb +1 -1
- data/spec/support/chef_helpers.rb +2 -2
- data/spec/support/lib/chef/resource/cat.rb +1 -1
- data/spec/support/lib/chef/resource/one_two_three_four.rb +1 -1
- data/spec/support/matchers/leak.rb +2 -2
- data/spec/support/mock/platform.rb +24 -16
- data/spec/support/platform_helpers.rb +27 -38
- data/spec/support/shared/functional/securable_resource.rb +108 -27
- data/spec/support/shared/functional/win32_service.rb +1 -1
- data/spec/support/shared/unit/application_dot_d.rb +5 -3
- data/spec/support/shared/unit/knife_shared.rb +1 -1
- data/spec/support/shared/unit/script_resource.rb +4 -4
- data/spec/support/shared/unit/windows_script_resource.rb +1 -1
- 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/client_spec.rb +16 -0
- 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 +0 -117
- data/spec/unit/dsl/declare_resource_spec.rb +1 -1
- data/spec/unit/file_access_control_spec.rb +1 -1
- data/spec/unit/guard_interpreter/resource_guard_interpreter_spec.rb +11 -11
- data/spec/unit/knife/bootstrap_spec.rb +6 -6
- data/spec/unit/knife/client_create_spec.rb +2 -2
- data/spec/unit/knife/configure_client_spec.rb +5 -5
- data/spec/unit/knife/configure_spec.rb +3 -3
- data/spec/unit/knife/cookbook_delete_spec.rb +2 -2
- data/spec/unit/knife/cookbook_download_spec.rb +2 -2
- data/spec/unit/knife/cookbook_list_spec.rb +2 -2
- data/spec/unit/knife/cookbook_metadata_spec.rb +3 -3
- data/spec/unit/knife/core/ui_spec.rb +1 -0
- data/spec/unit/knife/environment_compare_spec.rb +3 -3
- data/spec/unit/knife/ssh_spec.rb +2 -2
- data/spec/unit/knife/supermarket_download_spec.rb +8 -8
- data/spec/unit/knife/supermarket_list_spec.rb +3 -3
- data/spec/unit/knife/supermarket_search_spec.rb +1 -1
- data/spec/unit/knife/tag_create_spec.rb +1 -1
- data/spec/unit/knife/tag_delete_spec.rb +1 -1
- data/spec/unit/knife/user_create_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 +39 -2
- data/spec/unit/mixin/powershell_out_spec.rb +14 -0
- data/spec/unit/mixin/securable_spec.rb +2 -2
- data/spec/unit/mixin/which.rb +1 -1
- data/spec/unit/node/immutable_collections_spec.rb +2 -2
- data/spec/unit/provider/group/windows_spec.rb +6 -0
- data/spec/unit/provider/group_spec.rb +1 -1
- data/spec/unit/provider/mount/linux_spec.rb +107 -0
- data/spec/unit/provider/mount/mount_spec.rb +21 -10
- data/spec/unit/provider/mount/solaris_spec.rb +1 -1
- data/spec/unit/provider/mount_spec.rb +31 -0
- data/spec/unit/provider/package/chocolatey_spec.rb +2 -3
- data/spec/unit/provider/package/powershell_spec.rb +88 -96
- data/spec/unit/provider/package/rubygems_spec.rb +4 -1
- data/spec/unit/provider/package/zypper_spec.rb +0 -25
- data/spec/unit/provider/package_spec.rb +2 -2
- data/spec/unit/provider/powershell_script_spec.rb +11 -0
- data/spec/unit/provider/route_spec.rb +0 -2
- data/spec/unit/provider/subversion_spec.rb +0 -3
- data/spec/unit/provider/user_spec.rb +7 -1
- data/spec/unit/provider/windows_env_spec.rb +18 -34
- data/spec/unit/provider/windows_path_spec.rb +6 -11
- data/spec/unit/provider/windows_task_spec.rb +7 -6
- data/spec/unit/recipe_spec.rb +1 -1
- data/spec/unit/resource/breakpoint_spec.rb +1 -1
- data/spec/unit/resource/build_essential_spec.rb +0 -12
- data/spec/unit/resource/chef_client_config_spec.rb +137 -0
- 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/ifconfig_spec.rb +2 -10
- data/spec/unit/resource/launchd_spec.rb +8 -0
- data/spec/unit/resource/mount_spec.rb +18 -5
- data/spec/unit/resource/osx_profile_spec.rb +67 -1
- data/spec/unit/resource/powershell_package_source_spec.rb +20 -20
- data/spec/unit/resource/powershell_script_spec.rb +4 -74
- data/spec/unit/resource/rhsm_register_spec.rb +56 -18
- data/spec/unit/resource/service_spec.rb +2 -2
- data/spec/unit/resource/solaris_package_spec.rb +8 -10
- data/spec/unit/resource/timezone_spec.rb +63 -0
- data/spec/unit/resource/windows_uac_spec.rb +1 -1
- data/spec/unit/resource/windows_user_privilege_spec.rb +55 -0
- data/spec/unit/resource_inspector_spec.rb +3 -3
- 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 +18 -21
- 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 +49 -27
- data/lib/chef/dist.rb +0 -68
- data/lib/chef/monkey_patches/net_http.rb +0 -22
- data/lib/chef/provider/windows_env.rb +0 -210
- data/lib/chef/provider/windows_path.rb +0 -61
- data/lib/chef/provider/windows_task.rb +0 -632
- data/spec/integration/knife/config_get_profile_spec.rb +0 -114
- data/spec/support/mock/constant.rb +0 -52
- data/spec/unit/monkey_patches/uri_spec.rb +0 -34
- data/spec/unit/provider_resolver_spec.rb +0 -885
- data/spec/unit/resource/data/InstallHistory_with_CLT.plist +0 -92
- data/spec/unit/resource/data/InstallHistory_without_CLT.plist +0 -38
@@ -15,7 +15,7 @@
|
|
15
15
|
#
|
16
16
|
|
17
17
|
require_relative "../resource"
|
18
|
-
|
18
|
+
require "chef-utils/dist" unless defined?(ChefUtils::Dist)
|
19
19
|
|
20
20
|
class Chef
|
21
21
|
class Resource
|
@@ -24,7 +24,7 @@ class Chef
|
|
24
24
|
|
25
25
|
unified_mode true
|
26
26
|
|
27
|
-
description "Use the **chef_sleep** resource to pause (sleep) for a number of seconds during a #{
|
27
|
+
description "Use the **chef_sleep** resource to pause (sleep) for a number of seconds during a #{ChefUtils::Dist::Infra::PRODUCT} run. Only use this resource when a command or service exits successfully but is not ready for the next step in a recipe."
|
28
28
|
introduced "15.5"
|
29
29
|
examples <<~DOC
|
30
30
|
**Sleep for 10 seconds**:
|
@@ -39,7 +39,7 @@ class Chef
|
|
39
39
|
chef_sleep 'wait for the service to start' do
|
40
40
|
seconds 10
|
41
41
|
end
|
42
|
-
|
42
|
+
```
|
43
43
|
|
44
44
|
**Use a notification from another resource to sleep only when necessary**:
|
45
45
|
|
@@ -21,7 +21,7 @@
|
|
21
21
|
require_relative "file"
|
22
22
|
require_relative "../provider/cookbook_file"
|
23
23
|
require_relative "../mixin/securable"
|
24
|
-
|
24
|
+
require "chef-utils/dist" unless defined?(ChefUtils::Dist)
|
25
25
|
|
26
26
|
class Chef
|
27
27
|
class Resource
|
@@ -31,7 +31,7 @@ class Chef
|
|
31
31
|
|
32
32
|
provides :cookbook_file
|
33
33
|
|
34
|
-
description "Use the **cookbook_file** resource to transfer files from a sub-directory of COOKBOOK_NAME/files/ to a specified path located on a host that is running the #{
|
34
|
+
description "Use the **cookbook_file** resource to transfer files from a sub-directory of COOKBOOK_NAME/files/ to a specified path located on a host that is running the #{ChefUtils::Dist::Infra::PRODUCT}. The file is selected according to file specificity, which allows different source files to be used based on the hostname, host platform (operating system, distro, or as appropriate), or platform version. Files that are located in the COOKBOOK_NAME/files/default sub-directory may be used on any platform.\n\nDuring a #{ChefUtils::Dist::Infra::PRODUCT} run, the checksum for each local file is calculated and then compared against the checksum for the same file as it currently exists in the cookbook on the #{ChefUtils::Dist::Server::PRODUCT}. A file is not transferred when the checksums match. Only files that require an update are transferred from the #{ChefUtils::Dist::Server::PRODUCT} to a node."
|
35
35
|
|
36
36
|
property :source, [ String, Array ],
|
37
37
|
description: "The name of the file in COOKBOOK_NAME/files/default or the path to a file located in COOKBOOK_NAME/files. The path must include the file name and its extension. This can be used to distribute specific files depending upon the platform used.",
|
@@ -18,7 +18,6 @@
|
|
18
18
|
require_relative "../../resource"
|
19
19
|
require_relative "../helpers/cron_validations"
|
20
20
|
require "shellwords" unless defined?(Shellwords)
|
21
|
-
require_relative "../../dist"
|
22
21
|
|
23
22
|
class Chef
|
24
23
|
class Resource
|
@@ -63,7 +62,7 @@ class Chef
|
|
63
62
|
hour '8'
|
64
63
|
weekday '6'
|
65
64
|
mailto 'admin@example.com'
|
66
|
-
command
|
65
|
+
command '/bin/true'
|
67
66
|
action :create
|
68
67
|
end
|
69
68
|
```
|
@@ -77,7 +76,7 @@ class Chef
|
|
77
76
|
day '*'
|
78
77
|
month '11'
|
79
78
|
weekday '1-5'
|
80
|
-
command
|
79
|
+
command '/bin/true'
|
81
80
|
action :create
|
82
81
|
end
|
83
82
|
```
|
data/lib/chef/resource/csh.rb
CHANGED
@@ -27,9 +27,9 @@ class Chef
|
|
27
27
|
|
28
28
|
description "Use the **csh** resource to execute scripts using the csh interpreter."\
|
29
29
|
" This resource may also use any of the actions and properties that are"\
|
30
|
-
" available to the execute resource. Commands that are executed with this"\
|
30
|
+
" available to the **execute** resource. Commands that are executed with this"\
|
31
31
|
" resource are (by their nature) not idempotent, as they are typically"\
|
32
|
-
" unique to the environment in which they are run. Use not_if and only_if"\
|
32
|
+
" unique to the environment in which they are run. Use `not_if` and `only_if`"\
|
33
33
|
" to guard this resource for idempotence."
|
34
34
|
|
35
35
|
def initialize(name, run_context = nil)
|
@@ -18,7 +18,7 @@
|
|
18
18
|
require_relative "package"
|
19
19
|
require_relative "../mixin/which"
|
20
20
|
require_relative "../mixin/shell_out"
|
21
|
-
|
21
|
+
require "chef-utils/dist" unless defined?(ChefUtils::Dist)
|
22
22
|
|
23
23
|
class Chef
|
24
24
|
class Resource
|
@@ -52,7 +52,7 @@ class Chef
|
|
52
52
|
|
53
53
|
# Flush the in-memory available/installed cache, this does not flush the dnf caches on disk
|
54
54
|
property :flush_cache, Hash,
|
55
|
-
description: "Flush the in-memory cache before or after a DNF operation that installs, upgrades, or removes a package. DNF automatically synchronizes remote metadata to a local cache. The #{
|
55
|
+
description: "Flush the in-memory cache before or after a DNF operation that installs, upgrades, or removes a package. DNF automatically synchronizes remote metadata to a local cache. The #{ChefUtils::Dist::Infra::CLIENT} creates a copy of the local cache, and then stores it in-memory during the #{ChefUtils::Dist::Infra::CLIENT} run. The in-memory cache allows packages to be installed during the #{ChefUtils::Dist::Infra::CLIENT} run without the need to continue synchronizing the remote metadata to the local cache while the #{ChefUtils::Dist::Infra::CLIENT} run is in-progress.",
|
56
56
|
default: { before: false, after: false },
|
57
57
|
coerce: proc { |v|
|
58
58
|
if v.is_a?(Hash)
|
@@ -19,7 +19,7 @@
|
|
19
19
|
require_relative "../resource"
|
20
20
|
require_relative "../exceptions"
|
21
21
|
require_relative "../dsl/powershell"
|
22
|
-
|
22
|
+
require "chef-utils/dist" unless defined?(ChefUtils::Dist)
|
23
23
|
|
24
24
|
class Chef
|
25
25
|
class Resource
|
@@ -29,7 +29,7 @@ class Chef
|
|
29
29
|
unified_mode true
|
30
30
|
provides :dsc_script
|
31
31
|
|
32
|
-
description "Many DSC resources are comparable to built-in #{
|
32
|
+
description "Many DSC resources are comparable to built-in #{ChefUtils::Dist::Infra::PRODUCT} resources. For example, both DSC and #{ChefUtils::Dist::Infra::PRODUCT} have file, package, and service resources. The dsc_script resource is most useful for those DSC resources that do not have a direct comparison to a resource in #{ChefUtils::Dist::Infra::PRODUCT}, such as the Archive resource, a custom DSC resource, an existing DSC script that performs an important task, and so on. Use the dsc_script resource to embed the code that defines a DSC configuration directly within a #{ChefUtils::Dist::Infra::PRODUCT} recipe."
|
33
33
|
|
34
34
|
default_action :run
|
35
35
|
|
@@ -18,7 +18,7 @@
|
|
18
18
|
#
|
19
19
|
|
20
20
|
require_relative "../resource"
|
21
|
-
|
21
|
+
require "chef-utils/dist" unless defined?(ChefUtils::Dist)
|
22
22
|
|
23
23
|
class Chef
|
24
24
|
class Resource
|
@@ -27,7 +27,7 @@ class Chef
|
|
27
27
|
|
28
28
|
provides :execute, target_mode: true
|
29
29
|
|
30
|
-
description "Use the **execute** resource to execute a single command. Commands that are executed with this resource are (by their nature) not idempotent, as they are typically unique to the environment in which they are run. Use not_if and only_if to guard this resource for idempotence. Note: Use the **script** resource to execute a script using a specific interpreter (Ruby, Python, Perl, csh, or Bash)."
|
30
|
+
description "Use the **execute** resource to execute a single command. Commands that are executed with this resource are (by their nature) not idempotent, as they are typically unique to the environment in which they are run. Use `not_if` and `only_if` to guard this resource for idempotence. Note: Use the **script** resource to execute a script using a specific interpreter (Ruby, Python, Perl, csh, or Bash)."
|
31
31
|
|
32
32
|
examples <<~EXAMPLES
|
33
33
|
**Run a command upon notification**:
|
@@ -533,7 +533,7 @@ class Chef
|
|
533
533
|
description: "The group name or group ID that must be changed before running a command."
|
534
534
|
|
535
535
|
property :live_stream, [ TrueClass, FalseClass ], default: false,
|
536
|
-
description: "Send the output of the command run by this execute resource block to the #{
|
536
|
+
description: "Send the output of the command run by this execute resource block to the #{ChefUtils::Dist::Infra::PRODUCT} event stream."
|
537
537
|
|
538
538
|
# default_env defaults to `false` so that the command execution more exactly matches what the user gets on the command line without magic
|
539
539
|
property :default_env, [ TrueClass, FalseClass ], desired_state: false, default: false,
|
@@ -549,11 +549,11 @@ class Chef
|
|
549
549
|
desired_state: false
|
550
550
|
|
551
551
|
property :user, [ String, Integer ],
|
552
|
-
description: "The user name of the user identity with which to launch the new process. The user name may optionally be specified with a domain, i.e. domainuser or user@my.dns.domain.com via Universal Principal Name (UPN)format. It can also be specified without a domain simply as user if the domain is instead specified using the domain property. On Windows only, if this property is specified, the password property must be specified."
|
552
|
+
description: "The user name of the user identity with which to launch the new process. The user name may optionally be specified with a domain, i.e. `domainuser` or `user@my.dns.domain.com` via Universal Principal Name (UPN)format. It can also be specified without a domain simply as user if the domain is instead specified using the domain property. On Windows only, if this property is specified, the password property must be specified."
|
553
553
|
|
554
554
|
property :domain, String,
|
555
555
|
introduced: "12.21",
|
556
|
-
description: "Windows only: The domain of the user user specified by the user property. If not specified, the
|
556
|
+
description: "Windows only: The domain of the user user specified by the user property. If not specified, the username and password specified by the `user` and `password` properties will be used to resolve that user against the domain in which the system running #{ChefUtils::Dist::Infra::PRODUCT} is joined, or if that system is not joined to a domain it will resolve the user as a local account on that system. An alternative way to specify the domain is to leave this property unspecified and specify the domain as part of the user property."
|
557
557
|
|
558
558
|
property :password, String, sensitive: true,
|
559
559
|
introduced: "12.21",
|
@@ -561,11 +561,11 @@ class Chef
|
|
561
561
|
|
562
562
|
# lazy used to set default value of sensitive to true if password is set
|
563
563
|
property :sensitive, [ TrueClass, FalseClass ],
|
564
|
-
description: "Ensure that sensitive resource data is not logged by the #{
|
564
|
+
description: "Ensure that sensitive resource data is not logged by the #{ChefUtils::Dist::Infra::PRODUCT}.",
|
565
565
|
default: lazy { password ? true : false }, default_description: "True if the password property is set. False otherwise."
|
566
566
|
|
567
567
|
property :elevated, [ TrueClass, FalseClass ], default: false,
|
568
|
-
description: "Determines whether the script will run with elevated permissions to circumvent User Access Control (UAC) interactively blocking the process.\nThis will cause the process to be run under a batch login instead of an interactive login. The user running #{
|
568
|
+
description: "Determines whether the script will run with elevated permissions to circumvent User Access Control (UAC) from interactively blocking the process.\nThis will cause the process to be run under a batch login instead of an interactive login. The user running #{ChefUtils::Dist::Infra::CLIENT} needs the 'Replace a process level token' and 'Adjust Memory Quotas for a process' permissions. The user that is running the command needs the 'Log on as a batch job' permission.\nBecause this requires a login, the user and password properties are required.",
|
569
569
|
introduced: "13.3"
|
570
570
|
|
571
571
|
property :input, [String],
|
@@ -587,7 +587,7 @@ class Chef
|
|
587
587
|
ancestor_attributes = superclass.guard_inherited_attributes
|
588
588
|
end
|
589
589
|
|
590
|
-
ancestor_attributes.concat(@class_inherited_attributes
|
590
|
+
ancestor_attributes.concat(@class_inherited_attributes || []).uniq
|
591
591
|
end
|
592
592
|
|
593
593
|
# post resource creation validation
|
@@ -661,8 +661,10 @@ class Chef
|
|
661
661
|
|
662
662
|
set_guard_inherited_attributes(
|
663
663
|
:cwd,
|
664
|
+
:domain,
|
664
665
|
:environment,
|
665
666
|
:group,
|
667
|
+
:password,
|
666
668
|
:user,
|
667
669
|
:umask
|
668
670
|
)
|
data/lib/chef/resource/file.rb
CHANGED
@@ -22,7 +22,7 @@ require_relative "../platform/query_helpers"
|
|
22
22
|
require_relative "../mixin/securable"
|
23
23
|
require_relative "file/verification"
|
24
24
|
require "pathname" unless defined?(Pathname)
|
25
|
-
|
25
|
+
require "chef-utils" unless defined?(ChefUtils::CANARY)
|
26
26
|
|
27
27
|
class Chef
|
28
28
|
class Resource
|
@@ -56,7 +56,7 @@ class Chef
|
|
56
56
|
allowed_actions :create, :delete, :touch, :create_if_missing
|
57
57
|
|
58
58
|
property :path, String, name_property: true,
|
59
|
-
description: "The full path to the file, including the file name and its extension. For example: /files/file.txt. Default value: the name of the resource block. Microsoft Windows: A path that begins with a forward slash
|
59
|
+
description: "The full path to the file, including the file name and its extension. For example: /files/file.txt. Default value: the name of the resource block. Microsoft Windows: A path that begins with a forward slash `/` will point to the root of the current working directory of the #{ChefUtils::Dist::Infra::PRODUCT} process. This path can vary from system to system. Therefore, using a path that begins with a forward slash `/` is not recommended."
|
60
60
|
|
61
61
|
property :atomic_update, [ TrueClass, FalseClass ], desired_state: false, default: lazy { docker? && special_docker_files?(path) ? false : Chef::Config[:file_atomic_update] },
|
62
62
|
default_description: "False if modifying /etc/hosts, /etc/hostname, or /etc/resolv.conf within Docker containers. Otherwise default to the client.rb 'file_atomic_update' config value.",
|
@@ -76,10 +76,10 @@ class Chef
|
|
76
76
|
property :diff, [ String, nil ], desired_state: false, skip_docs: true
|
77
77
|
|
78
78
|
property :force_unlink, [ TrueClass, FalseClass ], desired_state: false, default: false,
|
79
|
-
description: "How #{
|
79
|
+
description: "How #{ChefUtils::Dist::Infra::PRODUCT} handles certain situations when the target file turns out not to be a file. For example, when a target file is actually a symlink. Set to `true` for #{ChefUtils::Dist::Infra::PRODUCT} to delete the non-file target and replace it with the specified file. Set to `false` for #{ChefUtils::Dist::Infra::PRODUCT} to raise an error."
|
80
80
|
|
81
81
|
property :manage_symlink_source, [ TrueClass, FalseClass ], desired_state: false,
|
82
|
-
description: "Change the behavior of the file resource if it is pointed at a symlink. When this value is set to true, #{
|
82
|
+
description: "Change the behavior of the file resource if it is pointed at a symlink. When this value is set to true, #{ChefUtils::Dist::Infra::PRODUCT} will manage the symlink's permissions or will replace the symlink with a normal file if the resource has content. When this value is set to false, #{ChefUtils::Dist::Infra::PRODUCT} will follow the symlink and will manage the permissions and content of symlink's target file. The default behavior is true but emits a warning that the default value will be changed to false in a future version; setting this explicitly to true or false suppresses this warning."
|
83
83
|
|
84
84
|
property :verifications, Array, default: lazy { [] }
|
85
85
|
|
@@ -17,7 +17,7 @@
|
|
17
17
|
#
|
18
18
|
|
19
19
|
require_relative "package"
|
20
|
-
|
20
|
+
require "chef-utils/dist" unless defined?(ChefUtils::Dist)
|
21
21
|
|
22
22
|
class Chef
|
23
23
|
class Resource
|
@@ -31,10 +31,10 @@ class Chef
|
|
31
31
|
|
32
32
|
Note: The **gem_package** resource must be specified as `gem_package` and cannot be shortened to `package` in a recipe.
|
33
33
|
|
34
|
-
Warning: The **chef_gem** and **gem_package** resources are both used to install Ruby gems. For any machine on which #{
|
34
|
+
Warning: The **chef_gem** and **gem_package** resources are both used to install Ruby gems. For any machine on which #{ChefUtils::Dist::Infra::PRODUCT} is
|
35
35
|
installed, there are two instances of Ruby. One is the standard, system-wide instance of Ruby and the other is a dedicated instance that is
|
36
|
-
available only to #{
|
37
|
-
Use the **chef_gem** resource to install gems into the instance of Ruby that is dedicated to #{
|
36
|
+
available only to #{ChefUtils::Dist::Infra::PRODUCT}.
|
37
|
+
Use the **chef_gem** resource to install gems into the instance of Ruby that is dedicated to #{ChefUtils::Dist::Infra::PRODUCT}.
|
38
38
|
Use the **gem_package** resource to install all other gems (i.e. install gems system-wide).
|
39
39
|
DESC
|
40
40
|
|
@@ -86,7 +86,7 @@ class Chef
|
|
86
86
|
default: lazy { Chef::Config[:clear_gem_sources] }, desired_state: false
|
87
87
|
|
88
88
|
property :gem_binary, String, desired_state: false,
|
89
|
-
description: "The path of a gem binary to use for the installation. By default, the same version of Ruby that is used by #{
|
89
|
+
description: "The path of a gem binary to use for the installation. By default, the same version of Ruby that is used by #{ChefUtils::Dist::Infra::PRODUCT} will be used."
|
90
90
|
|
91
91
|
property :include_default_source, [ TrueClass, FalseClass, nil ],
|
92
92
|
description: "Set to `false` to not include `Chef::Config[:rubygems_url]` in the sources.",
|
@@ -19,7 +19,7 @@
|
|
19
19
|
|
20
20
|
require_relative "../provider/package"
|
21
21
|
require_relative "package"
|
22
|
-
|
22
|
+
require "chef-utils/dist" unless defined?(ChefUtils::Dist)
|
23
23
|
|
24
24
|
class Chef
|
25
25
|
class Resource
|
@@ -29,7 +29,7 @@ class Chef
|
|
29
29
|
provides :homebrew_package
|
30
30
|
provides :package, os: "darwin"
|
31
31
|
|
32
|
-
description "Use the **homebrew_package** resource to manage packages for the macOS platform. Note: Starting with #{
|
32
|
+
description "Use the **homebrew_package** resource to manage packages for the macOS platform. Note: Starting with #{ChefUtils::Dist::Infra::PRODUCT} 16 the homebrew resource now accepts an array of packages for installing multiple packages at once."
|
33
33
|
introduced "12.0"
|
34
34
|
examples <<~DOC
|
35
35
|
**Install a package**:
|
@@ -62,7 +62,7 @@ class Chef
|
|
62
62
|
DOC
|
63
63
|
|
64
64
|
property :homebrew_user, [ String, Integer ],
|
65
|
-
description: "The name or uid of the Homebrew owner to be used by #{
|
65
|
+
description: "The name or uid of the Homebrew owner to be used by #{ChefUtils::Dist::Infra::PRODUCT} when executing a command."
|
66
66
|
|
67
67
|
end
|
68
68
|
end
|
@@ -19,11 +19,14 @@
|
|
19
19
|
#
|
20
20
|
|
21
21
|
require_relative "../resource"
|
22
|
-
require_relative "../
|
22
|
+
require_relative "../mixin/homebrew_user"
|
23
|
+
require "chef-utils/dist" unless defined?(ChefUtils::Dist)
|
23
24
|
|
24
25
|
class Chef
|
25
26
|
class Resource
|
26
27
|
class HomebrewUpdate < Chef::Resource
|
28
|
+
include Chef::Mixin::HomebrewUser
|
29
|
+
|
27
30
|
unified_mode true
|
28
31
|
|
29
32
|
provides(:homebrew_update) { true }
|
@@ -38,7 +41,7 @@ class Chef
|
|
38
41
|
action :periodic
|
39
42
|
end
|
40
43
|
```
|
41
|
-
**Update the Homebrew repository at the start of a #{
|
44
|
+
**Update the Homebrew repository at the start of a #{ChefUtils::Dist::Infra::PRODUCT} run**:
|
42
45
|
```ruby
|
43
46
|
homebrew_update 'update'
|
44
47
|
```
|
@@ -62,8 +65,8 @@ class Chef
|
|
62
65
|
#
|
63
66
|
# @return [Boolean]
|
64
67
|
def brew_up_to_date?
|
65
|
-
::File.exist?(
|
66
|
-
::File.mtime(
|
68
|
+
::File.exist?(BREW_STAMP) &&
|
69
|
+
::File.mtime(BREW_STAMP) > Time.now - new_resource.frequency
|
67
70
|
end
|
68
71
|
|
69
72
|
def do_update
|
@@ -71,7 +74,7 @@ class Chef
|
|
71
74
|
recursive true
|
72
75
|
end
|
73
76
|
|
74
|
-
file
|
77
|
+
file BREW_STAMP do
|
75
78
|
content "BREW::Update::Post-Invoke-Success\n"
|
76
79
|
action :create_if_missing
|
77
80
|
end
|
@@ -79,7 +82,7 @@ class Chef
|
|
79
82
|
execute "brew update" do
|
80
83
|
command %w{brew update}
|
81
84
|
default_env true
|
82
|
-
user
|
85
|
+
user find_homebrew_uid
|
83
86
|
notifies :touch, "file[#{BREW_STAMP}]", :immediately
|
84
87
|
end
|
85
88
|
end
|
@@ -16,7 +16,7 @@
|
|
16
16
|
#
|
17
17
|
|
18
18
|
require_relative "../resource"
|
19
|
-
|
19
|
+
require "chef-utils/dist" unless defined?(ChefUtils::Dist)
|
20
20
|
|
21
21
|
class Chef
|
22
22
|
class Resource
|
@@ -224,7 +224,7 @@ class Chef
|
|
224
224
|
else # windows
|
225
225
|
WINDOWS_EC2_CONFIG = 'C:\Program Files\Amazon\Ec2ConfigService\Settings\config.xml'.freeze
|
226
226
|
|
227
|
-
raise "Windows hostnames cannot contain a period." if new_resource.hostname.
|
227
|
+
raise "Windows hostnames cannot contain a period." if new_resource.hostname.include?(".")
|
228
228
|
|
229
229
|
# suppress EC2 config service from setting our hostname
|
230
230
|
if ::File.exist?(WINDOWS_EC2_CONFIG)
|
@@ -240,7 +240,7 @@ class Chef
|
|
240
240
|
|
241
241
|
unless Socket.gethostbyname(Socket.gethostname).first == new_resource.hostname
|
242
242
|
converge_by "set hostname to #{new_resource.hostname}" do
|
243
|
-
|
243
|
+
powershell_exec! <<~EOH
|
244
244
|
$sysInfo = Get-WmiObject -Class Win32_ComputerSystem
|
245
245
|
$sysInfo.Rename("#{new_resource.hostname}")
|
246
246
|
EOH
|
@@ -248,7 +248,7 @@ class Chef
|
|
248
248
|
|
249
249
|
# reboot because $windows
|
250
250
|
reboot "setting hostname" do
|
251
|
-
reason "#{
|
251
|
+
reason "#{ChefUtils::Dist::Infra::PRODUCT} updated system hostname"
|
252
252
|
only_if { new_resource.windows_reboot }
|
253
253
|
action :request_reboot
|
254
254
|
end
|
@@ -21,16 +21,59 @@ require_relative "../resource"
|
|
21
21
|
|
22
22
|
class Chef
|
23
23
|
class Resource
|
24
|
-
# @example set a static ip on eth1
|
25
|
-
# ifconfig '33.33.33.80' do
|
26
|
-
# device 'eth1'
|
27
|
-
# end
|
28
24
|
class Ifconfig < Chef::Resource
|
29
25
|
unified_mode true
|
30
26
|
|
31
27
|
provides :ifconfig
|
32
28
|
|
33
|
-
description "Use the **ifconfig** resource to manage interfaces on Unix and Linux systems."
|
29
|
+
description "Use the **ifconfig** resource to manage interfaces on Unix and Linux systems. Note: This resource requires the ifconfig binary to be present on the system and may require additional packages to be installed first. On Ubuntu 18.04 or later you will need to install the `ifupdown` package, which disables the built in Netplan functionality. Warning: This resource will not work with Fedora release 33 or later."
|
30
|
+
examples <<~DOC
|
31
|
+
**Configure a network interface with a static IP**
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
ifconfig '33.33.33.80' do
|
35
|
+
device 'eth1'
|
36
|
+
end
|
37
|
+
```
|
38
|
+
|
39
|
+
will create the following interface configuration:
|
40
|
+
|
41
|
+
```
|
42
|
+
iface eth1 inet static
|
43
|
+
address 33.33.33.80
|
44
|
+
```
|
45
|
+
|
46
|
+
**Configure an interface to use DHCP**
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
ifconfig 'Set eth1 to DHCP' do
|
50
|
+
device 'eth1'
|
51
|
+
bootproto 'dhcp'
|
52
|
+
end
|
53
|
+
```
|
54
|
+
|
55
|
+
will create the following interface configuration:
|
56
|
+
|
57
|
+
```
|
58
|
+
iface eth1 inet dhcp
|
59
|
+
```
|
60
|
+
|
61
|
+
**Update a static IP address with a boot protocol**
|
62
|
+
|
63
|
+
```ruby
|
64
|
+
ifconfig "33.33.33.80" do
|
65
|
+
bootproto "dhcp"
|
66
|
+
device "eth1"
|
67
|
+
end
|
68
|
+
```
|
69
|
+
|
70
|
+
will update the interface configuration from static to dhcp:
|
71
|
+
|
72
|
+
```
|
73
|
+
iface eth1 inet dhcp
|
74
|
+
address 33.33.33.80
|
75
|
+
```
|
76
|
+
DOC
|
34
77
|
|
35
78
|
state_attrs :inet_addr, :mask
|
36
79
|
|
@@ -102,6 +145,10 @@ class Chef
|
|
102
145
|
property :gateway, String,
|
103
146
|
introduced: "14.4",
|
104
147
|
description: "The gateway to use for the interface."
|
148
|
+
|
149
|
+
property :bridge, String,
|
150
|
+
introduced: "16.7",
|
151
|
+
description: "The bridge interface this interface is a member of on Red Hat based systems."
|
105
152
|
end
|
106
153
|
end
|
107
154
|
end
|