summaryrefslogtreecommitdiff
path: root/lib/chef
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef')
-rw-r--r--lib/chef/cookbook_version.rb4
-rw-r--r--lib/chef/mixin/powershell_out.rb2
-rw-r--r--lib/chef/node_map.rb14
-rw-r--r--lib/chef/provider/dsc_resource.rb4
-rw-r--r--lib/chef/provider/dsc_script.rb8
-rw-r--r--lib/chef/provider/package/powershell.rb2
-rw-r--r--lib/chef/provider/powershell_script.rb6
-rw-r--r--lib/chef/resource/apt_package.rb1
-rw-r--r--lib/chef/resource/apt_repository.rb2
-rw-r--r--lib/chef/resource/build_essential.rb76
-rw-r--r--lib/chef/resource/chef_gem.rb5
-rw-r--r--lib/chef/resource/chocolatey_package.rb3
-rw-r--r--lib/chef/resource/directory.rb8
-rw-r--r--lib/chef/resource/dmg_package.rb5
-rw-r--r--lib/chef/resource/dnf_package.rb43
-rw-r--r--lib/chef/resource/dpkg_package.rb4
-rw-r--r--lib/chef/resource/dsc_resource.rb7
-rw-r--r--lib/chef/resource/dsc_script.rb9
-rw-r--r--lib/chef/resource/execute.rb5
-rw-r--r--lib/chef/resource/git.rb8
-rw-r--r--lib/chef/resource/http_request.rb4
-rw-r--r--lib/chef/resource/locale.rb92
-rw-r--r--lib/chef/resource/macos_userdefaults.rb6
-rw-r--r--lib/chef/resource/macosx_service.rb5
-rw-r--r--lib/chef/resource/mount.rb63
-rw-r--r--lib/chef/resource/msu_package.rb17
-rw-r--r--lib/chef/resource/ohai.rb6
-rw-r--r--lib/chef/resource/osx_profile.rb21
-rw-r--r--lib/chef/resource/package.rb6
-rw-r--r--lib/chef/resource/paludis_package.rb4
-rw-r--r--lib/chef/resource/portage_package.rb3
-rw-r--r--lib/chef/resource/powershell_package.rb26
-rw-r--r--lib/chef/resource/powershell_package_source.rb2
-rw-r--r--lib/chef/resource/reboot.rb9
-rw-r--r--lib/chef/resource/route.rb2
-rw-r--r--lib/chef/resource/systemd_unit.rb3
-rw-r--r--lib/chef/resource/windows_ad_join.rb4
-rw-r--r--lib/chef/resource/windows_font.rb2
-rw-r--r--lib/chef/resource/yum_package.rb50
-rw-r--r--lib/chef/resource/yum_repository.rb2
-rw-r--r--lib/chef/resource/zypper_package.rb6
-rw-r--r--lib/chef/resource_inspector.rb1
-rw-r--r--lib/chef/resources.rb1
-rw-r--r--lib/chef/util/powershell/cmdlet.rb2
-rw-r--r--lib/chef/version.rb2
45 files changed, 348 insertions, 207 deletions
diff --git a/lib/chef/cookbook_version.rb b/lib/chef/cookbook_version.rb
index 343b037c8b..07ee501ff7 100644
--- a/lib/chef/cookbook_version.rb
+++ b/lib/chef/cookbook_version.rb
@@ -296,9 +296,9 @@ class Chef
# we're just going to make cookbook_files out of these and make the
# cookbook find them by filespecificity again. but it's the shortest
# path to "success" for now.
- if manifest_record_path =~ /(#{Regexp.escape(segment.to_s)}\/[^\/]+\/#{Regexp.escape(dirname)})\/.+$/
+ if manifest_record_path =~ /(#{Regexp.escape(segment.to_s)}\/[^\/]*\/?#{Regexp.escape(dirname)})\/.+$/
specificity_dirname = $1
- non_specific_path = manifest_record_path[/#{Regexp.escape(segment.to_s)}\/[^\/]+\/#{Regexp.escape(dirname)}\/(.+)$/, 1]
+ non_specific_path = manifest_record_path[/#{Regexp.escape(segment.to_s)}\/[^\/]*\/?#{Regexp.escape(dirname)}\/(.+)$/, 1]
# Record the specificity_dirname only if it's in the list of
# valid preferences
if filenames_by_pref[specificity_dirname]
diff --git a/lib/chef/mixin/powershell_out.rb b/lib/chef/mixin/powershell_out.rb
index 1a757074c2..f910360d36 100644
--- a/lib/chef/mixin/powershell_out.rb
+++ b/lib/chef/mixin/powershell_out.rb
@@ -86,7 +86,7 @@ class Chef
# always set the ExecutionPolicy flag
# see http://technet.microsoft.com/en-us/library/ee176961.aspx
"-ExecutionPolicy Unrestricted",
- # Powershell will hang if STDIN is redirected
+ # PowerShell will hang if STDIN is redirected
# http://connect.microsoft.com/PowerShell/feedback/details/572313/powershell-exe-can-hang-if-stdin-is-redirected
"-InputFormat None",
]
diff --git a/lib/chef/node_map.rb b/lib/chef/node_map.rb
index a4891234f5..ac60b590b6 100644
--- a/lib/chef/node_map.rb
+++ b/lib/chef/node_map.rb
@@ -38,19 +38,13 @@
class Chef
class NodeMap
COLLISION_WARNING_14 = <<~EOH.gsub(/\s+/, " ").strip
- %{type_caps} %{key} has been loaded from a cookbook. The %{type} %{key} is now
- included in Chef and will take precedence over the existing cookbook %{type} in the
- next major release of Chef (15.0, April 2019). You may be able to remove this cookbook dependency from
- your runlist if you do not use other recipes/resources/libraries from the cookbook.
- Alternatively there may be a newer version of this cookbook without the %{key} %{type}.
+ %{type_caps} %{key} from a cookbook is overriding the %{type} from the client. Please upgrade your cookbook
+ or remove the cookbook from your run_list before the next major release of Chef.
EOH
COLLISION_WARNING_15 = <<~EOH.gsub(/\s+/, " ").strip
- %{type_caps} %{key} attempted to load from a cookbook. The %{type} %{key} is now
- included in Chef and takes precedence over the existing cookbook %{type}
- which will be ignored. You may be able to remove this cookbook dependency from
- your runlist if you do not use other recipes/resources/libraries from the cookbook.
- Alternatively there may be a newer version of this cookbook without the %{key} %{type}.
+ %{type_caps} %{key} from the client is overriding the %{type} from a cookbook. Please upgrade your cookbook
+ or remove the cookbook from your run_list.
EOH
#
diff --git a/lib/chef/provider/dsc_resource.rb b/lib/chef/provider/dsc_resource.rb
index 3a209a08a1..864373f902 100644
--- a/lib/chef/provider/dsc_resource.rb
+++ b/lib/chef/provider/dsc_resource.rb
@@ -48,10 +48,10 @@ class Chef
def define_resource_requirements
requirements.assert(:run) do |a|
a.assertion { supports_dsc_invoke_resource? }
- err = ["You must have Powershell version >= 5.0.10018.0 to use dsc_resource."]
+ err = ["You must have PowerShell version >= 5.0.10018.0 to use dsc_resource."]
a.failure_message Chef::Exceptions::ProviderNotFound,
err
- a.whyrun err + ["Assuming a previous resource installs Powershell 5.0.10018.0 or higher."]
+ a.whyrun err + ["Assuming a previous resource installs PowerShell 5.0.10018.0 or higher."]
a.block_action!
end
requirements.assert(:run) do |a|
diff --git a/lib/chef/provider/dsc_script.rb b/lib/chef/provider/dsc_script.rb
index fd20f34786..4a44a9ea23 100644
--- a/lib/chef/provider/dsc_script.rb
+++ b/lib/chef/provider/dsc_script.rb
@@ -63,11 +63,11 @@ class Chef
err = [
"Could not find PowerShell DSC support on the system",
powershell_info_str,
- "Powershell 4.0 or higher was not detected on your system and is required to use the dsc_script resource.",
+ "PowerShell 4.0 or higher was not detected on your system and is required to use the dsc_script resource.",
]
a.assertion { supports_dsc? }
a.failure_message Chef::Exceptions::ProviderNotFound, err.join(" ")
- a.whyrun err + ["Assuming a previous resource installs Powershell 4.0 or higher."]
+ a.whyrun err + ["Assuming a previous resource installs PowerShell 4.0 or higher."]
a.block_action!
end
end
@@ -175,9 +175,9 @@ class Chef
def powershell_info_str
if run_context && run_context.node[:languages] && run_context.node[:languages][:powershell]
- install_info = "Powershell #{run_context.node[:languages][:powershell][:version]} was found on the system."
+ install_info = "PowerShell #{run_context.node[:languages][:powershell][:version]} was found on the system."
else
- install_info = "Powershell was not found."
+ install_info = "PowerShell was not found."
end
end
end
diff --git a/lib/chef/provider/package/powershell.rb b/lib/chef/provider/package/powershell.rb
index a65146b1e3..9af1344138 100644
--- a/lib/chef/provider/package/powershell.rb
+++ b/lib/chef/provider/package/powershell.rb
@@ -37,7 +37,7 @@ class Chef
def define_resource_requirements
super
if powershell_out("$PSVersionTable.PSVersion.Major").stdout.strip.to_i < 5
- raise "Minimum installed Powershell Version required is 5"
+ raise "Minimum installed PowerShell Version required is 5"
end
requirements.assert(:install) do |a|
a.assertion { candidates_exist_for_all_uninstalled? }
diff --git a/lib/chef/provider/powershell_script.rb b/lib/chef/provider/powershell_script.rb
index 31521c3675..529ae409d8 100644
--- a/lib/chef/provider/powershell_script.rb
+++ b/lib/chef/provider/powershell_script.rb
@@ -129,7 +129,7 @@ EOH
"-NonInteractive",
"-NoProfile",
"-ExecutionPolicy #{execution_policy}",
- # Powershell will hang if STDIN is redirected
+ # PowerShell will hang if STDIN is redirected
# http://connect.microsoft.com/PowerShell/feedback/details/572313/powershell-exe-can-hang-if-stdin-is-redirected
"-InputFormat None",
]
@@ -137,10 +137,10 @@ EOH
# A wrapper script is used to launch user-supplied script while
# still obtaining useful process exit codes. Unless you
- # explicitly call exit in Powershell, the powershell.exe
+ # explicitly call exit in PowerShell, the powershell.exe
# interpreter returns only 0 for success or 1 for failure. Since
# we'd like to get specific exit codes from executable tools run
- # with Powershell, we do some work using the automatic variables
+ # with PowerShell, we do some work using the automatic variables
# $? and $LASTEXITCODE to return the process exit code of the
# last process run in the script if it is the last command
# executed, otherwise 0 or 1 based on whether $? is set to true
diff --git a/lib/chef/resource/apt_package.rb b/lib/chef/resource/apt_package.rb
index 4738d0cbbe..3f4a36489d 100644
--- a/lib/chef/resource/apt_package.rb
+++ b/lib/chef/resource/apt_package.rb
@@ -31,6 +31,7 @@ class Chef
desired_state: false
property :overwrite_config_files, [TrueClass, FalseClass],
+ introduced: "14.0",
description: "Overwrite existing config files with those in the package if prompted by apt.",
default: false
diff --git a/lib/chef/resource/apt_repository.rb b/lib/chef/resource/apt_repository.rb
index a0d24a646b..7ff337ec7c 100644
--- a/lib/chef/resource/apt_repository.rb
+++ b/lib/chef/resource/apt_repository.rb
@@ -36,7 +36,7 @@ class Chef
regex: [/^[^\/]+$/],
description: "The name of the repository to configure, if it differs from the name of the resource block. The value of this setting must not contain spaces.",
validation_message: "repo_name property cannot contain a forward slash '/'",
- name_property: true
+ introduced: "14.1", name_property: true
property :uri, String,
description: "The base of the Debian distribution."
diff --git a/lib/chef/resource/build_essential.rb b/lib/chef/resource/build_essential.rb
index 7c549fb236..99722b14ed 100644
--- a/lib/chef/resource/build_essential.rb
+++ b/lib/chef/resource/build_essential.rb
@@ -29,7 +29,7 @@ class Chef
property :name, String, default: ""
property :compile_time, [TrueClass, FalseClass],
- description: "Install build essential packages at compile time.",
+ description: "Install the build essential packages at compile time.",
default: false
action :install do
@@ -38,22 +38,22 @@ class Chef
case node["platform_family"]
when "debian"
- declare_resource(:package, %w{ autoconf binutils-doc bison build-essential flex gettext ncurses-dev })
+ package %w{ autoconf binutils-doc bison build-essential flex gettext ncurses-dev }
when "amazon", "fedora", "rhel"
- declare_resource(:package, %w{ autoconf bison flex gcc gcc-c++ gettext kernel-devel make m4 ncurses-devel patch })
+ package %w{ autoconf bison flex gcc gcc-c++ gettext kernel-devel make m4 ncurses-devel patch }
# Ensure GCC 4 is available on older pre-6 EL
- declare_resource(:package, %w{ gcc44 gcc44-c++ }) if platform_family?("rhel") && node["platform_version"].to_i < 6
+ package %w{ gcc44 gcc44-c++ } if platform_family?("rhel") && node["platform_version"].to_i < 6
when "freebsd"
- declare_resource(:package, "devel/gmake")
- declare_resource(:package, "devel/autoconf")
- declare_resource(:package, "devel/m4")
- declare_resource(:package, "devel/gettext")
+ package "devel/gmake"
+ package "devel/autoconf"
+ package "devel/m4"
+ package "devel/gettext"
when "mac_os_x"
unless xcode_cli_installed?
# This script was graciously borrowed and modified from Tim Sutton's
# osx-vm-templates at https://github.com/timsutton/osx-vm-templates/blob/b001475df54a9808d3d56d06e71b8fa3001fff42/scripts/xcode-cli-tools.sh
- declare_resource(:execute, "install XCode Command Line tools") do
+ execute "install XCode Command Line tools" do
command <<-EOH.gsub(/^ {14}/, "")
# create the placeholder file that's checked by CLI updates' .dist code
# in Apple's SUS catalog
@@ -68,46 +68,46 @@ class Chef
end
end
when "omnios"
- declare_resource(:package, "developer/gcc48")
- declare_resource(:package, "developer/object-file")
- declare_resource(:package, "developer/linker")
- declare_resource(:package, "developer/library/lint")
- declare_resource(:package, "developer/build/gnu-make")
- declare_resource(:package, "system/header")
- declare_resource(:package, "system/library/math/header-math")
+ package "developer/gcc48"
+ package "developer/object-file"
+ package "developer/linker"
+ package "developer/library/lint"
+ package "developer/build/gnu-make"
+ package "system/header"
+ package "system/library/math/header-math"
# Per OmniOS documentation, the gcc bin dir isn't in the default
# $PATH, so add it to the running process environment
# http://omnios.omniti.com/wiki.php/DevEnv
ENV["PATH"] = "#{ENV['PATH']}:/opt/gcc-4.7.2/bin"
when "solaris2"
- declare_resource(:package, "autoconf")
- declare_resource(:package, "automake")
- declare_resource(:package, "bison")
- declare_resource(:package, "gnu-coreutils")
- declare_resource(:package, "flex")
- declare_resource(:package, "gcc") do
+ package "autoconf"
+ package "automake"
+ package "bison"
+ package "gnu-coreutils"
+ package "flex"
+ package "gcc" do
# lock because we don't use 5 yet
version "4.8.2"
end
- declare_resource(:package, "gcc-3")
- declare_resource(:package, "gnu-grep")
- declare_resource(:package, "gnu-make")
- declare_resource(:package, "gnu-patch")
- declare_resource(:package, "gnu-tar")
- declare_resource(:package, "make")
- declare_resource(:package, "pkg-config")
- declare_resource(:package, "ucb")
+ package "gcc-3"
+ package "gnu-grep"
+ package "gnu-make"
+ package "gnu-patch"
+ package "gnu-tar"
+ package "make"
+ package "pkg-config"
+ package "ucb"
when "smartos"
- declare_resource(:package, "autoconf")
- declare_resource(:package, "binutils")
- declare_resource(:package, "build-essential")
- declare_resource(:package, "gcc47")
- declare_resource(:package, "gmake")
- declare_resource(:package, "pkg-config")
+ package "autoconf"
+ package "binutils"
+ package "build-essential"
+ package "gcc47"
+ package "gmake"
+ package "pkg-config"
when "suse"
- declare_resource(:package, %w{ autoconf bison flex gcc gcc-c++ kernel-default-devel make m4 })
- declare_resource(:package, %w{ gcc48 gcc48-c++ }) if node["platform_version"].to_i < 12
+ package %w{ autoconf bison flex gcc gcc-c++ kernel-default-devel make m4 }
+ package %w{ gcc48 gcc48-c++ } if node["platform_version"].to_i < 12
else
Chef::Log.warn <<-EOH
The build_essential resource does not currently support the '#{node['platform_family']}'
diff --git a/lib/chef/resource/chef_gem.rb b/lib/chef/resource/chef_gem.rb
index 3304690901..0a1b2ef736 100644
--- a/lib/chef/resource/chef_gem.rb
+++ b/lib/chef/resource/chef_gem.rb
@@ -37,10 +37,13 @@ class Chef
resource_name :chef_gem
property :gem_binary, default: "#{RbConfig::CONFIG['bindir']}/gem",
+ description: "The path of a gem binary to use for the installation. By default, the same version of Ruby that is used by the chef-client will be installed.",
callbacks: {
"The chef_gem resource is restricted to the current gem environment, use gem_package to install to other environments." => proc { |v| v == "#{RbConfig::CONFIG['bindir']}/gem" },
}
- property :compile_time, [TrueClass, FalseClass], default: false, desired_state: false
+ property :compile_time, [TrueClass, FalseClass],
+ description: "Controls the phase during which a gem is installed on a node. Set to 'true' to install a gem while the resource collection is being built (the 'compile phase'). Set to 'false' to install a gem while the chef-client is configuring the node (the 'converge phase').",
+ default: false, desired_state: false
# force the resource to compile time if the compile time property has been set
def after_created
diff --git a/lib/chef/resource/chocolatey_package.rb b/lib/chef/resource/chocolatey_package.rb
index 0aa8a41613..c7d5a8a680 100644
--- a/lib/chef/resource/chocolatey_package.rb
+++ b/lib/chef/resource/chocolatey_package.rb
@@ -43,7 +43,8 @@ class Chef
property :returns, [Integer, Array],
description: "The exit code(s) returned a chocolatey package that indicate success.",
- default: [ 0 ], desired_state: false
+ default: [ 0 ], desired_state: false,
+ introduced: "12.18"
end
end
end
diff --git a/lib/chef/resource/directory.rb b/lib/chef/resource/directory.rb
index 1f18a4b951..c585985291 100644
--- a/lib/chef/resource/directory.rb
+++ b/lib/chef/resource/directory.rb
@@ -40,8 +40,12 @@ class Chef
default_action :create
allowed_actions :create, :delete
- property :path, String, name_property: true, identity: true
- property :recursive, [ TrueClass, FalseClass ], default: false
+ property :path, String, name_property: true, identity: true,
+ description: "The path to the directory. Using a fully qualified path is recommended, but is not always required."
+
+ property :recursive, [ TrueClass, FalseClass ],
+ description: "Create or delete parent directories recursively. For the owner, group, and mode properties, the value of this attribute applies only to the leaf directory.",
+ default: false
end
end
end
diff --git a/lib/chef/resource/dmg_package.rb b/lib/chef/resource/dmg_package.rb
index af0bc341b4..7442a8f455 100644
--- a/lib/chef/resource/dmg_package.rb
+++ b/lib/chef/resource/dmg_package.rb
@@ -23,10 +23,7 @@ class Chef
resource_name :dmg_package
provides(:dmg_package) { true }
- description "Use the dmg_package resource to install a dmg 'package'. The resource will retrieve the"\
- " dmg file from a remote URL, mount it using OS X's hdidutil, copy the application (.app directory)"\
- " to the specified destination (/Applications), and detach the image using hdiutil. The dmg file"\
- " will be stored in the Chef::Config[:file_cache_path]."
+ description "Use the dmg_package resource to install a dmg 'package'. The resource will retrieve the dmg file from a remote URL, mount it using OS X's hdidutil, copy the application (.app directory) to the specified destination (/Applications), and detach the image using hdiutil. The dmg file will be stored in the Chef::Config[:file_cache_path]."
introduced "14.0"
property :app, String,
diff --git a/lib/chef/resource/dnf_package.rb b/lib/chef/resource/dnf_package.rb
index 13bdc5065e..3b40a6dffb 100644
--- a/lib/chef/resource/dnf_package.rb
+++ b/lib/chef/resource/dnf_package.rb
@@ -40,36 +40,33 @@ class Chef
provides :dnf_package
- description "Use the dnf_package resource to install, upgrade, and remove packages"\
- " with DNF for Fedora platforms. The dnf_package resource is able to"\
- " resolve provides data for packages much like DNF can do when it is"\
- " run from the command line. This allows a variety of options for"\
- " installing packages, like minimum versions, virtual provides,"\
- " and library names."
+ description "Use the dnf_package resource to install, upgrade, and remove packages with DNF for Fedora platforms. The dnf_package resource is able to resolve provides data for packages much like DNF can do when it is run from the command line. This allows a variety of options for installing packages, like minimum versions, virtual provides and library names."
introduced "12.18"
allowed_actions :install, :upgrade, :remove, :purge, :reconfig, :lock, :unlock, :flush_cache
# Install a specific arch
- property :arch, [String, Array], coerce: proc { |x| [x].flatten }
+ property :arch, [String, Array],
+ description: "The architecture of the package to be installed or upgraded. This value can also be passed as part of the package name.",
+ coerce: proc { |x| [x].flatten }
# Flush the in-memory available/installed cache, this does not flush the dnf caches on disk
- property :flush_cache,
- Hash,
- default: { before: false, after: false },
- coerce: proc { |v|
- if v.is_a?(Hash)
- v
- elsif v.is_a?(Array)
- v.each_with_object({}) { |arg, obj| obj[arg] = true }
- elsif v.is_a?(TrueClass) || v.is_a?(FalseClass)
- { before: v, after: v }
- elsif v == :before
- { before: true, after: false }
- elsif v == :after
- { after: true, before: false }
- end
- }
+ property :flush_cache, Hash,
+ 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 chef-client creates a copy of the local cache, and then stores it in-memory during the chef-client run. The in-memory cache allows packages to be installed during the chef-client run without the need to continue synchronizing the remote metadata to the local cache while the chef-client run is in-progress.",
+ default: { before: false, after: false },
+ coerce: proc { |v|
+ if v.is_a?(Hash)
+ v
+ elsif v.is_a?(Array)
+ v.each_with_object({}) { |arg, obj| obj[arg] = true }
+ elsif v.is_a?(TrueClass) || v.is_a?(FalseClass)
+ { before: v, after: v }
+ elsif v == :before
+ { before: true, after: false }
+ elsif v == :after
+ { after: true, before: false }
+ end
+ }
def allow_downgrade(arg = nil)
if !arg.nil?
diff --git a/lib/chef/resource/dpkg_package.rb b/lib/chef/resource/dpkg_package.rb
index e60764ba8d..742b291508 100644
--- a/lib/chef/resource/dpkg_package.rb
+++ b/lib/chef/resource/dpkg_package.rb
@@ -24,9 +24,7 @@ class Chef
resource_name :dpkg_package
provides :dpkg_package
- description "Use the dpkg_package resource to manage packages for the dpkg platform."\
- " When a package is installed from a local file, it must be added to the"\
- " node using the remote_file or cookbook_file resources."
+ description "Use the dpkg_package resource to manage packages for the dpkg platform. When a package is installed from a local file, it must be added to the node using the remote_file or cookbook_file resources."
property :source, [ String, Array, nil ],
description: "The path to a package in the local file system."
diff --git a/lib/chef/resource/dsc_resource.rb b/lib/chef/resource/dsc_resource.rb
index 8381698dc1..06c4103bc3 100644
--- a/lib/chef/resource/dsc_resource.rb
+++ b/lib/chef/resource/dsc_resource.rb
@@ -23,10 +23,7 @@ class Chef
resource_name :dsc_resource
provides :dsc_resource
- description "The dsc_resource resource allows any DSC resource to be used in a"\
- " Chef recipe, as well as any custom resources that have been added"\
- " to your Windows PowerShell environment. Microsoft frequently adds"\
- " new resources to the DSC resource collection."
+ description "The dsc_resource resource allows any DSC resource to be used in a Chef recipe, as well as any custom resources that have been added to your Windows PowerShell environment. Microsoft frequently adds new resources to the DSC resource collection."
introduced "12.2"
# This class will check if the object responds to
@@ -76,7 +73,7 @@ class Chef
property :module_version, String,
introduced: "12.21",
- description: "The version number of the module to use. Powershell 5.0.10018.0 (or higher) supports having multiple versions of a module installed. This should be specified along with the module_name."
+ description: "The version number of the module to use. PowerShell 5.0.10018.0 (or higher) supports having multiple versions of a module installed. This should be specified along with the module_name."
def property(property_name, value = nil)
if not property_name.is_a?(Symbol)
diff --git a/lib/chef/resource/dsc_script.rb b/lib/chef/resource/dsc_script.rb
index e941e4e918..d98c74ccc3 100644
--- a/lib/chef/resource/dsc_script.rb
+++ b/lib/chef/resource/dsc_script.rb
@@ -28,14 +28,7 @@ class Chef
resource_name :dsc_script
provides :dsc_script
- description "Many DSC resources are comparable to built-in Chef resources. For"\
- " example, both DSC and Chef 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 Chef, 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"\
- " Chef recipe."
+ description "Many DSC resources are comparable to built-in Chef resources. For example, both DSC and Chef 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 Chef, 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 Chef recipe."
default_action :run
diff --git a/lib/chef/resource/execute.rb b/lib/chef/resource/execute.rb
index 93f8063d5d..1becbf50a7 100644
--- a/lib/chef/resource/execute.rb
+++ b/lib/chef/resource/execute.rb
@@ -98,9 +98,12 @@ class Chef
description: "Windows only: The password of the user specified by the user property. This property is mandatory if user is specified on Windows and may only be specified if user is specified. The sensitive property for this resource will automatically be set to true if password is specified."
# lazy used to set default value of sensitive to true if password is set
- property :sensitive, [ TrueClass, FalseClass ], default: lazy { |r| r.password ? true : false }
+ property :sensitive, [ TrueClass, FalseClass ],
+ description: "Ensure that sensitive resource data is not logged by the chef-client.",
+ default: lazy { |r| r.password ? true : false }
property :elevated, [ TrueClass, FalseClass ], default: false,
+ 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 Chef 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.",
introduced: "13.3"
def self.set_guard_inherited_attributes(*inherited_attributes)
diff --git a/lib/chef/resource/git.rb b/lib/chef/resource/git.rb
index 7e756db78f..d0a78adc0e 100644
--- a/lib/chef/resource/git.rb
+++ b/lib/chef/resource/git.rb
@@ -21,11 +21,11 @@ require "chef/resource/scm"
class Chef
class Resource
class Git < Chef::Resource::Scm
- description "Use the git resource to manage source control resources that exist"\
- " in a git repository. git version 1.6.5 (or higher) is required to"\
- " use all of the functionality in the git resource."
+ description "Use the git resource to manage source control resources that exist in a git repository. git version 1.6.5 (or higher) is required to use all of the functionality in the git resource."
- property :additional_remotes, Hash, default: lazy { Hash.new }
+ property :additional_remotes, Hash,
+ description: "A Hash of additional remotes that are added to the git repository configuration.",
+ default: lazy { Hash.new }
alias :branch :revision
alias :reference :revision
diff --git a/lib/chef/resource/http_request.rb b/lib/chef/resource/http_request.rb
index 6e92fb821c..455d032819 100644
--- a/lib/chef/resource/http_request.rb
+++ b/lib/chef/resource/http_request.rb
@@ -25,9 +25,7 @@ class Chef
resource_name :http_request
provides :http_request
- description "Use the http_request resource to send an HTTP request (GET, PUT,"\
- " POST, DELETE, HEAD, or OPTIONS) with an arbitrary message. This"\
- " resource is often useful when custom callbacks are necessary."
+ description "Use the http_request resource to send an HTTP request (GET, PUT, POST, DELETE, HEAD, or OPTIONS) with an arbitrary message. This resource is often useful when custom callbacks are necessary."
default_action :get
allowed_actions :get, :patch, :put, :post, :delete, :head, :options
diff --git a/lib/chef/resource/locale.rb b/lib/chef/resource/locale.rb
new file mode 100644
index 0000000000..01a4577c43
--- /dev/null
+++ b/lib/chef/resource/locale.rb
@@ -0,0 +1,92 @@
+#
+# Copyright:: 2011-2016, Heavy Water Software Inc.
+# Copyright:: 2016-2018, Chef Software Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific slanguage governing permissions and
+# limitations under the License.
+#
+
+require "chef/resource"
+
+class Chef
+ class Resource
+ class Locale < Chef::Resource
+ preview_resource true
+ resource_name :locale
+
+ description "Use the locale resource to set the system's locale"
+ introduced "14.5"
+
+ property :lang, String,
+ default: "en_US.utf8",
+ description: "Sets the default system language."
+ property :lc_all, String,
+ default: "en_US.utf8",
+ description: "Sets the fallback system language."
+
+ action :update do
+ description "Updates the system locale"
+ if node["init_package"] == "systemd"
+ # on systemd settings LC_ALL is (correctly) reserved only for testing and cannot be set globally
+ execute "localectl set-locale LANG=#{new_resource.lang}" do
+ # RHEL uses /etc/locale.conf
+ not_if { up_to_date?("/etc/locale.conf", new_resource.lang) } if ::File.exist?("/etc/locale.conf")
+ # Ubuntu 16.04 still uses /etc/default/locale
+ not_if { up_to_date?("/etc/default/locale", new_resource.lang) } if ::File.exist?("/etc/default/locale")
+ end
+ elsif ::File.exist?("/etc/sysconfig/i18n")
+ locale_file_path = "/etc/sysconfig/i18n"
+
+ updated = up_to_date?(locale_file_path, new_resource.lang, new_resource.lc_all)
+
+ file locale_file_path do
+ content lazy {
+ locale = IO.read(locale_file_path)
+ variables = Hash[locale.lines.map { |line| line.strip.split("=") }]
+ variables["LANG"] = new_resource.lang
+ variables["LC_ALL"] =
+ variables.map { |pairs| pairs.join("=") }.join("\n") + "\n"
+ }
+ not_if { updated }
+ end
+
+ execute "reload root's lang profile script" do
+ command "source source /etc/sysconfig/i18n; source /etc/profile.d/lang.sh"
+ not_if { updated }
+ end
+ elsif ::File.exist?("/usr/sbin/update-locale")
+ execute "Generate locales" do
+ command "locale-gen"
+ not_if { up_to_date?("/etc/default/locale", new_resource.lang, new_resource.lc_all) }
+ end
+
+ execute "Update locale" do
+ command "update-locale LANG=#{new_resource.lang} LC_ALL=#{new_resource.lc_all}"
+ not_if { up_to_date?("/etc/default/locale", new_resource.lang, new_resource.lc_all) }
+ end
+ else
+ raise "#{node["platform"]} platform not supported by the chef locale resource."
+ end
+ end
+
+ action_class do
+ def up_to_date?(file_path, lang, lc_all = nil)
+ locale = IO.read(file_path)
+ locale.include?("LANG=#{lang}") &&
+ (node["init_package"] == "systemd" || lc_all.nil? || locale.include?("LC_ALL=#{lc_all}"))
+ rescue
+ false
+ end
+ end
+ end
+ end
+end
diff --git a/lib/chef/resource/macos_userdefaults.rb b/lib/chef/resource/macos_userdefaults.rb
index 3cf44eb161..f2ad5a0213 100644
--- a/lib/chef/resource/macos_userdefaults.rb
+++ b/lib/chef/resource/macos_userdefaults.rb
@@ -25,9 +25,7 @@ class Chef
provides(:mac_os_x_userdefaults) { true }
provides(:macos_userdefaults) { true }
- description "Use the macos_userdefaults resource to manage the macOS user defaults system. The properties"\
- " of this resource are passed to the defaults command, and the parameters follow the convention"\
- " of that command. See the defaults(1) man page for details on how the tool works."
+ description "Use the macos_userdefaults resource to manage the macOS user defaults system. The properties of this resource are passed to the defaults command, and the parameters follow the convention of that command. See the defaults(1) man page for details on how the tool works."
introduced "14.0"
property :domain, String,
@@ -57,8 +55,8 @@ class Chef
default: false,
desired_state: false
+ # @todo this should get refactored away: https://github.com/chef/chef/issues/7622
property :is_set, [TrueClass, FalseClass],
- description: "",
default: false,
desired_state: false
diff --git a/lib/chef/resource/macosx_service.rb b/lib/chef/resource/macosx_service.rb
index 8fa8fd7a36..deff6e1927 100644
--- a/lib/chef/resource/macosx_service.rb
+++ b/lib/chef/resource/macosx_service.rb
@@ -31,9 +31,8 @@ class Chef
state_attrs :enabled, :running
- # This will enable user to pass a plist in the case
- # that the filename and label for the service dont match
- property :plist, String
+ property :plist, String,
+ description: "A plist to use in the case where the filename and label for the service do not match."
property :session_type, String
diff --git a/lib/chef/resource/mount.rb b/lib/chef/resource/mount.rb
index dffb96cb53..68ecee2335 100644
--- a/lib/chef/resource/mount.rb
+++ b/lib/chef/resource/mount.rb
@@ -29,32 +29,59 @@ class Chef
# this is a poor API please do not re-use this pattern
property :supports, Hash,
- default: lazy { { remount: false } },
- coerce: proc { |x| x.is_a?(Array) ? x.each_with_object({}) { |i, m| m[i] = true } : x }
+ description: "Specify a Hash of supported mount features.",
+ default: lazy { { remount: false } },
+ coerce: proc { |x| x.is_a?(Array) ? x.each_with_object({}) { |i, m| m[i] = true } : x }
- property :password, String, sensitive: true
+ property :password, String,
+ description: "Windows only:. Use to specify the password for username.",
+ sensitive: true
- property :mount_point, String, name_property: true
- property :device, String, identity: true
+ property :mount_point, String, name_property: true,
+ description: "The directory (or path) in which the device is to be mounted. Defaults to the name of the resource block if not provided."
+
+ property :device, String, identity: true,
+ description: "Required for :umount and :remount actions (for the purpose of checking the mount command output for presence). The special block device or remote node, a label, or a uuid to be mounted."
property :device_type, [String, Symbol],
- coerce: proc { |arg| arg.kind_of?(String) ? arg.to_sym : arg },
- default: :device,
- equal_to: RUBY_PLATFORM =~ /solaris/i ? %i{ device } : %i{ device label uuid }
+ description: "The type of device: :device, :label, or :uuid",
+ coerce: proc { |arg| arg.kind_of?(String) ? arg.to_sym : arg },
+ default: :device,
+ equal_to: RUBY_PLATFORM =~ /solaris/i ? %i{ device } : %i{ device label uuid }
+
+ # @todo this should get refactored away: https://github.com/chef/chef/issues/7621
+ property :mounted, [TrueClass, FalseClass], default: false
- property :fsck_device, String, default: "-"
- property :fstype, [String, nil], default: "auto"
+ property :fsck_device, String,
+ description: "Solaris only: The fsck device.",
+ default: "-"
+
+ property :fstype, [String, nil],
+ description: "The file system type (fstype) of the device.",
+ default: "auto"
property :options, [Array, String, nil],
- coerce: proc { |arg| arg.kind_of?(String) ? arg.split(",") : arg },
- default: %w{defaults}
+ description: "An array or comma separated list of options for the mount.",
+ coerce: proc { |arg| arg.kind_of?(String) ? arg.split(",") : arg },
+ default: %w{defaults}
- property :dump, [Integer, FalseClass], default: 0
- property :pass, [Integer, FalseClass], default: 2
- property :mounted, [TrueClass, FalseClass], default: false
- property :enabled, [TrueClass, FalseClass], default: false
- property :username, String
- property :domain, String
+ property :dump, [Integer, FalseClass],
+ description: "The dump frequency (in days) used while creating a file systems table (fstab) entry.",
+ default: 0
+
+ property :pass, [Integer, FalseClass],
+ description: "The pass number used by the file system check (fsck) command while creating a file systems table (fstab) entry.",
+ default: 2
+
+ property :enabled, [TrueClass, FalseClass],
+ description: "Use to specify if a mounted file system is enabled.",
+ default: false
+
+ property :username, String,
+ description: "Windows only: Use to specify the user name."
+
+ property :domain, String,
+ description: "Windows only: Use to specify the domain in which the username and password are located."
private
diff --git a/lib/chef/resource/msu_package.rb b/lib/chef/resource/msu_package.rb
index 85ab170ee0..9fd39491c9 100644
--- a/lib/chef/resource/msu_package.rb
+++ b/lib/chef/resource/msu_package.rb
@@ -34,13 +34,16 @@ class Chef
default_action :install
property :source, String,
- coerce: (proc do |s|
- unless s.nil?
- uri_scheme?(s) ? s : Chef::Util::PathHelper.canonical_path(s, false)
- end
- end),
- default: lazy { |r| r.package_name }
- property :checksum, String, desired_state: false
+ description: "The local file path or URL for the MSU package.",
+ coerce: (proc do |s|
+ unless s.nil?
+ uri_scheme?(s) ? s : Chef::Util::PathHelper.canonical_path(s, false)
+ end
+ end),
+ default: lazy { |r| r.package_name }
+
+ property :checksum, String, desired_state: false,
+ description: "SHA-256 digest used to verify the checksum of the downloaded MSU package."
end
end
end
diff --git a/lib/chef/resource/ohai.rb b/lib/chef/resource/ohai.rb
index b286412434..6cd60de9f4 100644
--- a/lib/chef/resource/ohai.rb
+++ b/lib/chef/resource/ohai.rb
@@ -25,11 +25,9 @@ class Chef
resource_name :ohai
provides :ohai
- description "Use the ohai resource to reload the Ohai configuration on a node."\
- " This allows recipes that change system attributes (like a recipe"\
- " that adds a user) to refer to those attributes later on during the chef-client run."
+ description "Use the ohai resource to reload the Ohai configuration on a node. This allows recipes that change system attributes (like a recipe that adds a user) to refer to those attributes later on during the chef-client run."
- property :ohai_name, name_property: true
+ property :ohai_name, name_property: true, introduced: "12.17"
property :plugin, String
default_action :reload
diff --git a/lib/chef/resource/osx_profile.rb b/lib/chef/resource/osx_profile.rb
index 612ff637e4..90166cc338 100644
--- a/lib/chef/resource/osx_profile.rb
+++ b/lib/chef/resource/osx_profile.rb
@@ -25,19 +25,24 @@ class Chef
provides :osx_profile
provides :osx_config_profile
- description "Use the osx_profile resource to manage configuration profiles (.mobileconfig files)"\
- " on the macOS platform. The osx_profile resource installs profiles by using"\
- " the uuidgen library to generate a unique ProfileUUID, and then using the"\
- " profiles command to install the profile on the system."
+ description "Use the osx_profile resource to manage configuration profiles (.mobileconfig files) on the macOS platform. The osx_profile resource installs profiles by using the uuidgen library to generate a unique ProfileUUID, and then using the profiles command to install the profile on the system."
introduced "12.7"
default_action :install
allowed_actions :install, :remove
- property :profile_name, String, name_property: true, identity: true
- property :profile, [ String, Hash ]
- property :identifier, String
- property :path, String
+ property :profile_name, String,
+ description: "Use to specify the name of the profile, if different from the name of the resource block.",
+ name_property: true, identity: true
+
+ property :profile, [ String, Hash ],
+ description: "Use to specify a profile. This may be the name of a profile contained in a cookbook or a Hash that contains the contents of the profile."
+
+ property :identifier, String,
+ description: "Use to specify the identifier for the profile, such as com.company.screensaver."
+
+ property :path, String,
+ description: "The path to write the profile to disk before loading it."
end
end
end
diff --git a/lib/chef/resource/package.rb b/lib/chef/resource/package.rb
index bbad5f7696..8954478ee3 100644
--- a/lib/chef/resource/package.rb
+++ b/lib/chef/resource/package.rb
@@ -53,12 +53,12 @@ class Chef
coerce: proc { |x| x.is_a?(String) ? x.shellsplit : x }
property :response_file, String,
- description: "",
+ description: "The direct path to the file used to pre-seed a package.",
desired_state: false
property :response_file_variables, Hash,
- description: "",
- default: lazy { {} }, desired_state: false
+ description: "A Hash of response file variables in the form of {'VARIABLE' => 'VALUE'}.",
+ default: lazy { Hash.new }, desired_state: false
property :source, String,
description: "The direct path to a the package on the host.",
diff --git a/lib/chef/resource/paludis_package.rb b/lib/chef/resource/paludis_package.rb
index 722163254f..f7f9187826 100644
--- a/lib/chef/resource/paludis_package.rb
+++ b/lib/chef/resource/paludis_package.rb
@@ -30,7 +30,9 @@ class Chef
allowed_actions :install, :remove, :upgrade
- property :timeout, default: 3600
+ property :timeout, Integer,
+ description: "The amount of time (in seconds) to wait before timing out.",
+ default: 3600
end
end
end
diff --git a/lib/chef/resource/portage_package.rb b/lib/chef/resource/portage_package.rb
index 43b0cfc74d..5e954581c7 100644
--- a/lib/chef/resource/portage_package.rb
+++ b/lib/chef/resource/portage_package.rb
@@ -26,7 +26,8 @@ class Chef
description "Use the portage_package resource to manage packages for the Gentoo platform."
- property :timeout, default: 3600
+ property :timeout, default: 3600,
+ description: "The amount of time (in seconds) to wait before timing out."
end
end
end
diff --git a/lib/chef/resource/powershell_package.rb b/lib/chef/resource/powershell_package.rb
index ba5a03ef8b..91e300584f 100644
--- a/lib/chef/resource/powershell_package.rb
+++ b/lib/chef/resource/powershell_package.rb
@@ -26,19 +26,27 @@ class Chef
resource_name :powershell_package
provides :powershell_package
- description "Use the powershell_package resource to install and manage packages via"\
- " the Powershell Package Manager for the Microsoft Windows platform. The"\
- " powershell_package resource requires administrative access, and a source"\
- " must be configured in the Powershell Package Manager via the Register-PackageSource command"
+ description "Use the powershell_package resource to install and manage packages via the PowerShell Package Manager for the Microsoft Windows platform. The powershell_package resource requires administrative access, and a source must be configured in the PowerShell Package Manager via the Register-PackageSource command"
introduced "12.16"
allowed_actions :install, :remove
- property :package_name, [String, Array], coerce: proc { |x| [x].flatten }
- property :version, [String, Array], coerce: proc { |x| [x].flatten }
- property :source, [String]
- property :skip_publisher_check, [true, false], default: false, introduced: "14.3",
- description: "Skip validating module author."
+ property :package_name, [String, Array],
+ description: "The name of the package. Default value: the name of the resource block.",
+ coerce: proc { |x| [x].flatten }
+
+ property :version, [String, Array],
+ description: "The version of a package to be installed or upgraded.",
+ coerce: proc { |x| [x].flatten }
+
+ property :source, String,
+ description: "Specify the source of the package.",
+ introduced: "14.0"
+
+ property :skip_publisher_check, [true, false],
+ description: "Skip validating module author.",
+ default: false, introduced: "14.3"
+
end
end
end
diff --git a/lib/chef/resource/powershell_package_source.rb b/lib/chef/resource/powershell_package_source.rb
index 1ed3b895a1..b3bad41f65 100644
--- a/lib/chef/resource/powershell_package_source.rb
+++ b/lib/chef/resource/powershell_package_source.rb
@@ -24,7 +24,7 @@ class Chef
preview_resource true
resource_name "powershell_package_source"
- description "Use the powershell_package_source resource to register a powershell package repository."
+ description "Use the powershell_package_source resource to register a PowerShell package repository."
introduced "14.3"
property :source_name, String,
diff --git a/lib/chef/resource/reboot.rb b/lib/chef/resource/reboot.rb
index bc649bee09..b9f748978f 100644
--- a/lib/chef/resource/reboot.rb
+++ b/lib/chef/resource/reboot.rb
@@ -34,8 +34,13 @@ class Chef
allowed_actions :request_reboot, :reboot_now, :cancel
default_action :nothing # make sure people are quite clear what they want
- property :reason, String, default: "Reboot by Chef"
- property :delay_mins, Integer, default: 0
+ property :reason, String,
+ description: "A string that describes the reboot action.",
+ default: "Reboot by Chef"
+
+ property :delay_mins, Integer,
+ description: "The amount of time (in minutes) to delay a reboot request.",
+ default: 0
end
end
end
diff --git a/lib/chef/resource/route.rb b/lib/chef/resource/route.rb
index b64dcf26c6..8c14394ace 100644
--- a/lib/chef/resource/route.rb
+++ b/lib/chef/resource/route.rb
@@ -28,7 +28,7 @@ class Chef
description "Use the route resource to manage the system routing table in a Linux environment."
property :target, String, identity: true, name_property: true
- property :comment, [String, nil]
+ property :comment, [String, nil], introduced: "14.0"
property :metric, [Integer, nil]
property :netmask, [String, nil]
property :gateway, [String, nil]
diff --git a/lib/chef/resource/systemd_unit.rb b/lib/chef/resource/systemd_unit.rb
index a4c3c3f180..fe4d88ccd2 100644
--- a/lib/chef/resource/systemd_unit.rb
+++ b/lib/chef/resource/systemd_unit.rb
@@ -52,7 +52,8 @@ class Chef
default: true, desired_state: false
property :unit_name, String, desired_state: false,
identity: true,
- name_property: true
+ name_property: true,
+ introduced: "13.7"
def to_ini
case content
diff --git a/lib/chef/resource/windows_ad_join.rb b/lib/chef/resource/windows_ad_join.rb
index d2848c71cd..8d864840d3 100644
--- a/lib/chef/resource/windows_ad_join.rb
+++ b/lib/chef/resource/windows_ad_join.rb
@@ -52,6 +52,9 @@ class Chef
description: "Controls the system reboot behavior post domain joining. Reboot immediately, after the Chef run completes, or never. Note that a reboot is necessary for changes to take effect.",
default: :immediate
+ property :new_name, String,
+ description: "Specifies a new name for the computer in the new domain."
+
# define this again so we can default it to true. Otherwise failures print the password
property :sensitive, [TrueClass, FalseClass],
default: true
@@ -64,6 +67,7 @@ class Chef
cmd << "$credential = New-Object System.Management.Automation.PSCredential (\"#{new_resource.domain_user}\",$pswd);"
cmd << "Add-Computer -DomainName #{new_resource.domain_name} -Credential $credential"
cmd << " -OUPath \"#{new_resource.ou_path}\"" if new_resource.ou_path
+ cmd << " -NewName \"#{new_resource.new_name}\"" if new_resource.new_name
cmd << " -Force"
converge_by("join Active Directory domain #{new_resource.domain_name}") do
diff --git a/lib/chef/resource/windows_font.rb b/lib/chef/resource/windows_font.rb
index 2f61876e9a..4c895321c0 100644
--- a/lib/chef/resource/windows_font.rb
+++ b/lib/chef/resource/windows_font.rb
@@ -29,7 +29,7 @@ class Chef
introduced "14.0"
property :font_name, String,
- description: "The file name of the font file name to install if different than the resource name.",
+ description: "The name of the font file to install, if it differs from the resource name.",
name_property: true
property :source, String,
diff --git a/lib/chef/resource/yum_package.rb b/lib/chef/resource/yum_package.rb
index 905cacc477..f0ea7dbf50 100644
--- a/lib/chef/resource/yum_package.rb
+++ b/lib/chef/resource/yum_package.rb
@@ -38,28 +38,38 @@ class Chef
# its own arguments as unintended side-effects (and why functional languages that don't allow modifcations
# of variables eliminate entire classes of bugs).
# </lecture>
- property :package_name, [ String, Array ], identity: true, coerce: proc { |x| x.is_a?(Array) ? x.to_a : x }
- property :version, [ String, Array ], coerce: proc { |x| x.is_a?(Array) ? x.to_a : x }
- property :arch, [ String, Array ], coerce: proc { |x| x.is_a?(Array) ? x.to_a : x }
+ property :package_name, [ String, Array ],
+ description: "One of the following: the name of a package, the name of a package and its architecture, the name of a dependency.",
+ identity: true, coerce: proc { |x| x.is_a?(Array) ? x.to_a : x }
- property :flush_cache,
- Hash,
- default: { before: false, after: false },
- coerce: proc { |v|
- if v.is_a?(Hash)
- v
- elsif v.is_a?(Array)
- v.each_with_object({}) { |arg, obj| obj[arg] = true }
- elsif v.is_a?(TrueClass) || v.is_a?(FalseClass)
- { before: v, after: v }
- elsif v == :before
- { before: true, after: false }
- elsif v == :after
- { after: true, before: false }
- end
- }
+ property :version, [ String, Array ],
+ description: "The version of a package to be installed or upgraded. This property is ignored when using the ':upgrade' action.",
+ coerce: proc { |x| x.is_a?(Array) ? x.to_a : x }
- property :allow_downgrade, [ true, false ], default: false
+ property :arch, [ String, Array ],
+ description: "The architecture of the package to be installed or upgraded. This value can also be passed as part of the package name.",
+ coerce: proc { |x| x.is_a?(Array) ? x.to_a : x }
+
+ property :flush_cache, Hash,
+ description: "Flush the in-memory cache before or after a Yum operation that installs, upgrades, or removes a package. Accepts a Hash in the form: { :before => true/false, :after => true/false } or an Array in the form [ :before, :after ].\nYum automatically synchronizes remote metadata to a local cache. The chef-client creates a copy of the local cache, and then stores it in-memory during the chef-client run. The in-memory cache allows packages to be installed during the chef-client run without the need to continue synchronizing the remote metadata to the local cache while the chef-client run is in-progress.",
+ default: { before: false, after: false },
+ coerce: proc { |v|
+ if v.is_a?(Hash)
+ v
+ elsif v.is_a?(Array)
+ v.each_with_object({}) { |arg, obj| obj[arg] = true }
+ elsif v.is_a?(TrueClass) || v.is_a?(FalseClass)
+ { before: v, after: v }
+ elsif v == :before
+ { before: true, after: false }
+ elsif v == :after
+ { after: true, before: false }
+ end
+ }
+
+ property :allow_downgrade, [ true, false ],
+ description: "Downgrade a package to satisfy requested version requirements.",
+ default: false
property :yum_binary, String
end
diff --git a/lib/chef/resource/yum_repository.rb b/lib/chef/resource/yum_repository.rb
index ba7fb53ad1..df3bfb6454 100644
--- a/lib/chef/resource/yum_repository.rb
+++ b/lib/chef/resource/yum_repository.rb
@@ -143,7 +143,7 @@ class Chef
name_property: true
property :skip_if_unavailable, [TrueClass, FalseClass],
- description: ""
+ description: "Allow yum to continue if this repository cannot be contacted for any reason."
property :source, String,
description: "Use a custom template source instead of the default one."
diff --git a/lib/chef/resource/zypper_package.rb b/lib/chef/resource/zypper_package.rb
index b04668472f..6caa14c1a3 100644
--- a/lib/chef/resource/zypper_package.rb
+++ b/lib/chef/resource/zypper_package.rb
@@ -28,12 +28,12 @@ class Chef
description "Use the zypper_package resource to install, upgrade, and remove packages with Zypper for the SUSE Enterprise and OpenSUSE platforms."
property :gpg_check, [ TrueClass, FalseClass ],
- description: "Verify the package's GPG signature",
+ description: "Verify the package's GPG signature. Can also be controlled site-wide using the ``zypper_check_gpg`` config option.",
default: lazy { Chef::Config[:zypper_check_gpg] }
property :allow_downgrade, [ TrueClass, FalseClass ],
- description: "",
- default: false
+ description: "Allow downgrading a package to satisfy requested version requirements.",
+ default: false, introduced: "13.6"
end
end
end
diff --git a/lib/chef/resource_inspector.rb b/lib/chef/resource_inspector.rb
index 1559932940..7363aad2a6 100644
--- a/lib/chef/resource_inspector.rb
+++ b/lib/chef/resource_inspector.rb
@@ -56,6 +56,7 @@ module ResourceInspector
acc << { name: n, description: opts[:description],
introduced: opts[:introduced], is: opts[:is],
deprecated: opts[:deprecated] || false,
+ required: opts[:required] || false,
default: get_default(opts[:default]),
name_property: opts[:name_property] || false }
end
diff --git a/lib/chef/resources.rb b/lib/chef/resources.rb
index 43dc8c9e75..d99aeed3ad 100644
--- a/lib/chef/resources.rb
+++ b/lib/chef/resources.rb
@@ -57,6 +57,7 @@ require "chef/resource/kernel_module"
require "chef/resource/ksh"
require "chef/resource/launchd"
require "chef/resource/link"
+require "chef/resource/locale"
require "chef/resource/log"
require "chef/resource/macports_package"
require "chef/resource/macos_userdefaults"
diff --git a/lib/chef/util/powershell/cmdlet.rb b/lib/chef/util/powershell/cmdlet.rb
index 6b9ba7c208..480cc61572 100644
--- a/lib/chef/util/powershell/cmdlet.rb
+++ b/lib/chef/util/powershell/cmdlet.rb
@@ -90,7 +90,7 @@ class Chef
result = run(switches, execution_options, arguments)
if ! result.succeeded?
- raise Chef::Exceptions::PowershellCmdletException, "Powershell Cmdlet failed: #{result.stderr}"
+ raise Chef::Exceptions::PowershellCmdletException, "PowerShell Cmdlet failed: #{result.stderr}"
end
result
diff --git a/lib/chef/version.rb b/lib/chef/version.rb
index 6357f35abc..482d3d85ac 100644
--- a/lib/chef/version.rb
+++ b/lib/chef/version.rb
@@ -23,7 +23,7 @@ require "chef/version_string"
class Chef
CHEF_ROOT = File.expand_path("../..", __FILE__)
- VERSION = Chef::VersionString.new("14.4.63")
+ VERSION = Chef::VersionString.new("14.5.13")
end
#