chef 17.10.163 → 18.7.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +25 -21
- data/README.md +7 -7
- data/Rakefile +3 -22
- data/{chef-universal-mingw32.gemspec → chef-universal-mingw-ucrt.gemspec} +7 -6
- data/chef.gemspec +33 -27
- data/lib/chef/api_client_v1.rb +9 -1
- data/lib/chef/application/base.rb +20 -2
- data/lib/chef/application/exit_code.rb +3 -3
- data/lib/chef/chef_fs/file_pattern.rb +1 -1
- data/lib/chef/chef_fs/file_system.rb +21 -7
- data/lib/chef/chef_fs/path_utils.rb +7 -9
- data/lib/chef/client.rb +186 -2
- data/lib/chef/compliance/default_attributes.rb +2 -2
- data/lib/chef/compliance/input.rb +1 -1
- data/lib/chef/compliance/profile.rb +1 -1
- data/lib/chef/compliance/profile_collection.rb +0 -1
- data/lib/chef/compliance/runner.rb +6 -1
- data/lib/chef/compliance/waiver.rb +1 -1
- data/lib/chef/cookbook/chefignore.rb +4 -1
- data/lib/chef/cookbook/cookbook_version_loader.rb +1 -1
- data/lib/chef/cookbook/metadata.rb +1 -1
- data/lib/chef/cookbook/remote_file_vendor.rb +1 -3
- data/lib/chef/cookbook/synchronizer.rb +21 -3
- data/lib/chef/cookbook/syntax_check.rb +2 -2
- data/lib/chef/cookbook_manifest.rb +2 -2
- data/lib/chef/cookbook_version.rb +1 -1
- data/lib/chef/data_collector.rb +14 -0
- data/lib/chef/delayed_evaluator.rb +4 -0
- data/lib/chef/dsl/reader_helpers.rb +1 -1
- data/lib/chef/dsl/rest_resource.rb +77 -0
- data/lib/chef/event_dispatch/base.rb +3 -0
- data/lib/chef/event_dispatch/dispatcher.rb +0 -1
- data/lib/chef/exceptions.rb +9 -1
- data/lib/chef/file_access_control/windows.rb +4 -1
- data/lib/chef/file_cache.rb +17 -2
- data/lib/chef/formatters/doc.rb +1 -1
- data/lib/chef/guard_interpreter/resource_guard_interpreter.rb +2 -0
- data/lib/chef/http/authenticator.rb +253 -3
- data/lib/chef/http/ssl_policies.rb +2 -2
- data/lib/chef/mixin/{homebrew_user.rb → homebrew.rb} +13 -16
- data/lib/chef/mixin/openssl_helper.rb +1 -16
- data/lib/chef/mixin/powershell_exec.rb +5 -28
- data/lib/chef/monkey_patches/net-http.rb +127 -0
- data/lib/chef/node/attribute.rb +3 -11
- data/lib/chef/node/attribute_collections.rb +10 -1
- data/lib/chef/node/immutable_collections.rb +17 -6
- data/lib/chef/node/mixin/immutablize_array.rb +1 -0
- data/lib/chef/node/mixin/state_tracking.rb +7 -4
- data/lib/chef/node/mixin/state_tracking_array.rb +41 -0
- data/lib/chef/node.rb +23 -1
- data/lib/chef/platform/query_helpers.rb +4 -2
- data/lib/chef/policy_builder/policyfile.rb +8 -0
- data/lib/chef/property.rb +13 -6
- data/lib/chef/provider/group/windows.rb +1 -1
- data/lib/chef/provider/http_request.rb +11 -9
- data/lib/chef/provider/launchd.rb +2 -1
- data/lib/chef/provider/mount/linux.rb +6 -1
- data/lib/chef/provider/mount/mount.rb +13 -5
- data/lib/chef/provider/mount/windows.rb +1 -1
- data/lib/chef/provider/package/apt.rb +11 -2
- data/lib/chef/provider/package/chocolatey.rb +260 -22
- data/lib/chef/provider/package/dnf/dnf_helper.py +7 -0
- data/lib/chef/provider/package/homebrew.rb +6 -9
- data/lib/chef/provider/package/powershell.rb +1 -0
- data/lib/chef/provider/package/rubygems.rb +5 -1
- data/lib/chef/provider/package/snap.rb +3 -2
- data/lib/chef/provider/package/windows/msi.rb +2 -2
- data/lib/chef/provider/package/windows/registry_uninstall_entry.rb +1 -1
- data/lib/chef/provider/package/yum/yum_helper.py +3 -3
- data/lib/chef/provider/package/zypper/version.rb +60 -0
- data/lib/chef/provider/package/zypper.rb +47 -3
- data/lib/chef/provider/powershell_script.rb +96 -6
- data/lib/chef/provider/registry_key.rb +2 -0
- data/lib/chef/provider/remote_file/http.rb +1 -1
- data/lib/chef/provider/service/systemd.rb +23 -8
- data/lib/chef/provider/service/windows.rb +1 -1
- data/lib/chef/provider/service.rb +14 -0
- data/lib/chef/provider/user/aix.rb +5 -0
- data/lib/chef/provider/user/linux.rb +29 -0
- data/lib/chef/provider/user/mac.rb +1 -1
- data/lib/chef/provider/user/windows.rb +5 -0
- data/lib/chef/provider/user.rb +45 -9
- data/lib/chef/provider/yum_repository.rb +13 -1
- data/lib/chef/provider.rb +1 -1
- data/lib/chef/recipe.rb +4 -12
- data/lib/chef/resource/_rest_resource.rb +389 -0
- data/lib/chef/resource/alternatives.rb +0 -1
- data/lib/chef/resource/apt_package.rb +21 -1
- data/lib/chef/resource/apt_preference.rb +0 -1
- data/lib/chef/resource/apt_repository.rb +138 -18
- data/lib/chef/resource/apt_update.rb +0 -1
- data/lib/chef/resource/archive_file.rb +0 -1
- data/lib/chef/resource/bash.rb +13 -1
- data/lib/chef/resource/batch.rb +0 -1
- data/lib/chef/resource/bff_package.rb +0 -1
- data/lib/chef/resource/breakpoint.rb +0 -1
- data/lib/chef/resource/build_essential.rb +0 -1
- data/lib/chef/resource/cab_package.rb +0 -1
- data/lib/chef/resource/chef_client_config.rb +12 -14
- data/lib/chef/resource/chef_client_cron.rb +1 -2
- data/lib/chef/resource/chef_client_launchd.rb +2 -2
- data/lib/chef/resource/chef_client_scheduled_task.rb +3 -3
- data/lib/chef/resource/chef_client_systemd_timer.rb +5 -1
- data/lib/chef/resource/chef_client_trusted_certificate.rb +0 -1
- data/lib/chef/resource/chef_gem.rb +1 -2
- data/lib/chef/resource/chef_handler.rb +0 -1
- data/lib/chef/resource/chef_sleep.rb +1 -3
- data/lib/chef/resource/chef_vault_secret.rb +0 -1
- data/lib/chef/resource/chocolatey_config.rb +0 -1
- data/lib/chef/resource/chocolatey_feature.rb +0 -1
- data/lib/chef/resource/chocolatey_installer.rb +207 -0
- data/lib/chef/resource/chocolatey_package.rb +8 -1
- data/lib/chef/resource/chocolatey_source.rb +0 -1
- data/lib/chef/resource/cookbook_file.rb +0 -1
- data/lib/chef/resource/cron/_cron_shared.rb +0 -1
- data/lib/chef/resource/cron/cron.rb +0 -1
- data/lib/chef/resource/cron/cron_d.rb +15 -1
- data/lib/chef/resource/cron_access.rb +0 -1
- data/lib/chef/resource/csh.rb +0 -1
- data/lib/chef/resource/directory.rb +0 -1
- data/lib/chef/resource/dmg_package.rb +2 -1
- data/lib/chef/resource/dnf_package.rb +0 -1
- data/lib/chef/resource/dpkg_package.rb +0 -1
- data/lib/chef/resource/dsc_resource.rb +0 -1
- data/lib/chef/resource/dsc_script.rb +1 -2
- data/lib/chef/resource/execute.rb +8 -7
- data/lib/chef/resource/file.rb +0 -1
- data/lib/chef/resource/freebsd_package.rb +2 -1
- data/lib/chef/resource/gem_package.rb +2 -1
- data/lib/chef/resource/group.rb +25 -2
- data/lib/chef/resource/habitat/habitat_package.rb +0 -1
- data/lib/chef/resource/habitat/habitat_sup.rb +6 -7
- data/lib/chef/resource/habitat/habitat_sup_windows.rb +1 -1
- data/lib/chef/resource/habitat_config.rb +0 -1
- data/lib/chef/resource/habitat_install.rb +2 -2
- data/lib/chef/resource/habitat_service.rb +0 -1
- data/lib/chef/resource/habitat_user_toml.rb +0 -1
- data/lib/chef/resource/homebrew_cask.rb +21 -33
- data/lib/chef/resource/homebrew_package.rb +3 -2
- data/lib/chef/resource/homebrew_tap.rb +32 -18
- data/lib/chef/resource/homebrew_update.rb +4 -6
- data/lib/chef/resource/hostname.rb +0 -1
- data/lib/chef/resource/http_request.rb +0 -1
- data/lib/chef/resource/ifconfig.rb +0 -1
- data/lib/chef/resource/inspec_input.rb +0 -1
- data/lib/chef/resource/inspec_waiver.rb +0 -1
- data/lib/chef/resource/inspec_waiver_file_entry.rb +2 -3
- data/lib/chef/resource/ips_package.rb +0 -1
- data/lib/chef/resource/kernel_module.rb +0 -1
- data/lib/chef/resource/ksh.rb +0 -1
- data/lib/chef/resource/launchd.rb +9 -3
- data/lib/chef/resource/link.rb +0 -1
- data/lib/chef/resource/locale.rb +0 -1
- data/lib/chef/resource/log.rb +0 -1
- data/lib/chef/resource/lwrp_base.rb +0 -4
- data/lib/chef/resource/macos_pkg.rb +111 -0
- data/lib/chef/resource/macos_userdefaults.rb +3 -4
- data/lib/chef/resource/macosx_service.rb +0 -1
- data/lib/chef/resource/macports_package.rb +2 -1
- data/lib/chef/resource/mdadm.rb +0 -1
- data/lib/chef/resource/mount.rb +0 -1
- data/lib/chef/resource/msu_package.rb +0 -1
- data/lib/chef/resource/notify_group.rb +0 -2
- data/lib/chef/resource/ohai.rb +0 -1
- data/lib/chef/resource/ohai_hint.rb +0 -1
- data/lib/chef/resource/openbsd_package.rb +2 -1
- data/lib/chef/resource/openssl_dhparam.rb +0 -2
- data/lib/chef/resource/openssl_ec_private_key.rb +0 -2
- data/lib/chef/resource/openssl_ec_public_key.rb +0 -2
- data/lib/chef/resource/openssl_rsa_private_key.rb +0 -2
- data/lib/chef/resource/openssl_rsa_public_key.rb +0 -2
- data/lib/chef/resource/openssl_x509_certificate.rb +0 -2
- data/lib/chef/resource/openssl_x509_crl.rb +0 -2
- data/lib/chef/resource/openssl_x509_request.rb +0 -2
- data/lib/chef/resource/osx_profile.rb +0 -1
- data/lib/chef/resource/package.rb +0 -1
- data/lib/chef/resource/pacman_package.rb +2 -1
- data/lib/chef/resource/paludis_package.rb +0 -1
- data/lib/chef/resource/perl.rb +0 -1
- data/lib/chef/resource/plist.rb +7 -3
- data/lib/chef/resource/portage_package.rb +2 -1
- data/lib/chef/resource/powershell_package.rb +4 -1
- data/lib/chef/resource/powershell_package_source.rb +0 -1
- data/lib/chef/resource/powershell_script.rb +5 -2
- data/lib/chef/resource/python.rb +0 -1
- data/lib/chef/resource/reboot.rb +0 -1
- data/lib/chef/resource/registry_key.rb +6 -1
- data/lib/chef/resource/remote_directory.rb +0 -1
- data/lib/chef/resource/remote_file.rb +0 -1
- data/lib/chef/resource/rhsm_errata.rb +0 -1
- data/lib/chef/resource/rhsm_errata_level.rb +0 -1
- data/lib/chef/resource/rhsm_register.rb +2 -4
- data/lib/chef/resource/rhsm_repo.rb +0 -1
- data/lib/chef/resource/rhsm_subscription.rb +0 -1
- data/lib/chef/resource/route.rb +0 -1
- data/lib/chef/resource/rpm_package.rb +2 -1
- data/lib/chef/resource/ruby.rb +0 -1
- data/lib/chef/resource/ruby_block.rb +0 -1
- data/lib/chef/resource/scm/_scm.rb +0 -2
- data/lib/chef/resource/scm/git.rb +0 -2
- data/lib/chef/resource/scm/subversion.rb +0 -2
- data/lib/chef/resource/script.rb +0 -1
- data/lib/chef/resource/selinux/common_helpers.rb +47 -0
- data/lib/chef/resource/selinux/selinux_debian.erb +18 -0
- data/lib/chef/resource/selinux/selinux_default.erb +15 -0
- data/lib/chef/resource/selinux_boolean.rb +101 -0
- data/lib/chef/resource/selinux_fcontext.rb +160 -0
- data/lib/chef/resource/selinux_install.rb +107 -0
- data/lib/chef/resource/selinux_login.rb +129 -0
- data/lib/chef/resource/selinux_module.rb +143 -0
- data/lib/chef/resource/selinux_permissive.rb +64 -0
- data/lib/chef/resource/selinux_port.rb +118 -0
- data/lib/chef/resource/selinux_state.rb +166 -0
- data/lib/chef/resource/selinux_user.rb +137 -0
- data/lib/chef/resource/service.rb +4 -2
- data/lib/chef/resource/smartos_package.rb +2 -1
- data/lib/chef/resource/snap_package.rb +25 -1
- data/lib/chef/resource/solaris_package.rb +2 -1
- data/lib/chef/resource/ssh_known_hosts_entry.rb +0 -1
- data/lib/chef/resource/sudo.rb +37 -3
- data/lib/chef/resource/support/client.erb +2 -2
- data/lib/chef/resource/support/ulimit.erb +40 -0
- data/lib/chef/resource/swap_file.rb +0 -1
- data/lib/chef/resource/sysctl.rb +2 -2
- data/lib/chef/resource/systemd_unit.rb +0 -1
- data/lib/chef/resource/template.rb +0 -1
- data/lib/chef/resource/timezone.rb +0 -1
- data/lib/chef/resource/user/aix_user.rb +0 -1
- data/lib/chef/resource/user/linux_user.rb +0 -1
- data/lib/chef/resource/user/mac_user.rb +0 -1
- data/lib/chef/resource/user/pw_user.rb +0 -1
- data/lib/chef/resource/user/solaris_user.rb +0 -1
- data/lib/chef/resource/user/windows_user.rb +0 -1
- data/lib/chef/resource/user.rb +10 -1
- data/lib/chef/resource/user_ulimit.rb +38 -1
- data/lib/chef/resource/whyrun_safe_ruby_block.rb +0 -1
- data/lib/chef/resource/windows_ad_join.rb +0 -2
- data/lib/chef/resource/windows_audit_policy.rb +0 -2
- data/lib/chef/resource/windows_auto_run.rb +0 -1
- data/lib/chef/resource/windows_certificate.rb +1 -1
- data/lib/chef/resource/windows_defender.rb +0 -1
- data/lib/chef/resource/windows_defender_exclusion.rb +0 -1
- data/lib/chef/resource/windows_dfs_folder.rb +0 -1
- data/lib/chef/resource/windows_dfs_namespace.rb +0 -1
- data/lib/chef/resource/windows_dfs_server.rb +0 -1
- data/lib/chef/resource/windows_dns_record.rb +0 -1
- data/lib/chef/resource/windows_dns_zone.rb +0 -1
- data/lib/chef/resource/windows_env.rb +0 -1
- data/lib/chef/resource/windows_feature.rb +0 -1
- data/lib/chef/resource/windows_feature_dism.rb +0 -1
- data/lib/chef/resource/windows_feature_powershell.rb +0 -1
- data/lib/chef/resource/windows_firewall_profile.rb +0 -2
- data/lib/chef/resource/windows_firewall_rule.rb +0 -1
- data/lib/chef/resource/windows_font.rb +2 -3
- data/lib/chef/resource/windows_package.rb +3 -4
- data/lib/chef/resource/windows_pagefile.rb +0 -2
- data/lib/chef/resource/windows_path.rb +0 -1
- data/lib/chef/resource/windows_printer.rb +0 -1
- data/lib/chef/resource/windows_printer_port.rb +0 -1
- data/lib/chef/resource/windows_script.rb +0 -2
- data/lib/chef/resource/windows_security_policy.rb +2 -3
- data/lib/chef/resource/windows_service.rb +0 -1
- data/lib/chef/resource/windows_share.rb +0 -1
- data/lib/chef/resource/windows_shortcut.rb +1 -2
- data/lib/chef/resource/windows_task.rb +0 -1
- data/lib/chef/resource/windows_uac.rb +0 -1
- data/lib/chef/resource/windows_update_settings.rb +0 -1
- data/lib/chef/resource/windows_user_privilege.rb +14 -11
- data/lib/chef/resource/windows_workgroup.rb +0 -1
- data/lib/chef/resource/yum_package.rb +2 -1
- data/lib/chef/resource/yum_repository.rb +4 -1
- data/lib/chef/resource/zypper_package.rb +2 -1
- data/lib/chef/resource/zypper_repository.rb +0 -1
- data/lib/chef/resource.rb +23 -5
- data/lib/chef/resource_inspector.rb +25 -7
- data/lib/chef/resource_reporter.rb +4 -0
- data/lib/chef/resources.rb +11 -0
- data/lib/chef/run_context.rb +3 -3
- data/lib/chef/secret_fetcher/azure_key_vault.rb +1 -1
- data/lib/chef/util/powershell/ps_credential.rb +10 -0
- data/lib/chef/version.rb +1 -1
- data/lib/chef/win32/handle.rb +6 -7
- data/lib/chef/win32/registry.rb +12 -4
- data/lib/chef/win32/security.rb +16 -1
- data/spec/data/rubygems.org/sexp_processor-info +2 -1
- data/spec/data/trusted_certs/intermediate.pem +38 -27
- data/spec/functional/resource/cookbook_file_spec.rb +1 -1
- data/spec/functional/resource/dsc_script_spec.rb +1 -1
- data/spec/functional/resource/execute_spec.rb +1 -1
- data/spec/functional/resource/group_spec.rb +26 -42
- data/spec/functional/resource/link_spec.rb +8 -8
- data/spec/functional/resource/plist_spec.rb +25 -0
- data/spec/functional/resource/registry_spec.rb +233 -609
- data/spec/functional/resource/remote_file_spec.rb +1 -1
- data/spec/functional/resource/user/linux_user_spec.rb +127 -0
- data/spec/functional/resource/windows_certificate_spec.rb +1 -1
- data/spec/functional/resource/windows_font_spec.rb +12 -9
- data/spec/functional/resource/yum_package_spec.rb +1 -1
- data/spec/functional/resource/zypper_package_spec.rb +12 -0
- data/spec/functional/shell_spec.rb +1 -2
- data/spec/functional/version_spec.rb +1 -1
- data/spec/functional/win32/registry_spec.rb +0 -3
- data/spec/integration/client/client_spec.rb +88 -3
- data/spec/integration/client/exit_code_spec.rb +1 -1
- data/spec/integration/client/fips_spec.rb +5 -5
- data/spec/integration/client/ipv6_spec.rb +1 -1
- data/spec/integration/client/open_ssl_spec.rb +3 -3
- data/spec/integration/compliance/compliance_spec.rb +1 -1
- data/spec/integration/recipes/accumulator_spec.rb +1 -1
- data/spec/integration/recipes/lwrp_inline_resources_spec.rb +1 -1
- data/spec/integration/recipes/lwrp_spec.rb +1 -1
- data/spec/integration/recipes/notifies_spec.rb +1 -1
- data/spec/integration/recipes/notifying_block_spec.rb +1 -1
- data/spec/integration/recipes/remote_directory.rb +1 -1
- data/spec/integration/recipes/unified_mode_spec.rb +1 -1
- data/spec/integration/recipes/use_partial_spec.rb +2 -1
- data/spec/integration/solo/solo_spec.rb +2 -2
- data/spec/spec_helper.rb +7 -4
- data/spec/support/chef_helpers.rb +2 -2
- data/spec/support/platform_helpers.rb +28 -7
- data/spec/support/ruby_installer.rb +1 -1
- data/spec/support/shared/functional/file_resource.rb +3 -3
- data/spec/support/shared/functional/windows_script.rb +2 -2
- data/spec/tiny_server.rb +5 -2
- data/spec/unit/application/client_spec.rb +0 -10
- data/spec/unit/chef_fs/file_system_spec.rb +2 -0
- data/spec/unit/client_spec.rb +80 -4
- data/spec/unit/compliance/runner_spec.rb +8 -0
- data/spec/unit/cookbook/syntax_check_spec.rb +3 -0
- data/spec/unit/data_collector_spec.rb +106 -2
- data/spec/unit/delayed_evaluator_spec.rb +35 -0
- data/spec/unit/file_cache_spec.rb +64 -0
- data/spec/unit/http/authenticator_spec.rb +121 -0
- data/spec/unit/mixin/homebrew_spec.rb +118 -0
- data/spec/unit/mixin/openssl_helper_spec.rb +5 -0
- data/spec/unit/mixin/powershell_exec_spec.rb +5 -5
- data/spec/unit/node/vivid_mash_spec.rb +42 -0
- data/spec/unit/node_spec.rb +6 -0
- data/spec/unit/platform/query_helpers_spec.rb +2 -17
- data/spec/unit/property/validation_spec.rb +30 -0
- data/spec/unit/provider/apt_repository_spec.rb +48 -12
- data/spec/unit/provider/cron_spec.rb +2 -0
- data/spec/unit/provider/http_request_spec.rb +60 -72
- data/spec/unit/provider/launchd_spec.rb +2 -2
- data/spec/unit/provider/mount/aix_spec.rb +2 -2
- data/spec/unit/provider/mount/linux_spec.rb +15 -4
- data/spec/unit/provider/mount/mount_spec.rb +8 -8
- data/spec/unit/provider/package/apt_spec.rb +18 -13
- data/spec/unit/provider/package/chocolatey_spec.rb +41 -9
- data/spec/unit/provider/package/homebrew_spec.rb +4 -1
- data/spec/unit/provider/package/rpm_spec.rb +2 -2
- data/spec/unit/provider/package/rubygems_spec.rb +1 -1
- data/spec/unit/provider/package/windows_spec.rb +5 -5
- data/spec/unit/provider/package/zypper_spec.rb +32 -0
- data/spec/unit/provider/powershell_script_spec.rb +100 -4
- data/spec/unit/provider/registry_key_spec.rb +17 -17
- data/spec/unit/provider/remote_file/http_spec.rb +4 -4
- data/spec/unit/provider/service/systemd_service_spec.rb +1 -0
- data/spec/unit/provider/user/linux_spec.rb +51 -1
- data/spec/unit/provider/user/windows_spec.rb +1 -0
- data/spec/unit/provider/user_spec.rb +24 -6
- data/spec/unit/resource/apt_repository_spec.rb +5 -0
- data/spec/unit/resource/archive_file_spec.rb +1 -1
- data/spec/unit/resource/chef_client_cron_spec.rb +5 -0
- data/spec/unit/resource/chef_client_launchd_spec.rb +5 -0
- data/spec/unit/resource/chef_client_scheduled_task_spec.rb +5 -0
- data/spec/unit/resource/chef_client_systemd_timer_spec.rb +1 -1
- data/spec/unit/resource/chocolatey_installer_spec.rb +151 -0
- data/spec/unit/resource/cron_d_spec.rb +37 -1
- data/spec/unit/resource/macos_pkg_spec.rb +38 -0
- data/spec/unit/resource/powershell_script_spec.rb +2 -2
- data/spec/unit/resource/rest_resource_spec.rb +381 -0
- data/spec/unit/resource/selinux_boolean_spec.rb +92 -0
- data/spec/unit/resource/selinux_fcontext_spec.rb +65 -0
- data/spec/unit/resource/selinux_install_spec.rb +60 -0
- data/spec/unit/resource/selinux_login_spec.rb +73 -0
- data/spec/unit/resource/selinux_module_spec.rb +55 -0
- data/spec/unit/resource/selinux_permissive_spec.rb +39 -0
- data/spec/unit/resource/selinux_port_spec.rb +42 -0
- data/spec/unit/resource/selinux_state_spec.rb +46 -0
- data/spec/unit/resource/selinux_user_spec.rb +92 -0
- data/spec/unit/resource/sysctl_spec.rb +2 -2
- data/spec/unit/resource/user/linux_user_spec.rb +42 -0
- data/spec/unit/resource/yum_repository_spec.rb +4 -0
- data/spec/unit/resource_inspector_spec.rb +36 -0
- data/spec/unit/resource_reporter_spec.rb +57 -3
- data/spec/unit/resource_spec.rb +94 -2
- data/spec/unit/util/dsc/local_configuration_manager_spec.rb +1 -1
- data/spec/unit/util/powershell/ps_credential_spec.rb +6 -0
- data/tasks/rspec.rb +1 -1
- metadata +126 -44
- data/lib/chef/powershell.rb +0 -81
- data/spec/unit/mixin/homebrew_user_spec.rb +0 -119
- /data/spec/functional/assets/yumrepo/repodata/{01a3b-filelists.sqlite.bz2 → 4632d67cb92636e7575d911c24f0e04d3505a944e97c483abe0c3e73a7c62d33-filelists.sqlite.bz2} +0 -0
- /data/spec/functional/assets/yumrepo/repodata/{6bf96-other.xml.gz → 74599b793e54d877323837d2d81a1c3c594c44e4335f9528234bb490f7b9b439-other.xml.gz} +0 -0
- /data/spec/functional/assets/yumrepo/repodata/{5dc1e-primary.sqlite.bz2 → a845d418f919d2115ab95a56b2c76f6825ad0d0bede49181a55c04f58995d057-primary.sqlite.bz2} +0 -0
- /data/spec/functional/assets/yumrepo/repodata/{7c365-other.sqlite.bz2 → af9b7cf9ef23bd7b43068d74a460f3b5d06753d638e58e4a0c9edc35bfb9cdc4-other.sqlite.bz2} +0 -0
- /data/spec/functional/assets/yumrepo/repodata/{401dc-filelists.xml.gz → bdb4f5f1492a3b9532f22c43110a81500dd744f23da0aec5c33b2a41317c737d-filelists.xml.gz} +0 -0
- /data/spec/functional/assets/yumrepo/repodata/{dabe2-primary.xml.gz → c10d1d34ce99e02f12ec96ef68360543ab1bb7c3cb81a4a2bf78df7d8597e9df-primary.xml.gz} +0 -0
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
class Chef
|
|
2
|
+
class Resource
|
|
3
|
+
class ChocolateyInstaller < Chef::Resource
|
|
4
|
+
provides :chocolatey_installer
|
|
5
|
+
|
|
6
|
+
description "Use the chocolatey_installer resource to ensure that Chocolatey itself is installed to your specification. Use the Chocolatey Feature resource to customize your install. Then use the Chocolatey Package resource to install packages on Windows via Chocolatey."
|
|
7
|
+
introduced "18.3"
|
|
8
|
+
examples <<~DOC
|
|
9
|
+
**Install Chocolatey**
|
|
10
|
+
|
|
11
|
+
```ruby
|
|
12
|
+
chocolatey_installer 'latest' do
|
|
13
|
+
action :install
|
|
14
|
+
end
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**Uninstall Chocolatey**
|
|
18
|
+
|
|
19
|
+
```ruby
|
|
20
|
+
chocolatey_installer 'Some random verbiage' do
|
|
21
|
+
action :uninstall
|
|
22
|
+
end
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
**Install Chocolatey with Parameters**
|
|
26
|
+
|
|
27
|
+
```ruby
|
|
28
|
+
chocolatey_installer 'latest' do
|
|
29
|
+
action :install
|
|
30
|
+
download_url "https://www.contoso.com/foo"
|
|
31
|
+
chocolatey_version '2.12.24'
|
|
32
|
+
end
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
```ruby
|
|
36
|
+
chocolatey_installer 'latest' do
|
|
37
|
+
action :install
|
|
38
|
+
download_url "c:\\foo\foo.nupkg"
|
|
39
|
+
chocolatey_version '2.12.24'
|
|
40
|
+
end
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**Upgrade Chocolatey with Parameters**
|
|
44
|
+
|
|
45
|
+
```ruby
|
|
46
|
+
chocolatey_installer 'latest' do
|
|
47
|
+
action :upgrade
|
|
48
|
+
chocolatey_version '2.12.24'
|
|
49
|
+
end
|
|
50
|
+
```
|
|
51
|
+
DOC
|
|
52
|
+
|
|
53
|
+
allowed_actions :install, :uninstall, :upgrade
|
|
54
|
+
|
|
55
|
+
property :download_url, String,
|
|
56
|
+
description: "The URL to download Chocolatey from. This sets the value of $env:ChocolateyDownloadUrl and causes the installer to choose an alternate download location. If this is not set, Chocolatey installs fall back to the official Chocolatey community repository to download Chocolatey from. It can also be used for offline installation by providing a path to a Chocolatey.nupkg."
|
|
57
|
+
|
|
58
|
+
property :chocolatey_version, String,
|
|
59
|
+
description: "Specifies a target version of Chocolatey to install. By default, the latest stable version is installed. This will use the value in $env:ChocolateyVersion by default, if that environment variable is present. This parameter is ignored if download_url is set."
|
|
60
|
+
|
|
61
|
+
property :use_native_unzip, [TrueClass, FalseClass], default: false,
|
|
62
|
+
description: "If set, uses built-in Windows decompression tools instead of 7zip when unpacking the downloaded nupkg. This will be set by default if use_native_unzip is set to a value other than 'false' or '0'. This parameter will be ignored in PS 5+ in favour of using the Expand-Archive built in PowerShell cmdlet directly."
|
|
63
|
+
|
|
64
|
+
property :ignore_proxy, [TrueClass, FalseClass], default: false,
|
|
65
|
+
description: "If set, ignores any configured proxy. This will override any proxy environment variables or parameters. This will be set by default if ignore_proxy is set to a value other than 'false' or '0'."
|
|
66
|
+
|
|
67
|
+
property :proxy_url, String,
|
|
68
|
+
description: "Specifies the proxy URL to use during the download."
|
|
69
|
+
|
|
70
|
+
property :proxy_user, String,
|
|
71
|
+
description: "The username to use to build a proxy credential with. Will be consumed by the proxy_credential property if both this property and proxy_password are set"
|
|
72
|
+
|
|
73
|
+
property :proxy_password, String,
|
|
74
|
+
description: "The password to use to build a proxy credential with. Will be consumed by the proxy_credential property if both this property and proxy_user are set"
|
|
75
|
+
|
|
76
|
+
load_current_value do
|
|
77
|
+
current_state = is_choco_installed?
|
|
78
|
+
current_value_does_not_exist! if current_state == false
|
|
79
|
+
current_state
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def is_choco_installed?
|
|
83
|
+
::File.exist?("#{ENV["ALLUSERSPROFILE"]}\\chocolatey\\bin\\choco.exe")
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def get_choco_version
|
|
87
|
+
powershell_exec("choco --version").result
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def existing_version
|
|
91
|
+
Gem::Version.new(get_choco_version)
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def define_resource_requirements
|
|
95
|
+
requirements.assert(:install, :upgrade).each do |a|
|
|
96
|
+
a.assertion do
|
|
97
|
+
# This is an exclusive OR - XOR - we're trying to coax an error out if one, but not both,
|
|
98
|
+
# parameters are empty.
|
|
99
|
+
new_resource.proxy_user.nil? != new_resource.proxy_password.nil?
|
|
100
|
+
end
|
|
101
|
+
a.failure_message(Chef::Exceptions::ValidationFailed, "You must specify both a proxy_user and a proxy_password")
|
|
102
|
+
a.whyrun("Assuming that if you have configured a 'proxy_user' you must also supply a 'proxy_password'")
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
action :install, description: "Installs Chocolatey package manager" do
|
|
107
|
+
if new_resource.download_url
|
|
108
|
+
powershell_exec("Set-Item -path env:ChocolateyDownloadUrl -Value #{new_resource.download_url}")
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
if new_resource.chocolatey_version
|
|
112
|
+
powershell_exec("Set-Item -path env:ChocolateyVersion -Value #{new_resource.chocolatey_version}")
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
if new_resource.use_native_unzip
|
|
116
|
+
powershell_exec("Set-Item -path env:ChocolateyUseWindowsCompression -Value true")
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
if new_resource.ignore_proxy
|
|
120
|
+
powershell_exec("Set-Item -path env:ChocolateyIgnoreProxy -Value true")
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
if new_resource.proxy_url
|
|
124
|
+
powershell_exec("Set-Item -path env:ChocolateyProxyLocation -Value #{new_resource.proxy_url}")
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
if new_resource.proxy_user && new_resource.proxy_password
|
|
128
|
+
powershell_exec("Set-Item -path env:ChocolateyProxyUser -Value #{new_resource.proxy_user}; Set-Item -path env:ChocolateyProxyPassword -Value #{new_resource.proxy_password}")
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# note that Invoke-Expression is being called on the downloaded script (outer parens),
|
|
132
|
+
# not triggering the script download (inner parens)
|
|
133
|
+
converge_if_changed do
|
|
134
|
+
powershell_exec("Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))").error!
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
action :upgrade, description: "Upgrades the Chocolatey package manager" do
|
|
139
|
+
if new_resource.chocolatey_version
|
|
140
|
+
proposed_version = Gem::Version.new(new_resource.chocolatey_version)
|
|
141
|
+
else
|
|
142
|
+
proposed_version = nil
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
if new_resource.download_url
|
|
146
|
+
powershell_exec("Set-Item -path env:ChocolateyDownloadUrl -Value #{new_resource.download_url}")
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
if new_resource.chocolatey_version
|
|
150
|
+
powershell_exec("Set-Item -path env:ChocolateyVersion -Value #{new_resource.chocolatey_version}")
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
if new_resource.use_native_unzip
|
|
154
|
+
powershell_exec("Set-Item -path env:ChocolateyUseWindowsCompression -Value true")
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
if new_resource.ignore_proxy
|
|
158
|
+
powershell_exec("Set-Item -path env:ChocolateyIgnoreProxy -Value true")
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
if new_resource.proxy_url
|
|
162
|
+
powershell_exec("Set-Item -path env:ChocolateyProxyLocation -Value #{new_resource.proxy_url}")
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
if new_resource.proxy_user && new_resource.proxy_password
|
|
166
|
+
powershell_exec("Set-Item -path env:ChocolateyProxyUser -Value #{new_resource.proxy_user}; Set-Item -path env:ChocolateyProxyPassword -Value #{new_resource.proxy_password}")
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
if proposed_version && existing_version < proposed_version
|
|
170
|
+
powershell_exec("Set-Item -path env:ChocolateyVersion -Value #{proposed_version}")
|
|
171
|
+
else
|
|
172
|
+
powershell_exec("Remove-Item -path env:ChocolateyVersion")
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
converge_by("upgrade choco version") do
|
|
176
|
+
powershell_exec("choco upgrade Chocolatey -y").result
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
action :uninstall, description: "Uninstall Chocolatey package manager" do
|
|
181
|
+
path = "c:\\programdata\\chocolatey\\bin"
|
|
182
|
+
if File.exists?(path)
|
|
183
|
+
converge_by("Uninstall Choco") do
|
|
184
|
+
powershell_code = <<~CODE
|
|
185
|
+
Remove-Item $env:ALLUSERSPROFILE\\chocolatey -Recurse -Force
|
|
186
|
+
[Environment]::SetEnvironmentVariable("ChocolateyLastPathUpdate", $null ,"User")
|
|
187
|
+
[Environment]::SetEnvironmentVariable("ChocolateyToolsLocation", $null ,"User")
|
|
188
|
+
[Environment]::SetEnvironmentVariable("ChocolateyInstall", $null ,"Machine")
|
|
189
|
+
$path = [System.Environment]::GetEnvironmentVariable(
|
|
190
|
+
'PATH',
|
|
191
|
+
'Machine'
|
|
192
|
+
)
|
|
193
|
+
$path = ($path.Split(';') | Where-Object { $_ -ne "#{path}" }) -join ";"
|
|
194
|
+
[System.Environment]::SetEnvironmentVariable(
|
|
195
|
+
'PATH',
|
|
196
|
+
$path,
|
|
197
|
+
'Machine'
|
|
198
|
+
)
|
|
199
|
+
CODE
|
|
200
|
+
powershell_exec(powershell_code).error!
|
|
201
|
+
end
|
|
202
|
+
end
|
|
203
|
+
Chef::Log.warn("Chocolatey is already uninstalled.")
|
|
204
|
+
end
|
|
205
|
+
end
|
|
206
|
+
end
|
|
207
|
+
end
|
|
@@ -21,7 +21,6 @@ require_relative "package"
|
|
|
21
21
|
class Chef
|
|
22
22
|
class Resource
|
|
23
23
|
class ChocolateyPackage < Chef::Resource::Package
|
|
24
|
-
unified_mode true
|
|
25
24
|
|
|
26
25
|
provides :chocolatey_package
|
|
27
26
|
|
|
@@ -68,6 +67,14 @@ class Chef
|
|
|
68
67
|
description: "The name of the package. Default value: the name of the resource block.",
|
|
69
68
|
coerce: proc { |x| [x].flatten }
|
|
70
69
|
|
|
70
|
+
property :bulk_query, [TrueClass, FalseClass],
|
|
71
|
+
description: "Bulk query the chocolatey server? This will cause the provider to list all packages instead of doing individual queries.",
|
|
72
|
+
default: false
|
|
73
|
+
|
|
74
|
+
property :use_choco_list, [TrueClass, FalseClass],
|
|
75
|
+
description: "Use choco list for getting the locally installed packages, rather than reading the nupkg database directly? This defaults to false, since reading the package data is faster.",
|
|
76
|
+
default: false
|
|
77
|
+
|
|
71
78
|
property :version, [String, Array],
|
|
72
79
|
description: "The version of a package to be installed or upgraded.",
|
|
73
80
|
coerce: proc { |x| [x].flatten }
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
class Chef
|
|
18
18
|
class Resource
|
|
19
19
|
class ChocolateySource < Chef::Resource
|
|
20
|
-
unified_mode true
|
|
21
20
|
provides :chocolatey_source
|
|
22
21
|
|
|
23
22
|
description "Use the **chocolatey_source** resource to add, remove, enable, or disable Chocolatey sources. Note: The Chocolatey package manager is not installed on Windows by default. You will need to install it prior to using this resource by adding the [Chocolatey cookbook](https://supermarket.chef.io/cookbooks/chocolatey/) to your node's run list."
|
|
@@ -23,7 +23,6 @@ require "chef-utils/dist" unless defined?(ChefUtils::Dist)
|
|
|
23
23
|
class Chef
|
|
24
24
|
class Resource
|
|
25
25
|
class CronD < Chef::Resource
|
|
26
|
-
unified_mode true
|
|
27
26
|
|
|
28
27
|
use "cron_shared"
|
|
29
28
|
|
|
@@ -146,6 +145,21 @@ class Chef
|
|
|
146
145
|
new_resource.cron_name.tr(".", "-")
|
|
147
146
|
end
|
|
148
147
|
|
|
148
|
+
def define_resource_requirements
|
|
149
|
+
requirements.assert(:create, :create_if_missing) do |a|
|
|
150
|
+
a.assertion do
|
|
151
|
+
# ensure valid cron job names for linux, otherwise the jobs won't be executed
|
|
152
|
+
if linux?
|
|
153
|
+
new_resource.cron_name =~ /^[a-zA-Z0-9_-]+$/
|
|
154
|
+
else
|
|
155
|
+
true
|
|
156
|
+
end
|
|
157
|
+
end
|
|
158
|
+
a.failure_message("The cron job name should contain letters, numbers, hyphens and underscores only.")
|
|
159
|
+
a.block_action!
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
|
|
149
163
|
def create_template(create_action)
|
|
150
164
|
# cleanup the legacy named job if it exists
|
|
151
165
|
file "#{new_resource.cron_name} legacy named cron.d file" do
|
data/lib/chef/resource/csh.rb
CHANGED
|
@@ -20,7 +20,6 @@ require_relative "../resource"
|
|
|
20
20
|
class Chef
|
|
21
21
|
class Resource
|
|
22
22
|
class DmgPackage < Chef::Resource
|
|
23
|
-
unified_mode true
|
|
24
23
|
|
|
25
24
|
provides(:dmg_package) { true }
|
|
26
25
|
|
|
@@ -58,6 +57,8 @@ class Chef
|
|
|
58
57
|
```
|
|
59
58
|
DOC
|
|
60
59
|
|
|
60
|
+
allowed_actions :install
|
|
61
|
+
|
|
61
62
|
property :app, String,
|
|
62
63
|
description: "The name of the application as it appears in the `/Volumes` directory if it differs from the resource block's name.",
|
|
63
64
|
name_property: true
|
|
@@ -26,7 +26,6 @@ class Chef
|
|
|
26
26
|
class DscScript < Chef::Resource
|
|
27
27
|
include Chef::DSL::Powershell
|
|
28
28
|
|
|
29
|
-
unified_mode true
|
|
30
29
|
provides :dsc_script
|
|
31
30
|
|
|
32
31
|
description <<~DESC
|
|
@@ -35,7 +34,7 @@ class Chef
|
|
|
35
34
|
resource in #{ChefUtils::Dist::Infra::PRODUCT}, such as the Archive resource, a custom DSC resource, an existing DSC script that performs an important
|
|
36
35
|
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.
|
|
37
36
|
|
|
38
|
-
Warning: The **dsc_script** resource
|
|
37
|
+
Warning: The **dsc_script** resource is only available on 64-bit Chef Infra Client.
|
|
39
38
|
DESC
|
|
40
39
|
|
|
41
40
|
default_action :run
|
|
@@ -23,7 +23,6 @@ require "chef-utils/dist" unless defined?(ChefUtils::Dist)
|
|
|
23
23
|
class Chef
|
|
24
24
|
class Resource
|
|
25
25
|
class Execute < Chef::Resource
|
|
26
|
-
unified_mode true
|
|
27
26
|
|
|
28
27
|
provides :execute, target_mode: true
|
|
29
28
|
|
|
@@ -443,14 +442,14 @@ class Chef
|
|
|
443
442
|
NetworkService have this right when running as a service. This is necessary
|
|
444
443
|
even if the user is an Administrator.
|
|
445
444
|
|
|
446
|
-
This right can be added and checked in a recipe using this example:
|
|
445
|
+
This right can be added and checked in a recipe using this example (will not take effect in the same Chef run):
|
|
447
446
|
|
|
448
447
|
```ruby
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
448
|
+
windows_user_privilege 'add assign token privilege' do
|
|
449
|
+
principal '<user>'
|
|
450
|
+
privilege 'SeAssignPrimaryTokenPrivilege'
|
|
451
|
+
action :add
|
|
452
|
+
end
|
|
454
453
|
```
|
|
455
454
|
|
|
456
455
|
The following example shows how to run `mkdir test_dir` from a Chef Infra Client
|
|
@@ -493,9 +492,11 @@ class Chef
|
|
|
493
492
|
|
|
494
493
|
**Run a command with an external input file**:
|
|
495
494
|
|
|
495
|
+
```ruby
|
|
496
496
|
execute 'md5sum' do
|
|
497
497
|
input File.read(__FILE__)
|
|
498
498
|
end
|
|
499
|
+
```
|
|
499
500
|
EXAMPLES
|
|
500
501
|
|
|
501
502
|
# The ResourceGuardInterpreter wraps a resource's guards in another resource. That inner resource
|
data/lib/chef/resource/file.rb
CHANGED
|
@@ -25,12 +25,13 @@ require_relative "../provider/package/freebsd/pkgng"
|
|
|
25
25
|
class Chef
|
|
26
26
|
class Resource
|
|
27
27
|
class FreebsdPackage < Chef::Resource::Package
|
|
28
|
-
unified_mode true
|
|
29
28
|
provides :freebsd_package
|
|
30
29
|
provides :package, platform: "freebsd"
|
|
31
30
|
|
|
32
31
|
description "Use the **freebsd_package** resource to manage packages for the FreeBSD platform."
|
|
33
32
|
|
|
33
|
+
allowed_actions :install, :remove
|
|
34
|
+
|
|
34
35
|
# make sure we assign the appropriate underlying providers based on what
|
|
35
36
|
# package managers exist on this FreeBSD system or the source of the package
|
|
36
37
|
#
|
|
@@ -22,7 +22,6 @@ require "chef-utils/dist" unless defined?(ChefUtils::Dist)
|
|
|
22
22
|
class Chef
|
|
23
23
|
class Resource
|
|
24
24
|
class GemPackage < Chef::Resource::Package
|
|
25
|
-
unified_mode true
|
|
26
25
|
provides :gem_package
|
|
27
26
|
|
|
28
27
|
description <<~DESC
|
|
@@ -60,6 +59,8 @@ class Chef
|
|
|
60
59
|
```
|
|
61
60
|
EXAMPLES
|
|
62
61
|
|
|
62
|
+
allowed_actions :install, :upgrade, :remove, :purge
|
|
63
|
+
|
|
63
64
|
property :package_name, String,
|
|
64
65
|
description: "An optional property to set the package name if it differs from the resource block's name.",
|
|
65
66
|
identity: true
|
data/lib/chef/resource/group.rb
CHANGED
|
@@ -20,11 +20,34 @@
|
|
|
20
20
|
class Chef
|
|
21
21
|
class Resource
|
|
22
22
|
class Group < Chef::Resource
|
|
23
|
-
unified_mode true
|
|
24
23
|
state_attrs :members
|
|
25
24
|
|
|
26
25
|
description "Use the **group** resource to manage a local group."
|
|
27
26
|
|
|
27
|
+
examples <<~EXAMPLES
|
|
28
|
+
The following examples demonstrate various approaches for using the **group** resource in recipes:
|
|
29
|
+
|
|
30
|
+
Append users to groups:
|
|
31
|
+
|
|
32
|
+
```ruby
|
|
33
|
+
group 'www-data' do
|
|
34
|
+
action :modify
|
|
35
|
+
members 'maintenance'
|
|
36
|
+
append true
|
|
37
|
+
end
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Add a user to group on the Windows platform:
|
|
41
|
+
|
|
42
|
+
```ruby
|
|
43
|
+
group 'Administrators' do
|
|
44
|
+
members ['domain\\foo']
|
|
45
|
+
append true
|
|
46
|
+
action :modify
|
|
47
|
+
end
|
|
48
|
+
```
|
|
49
|
+
EXAMPLES
|
|
50
|
+
|
|
28
51
|
provides :group
|
|
29
52
|
|
|
30
53
|
allowed_actions :create, :remove, :modify, :manage
|
|
@@ -39,7 +62,7 @@ class Chef
|
|
|
39
62
|
|
|
40
63
|
property :members, [String, Array], default: [],
|
|
41
64
|
coerce: proc { |arg| arg.is_a?(String) ? arg.split(/\s*,\s*/) : arg },
|
|
42
|
-
description: "Which users should be set or appended to a group. When more than one group member is identified, the list of members should be an array: members ['user1', 'user2']
|
|
65
|
+
description: "Which users should be set or appended to a group. When more than one group member is identified, the list of members should be an array: `members ['user1', 'user2']`."
|
|
43
66
|
|
|
44
67
|
property :excluded_members, [String, Array], default: [],
|
|
45
68
|
coerce: proc { |arg| arg.is_a?(String) ? arg.split(/\s*,\s*/) : arg },
|
|
@@ -20,7 +20,6 @@ require_relative "../../resource"
|
|
|
20
20
|
class Chef
|
|
21
21
|
class Resource
|
|
22
22
|
class HabitatSup < Chef::Resource
|
|
23
|
-
unified_mode true
|
|
24
23
|
|
|
25
24
|
provides :habitat_sup do |_node|
|
|
26
25
|
false
|
|
@@ -49,7 +48,7 @@ class Chef
|
|
|
49
48
|
|
|
50
49
|
```ruby
|
|
51
50
|
habitat_sup 'default' do
|
|
52
|
-
bldr_url 'https://bldr.
|
|
51
|
+
bldr_url 'https://bldr.example.com'
|
|
53
52
|
end
|
|
54
53
|
```
|
|
55
54
|
|
|
@@ -57,13 +56,13 @@ class Chef
|
|
|
57
56
|
|
|
58
57
|
```ruby
|
|
59
58
|
habitat_sup 'default' do
|
|
60
|
-
bldr_url 'https://bldr.
|
|
59
|
+
bldr_url 'https://bldr.example.com'
|
|
61
60
|
habitat_channel 'dev'
|
|
62
61
|
update_condition 'track-channel'
|
|
63
62
|
end
|
|
64
63
|
```
|
|
65
64
|
|
|
66
|
-
**Provide
|
|
65
|
+
**Provide event stream information**
|
|
67
66
|
|
|
68
67
|
```ruby
|
|
69
68
|
habitat_sup 'default' do
|
|
@@ -71,7 +70,7 @@ class Chef
|
|
|
71
70
|
event_stream_application 'myapp'
|
|
72
71
|
event_stream_environment 'production'
|
|
73
72
|
event_stream_site 'MySite'
|
|
74
|
-
event_stream_url 'automate.
|
|
73
|
+
event_stream_url 'automate.example.com:4222'
|
|
75
74
|
event_stream_token 'myawesomea2clitoken='
|
|
76
75
|
event_stream_cert '/hab/cache/ssl/mycert.crt'
|
|
77
76
|
end
|
|
@@ -81,7 +80,7 @@ class Chef
|
|
|
81
80
|
|
|
82
81
|
```ruby
|
|
83
82
|
habitat_sup 'default' do
|
|
84
|
-
bldr_url 'https://bldr.
|
|
83
|
+
bldr_url 'https://bldr.example.com'
|
|
85
84
|
sup_version '1.5.50'
|
|
86
85
|
launcher_version '13458'
|
|
87
86
|
service_version '0.6.0' # WINDOWS ONLY
|
|
@@ -91,7 +90,7 @@ class Chef
|
|
|
91
90
|
**Set latest version of packages to retain**
|
|
92
91
|
|
|
93
92
|
habitat_sup 'default' do
|
|
94
|
-
bldr_url 'https://bldr.
|
|
93
|
+
bldr_url 'https://bldr.example.com'
|
|
95
94
|
sup_version '1.5.86'
|
|
96
95
|
launcher_version '13458'
|
|
97
96
|
service_version '0.6.0' # WINDOWS ONLY
|
|
@@ -19,7 +19,6 @@ require_relative "../resource"
|
|
|
19
19
|
class Chef
|
|
20
20
|
class Resource
|
|
21
21
|
class HabitatInstall < Chef::Resource
|
|
22
|
-
unified_mode true
|
|
23
22
|
provides :habitat_install
|
|
24
23
|
|
|
25
24
|
description "Use the **habitat_install** resource to install Chef Habitat."
|
|
@@ -128,6 +127,7 @@ class Chef
|
|
|
128
127
|
remote_file ::File.join(Chef::Config[:file_cache_path], "hab-install.sh") do
|
|
129
128
|
source new_resource.install_url
|
|
130
129
|
sensitive true
|
|
130
|
+
mode 0755
|
|
131
131
|
end
|
|
132
132
|
|
|
133
133
|
execute "installing with hab-install.sh" do
|
|
@@ -236,7 +236,7 @@ class Chef
|
|
|
236
236
|
end
|
|
237
237
|
|
|
238
238
|
def hab_command
|
|
239
|
-
cmd = "
|
|
239
|
+
cmd = "#{Chef::Config[:file_cache_path]}/hab-install.sh"
|
|
240
240
|
cmd << " -v #{new_resource.hab_version} " if new_resource.hab_version
|
|
241
241
|
cmd << " -t x86_64-linux-kernel2" if node["kernel"]["release"].to_i < 3
|
|
242
242
|
cmd
|
|
@@ -20,7 +20,6 @@ require "chef-utils/dist" unless defined?(ChefUtils::Dist)
|
|
|
20
20
|
class Chef
|
|
21
21
|
class Resource
|
|
22
22
|
class HabitatService < Chef::Resource
|
|
23
|
-
unified_mode true
|
|
24
23
|
provides :habitat_service
|
|
25
24
|
|
|
26
25
|
description "Use the **habitat_service** resource to manage Chef Habitat services. This requires that `core/hab-sup` be running as a service. See the `habitat_sup` resource documentation for more information. Note: Applications may run as a specific user. Often with Habitat, the default is `hab`, or `root`. If the application requires another user, then it should be created with Chef's `user` resource."
|
|
@@ -16,7 +16,6 @@ require_relative "../resource"
|
|
|
16
16
|
class Chef
|
|
17
17
|
class Resource
|
|
18
18
|
class HabitatUserToml < Chef::Resource
|
|
19
|
-
unified_mode true
|
|
20
19
|
provides :habitat_user_toml
|
|
21
20
|
|
|
22
21
|
description "Use the **habitat_user_toml** to template a `user.toml` for Chef Habitat services. Configurations set in the `user.toml` override the `default.toml` for a given package, which makes it an alternative to applying service group level configuration."
|