summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavin Taddeo <davin@chef.io>2020-12-16 19:19:25 -0500
committerDavin Taddeo <davin@chef.io>2020-12-16 19:19:25 -0500
commitc3d209619ef4482473cac55bc0d590bd29129d3d (patch)
treec6ba804070aea785624f4becf38ddb59bc54f7f4 /lib
parent778ef633c566dfa0095fc6ce6b05682d49dc56d6 (diff)
parent8e68b41bde9f85be342108d68d2c78a257c6c8dd (diff)
downloadchef-c3d209619ef4482473cac55bc0d590bd29129d3d.tar.gz
Merge branch 'master' of github.com:chef/chef into windows_security_policy
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/compliance/default_attributes.rb6
-rw-r--r--lib/chef/compliance/runner.rb9
-rw-r--r--lib/chef/knife/core/windows_bootstrap_context.rb2
-rw-r--r--lib/chef/resource/chef_gem.rb4
-rw-r--r--lib/chef/resource/file.rb2
-rw-r--r--lib/chef/resource/gem_package.rb4
-rw-r--r--lib/chef/resource/http_request.rb2
-rw-r--r--lib/chef/resource/locale.rb2
-rw-r--r--lib/chef/resource/mdadm.rb4
-rw-r--r--lib/chef/resource/osx_profile.rb14
-rw-r--r--lib/chef/resource/remote_directory.rb2
-rw-r--r--lib/chef/resource/ruby.rb6
-rw-r--r--lib/chef/resource/ruby_block.rb2
-rw-r--r--lib/chef/version.rb2
14 files changed, 33 insertions, 28 deletions
diff --git a/lib/chef/compliance/default_attributes.rb b/lib/chef/compliance/default_attributes.rb
index eb50c3a5e9..9b368d4f64 100644
--- a/lib/chef/compliance/default_attributes.rb
+++ b/lib/chef/compliance/default_attributes.rb
@@ -83,7 +83,11 @@ class Chef
# The array of results per control will be truncated at this limit to avoid large reports that cannot be
# processed by Chef Automate. A summary of removed results will be sent with each impacted control.
- "control_results_limit" => 50
+ "control_results_limit" => 50,
+
+ # If enabled, a hash representation of the Chef Infra node object will be sent to Chef InSpec in an input
+ # named `chef_node`.
+ "chef_node_attribute_enabled" => false
)
end
end
diff --git a/lib/chef/compliance/runner.rb b/lib/chef/compliance/runner.rb
index 8948d9c895..86344367c2 100644
--- a/lib/chef/compliance/runner.rb
+++ b/lib/chef/compliance/runner.rb
@@ -61,7 +61,6 @@ class Chef
DEPRECATED_CONFIG_VALUES = %w{
attributes_save
- chef_node_attribute_enabled
fail_if_not_present
inspec_gem_source
inspec_version
@@ -93,9 +92,15 @@ class Chef
end
def inspec_opts
+ inputs = node["audit"]["attributes"].to_h
+ if node["audit"]["chef_node_attribute_enabled"]
+ inputs["chef_node"] = node.to_h
+ inputs["chef_node"]["chef_environment"] = node.chef_environment
+ end
+
{
backend_cache: node["audit"]["inspec_backend_cache"],
- inputs: node["audit"]["attributes"],
+ inputs: inputs,
logger: logger,
output: node["audit"]["quiet"] ? ::File::NULL : STDOUT,
report: true,
diff --git a/lib/chef/knife/core/windows_bootstrap_context.rb b/lib/chef/knife/core/windows_bootstrap_context.rb
index 4b40d5bfb9..fa8b43f383 100644
--- a/lib/chef/knife/core/windows_bootstrap_context.rb
+++ b/lib/chef/knife/core/windows_bootstrap_context.rb
@@ -140,7 +140,7 @@ class Chef
end
unless trusted_certs_script.empty?
- client_rb << %Q{trusted_certs_dir "#{ChefConfig::Config.etc_chef_dir(windows: true)}/trusted_certs"\n}
+ client_rb << %Q{trusted_certs_dir "#{ChefConfig::PathHelper.escapepath(ChefConfig::Config.etc_chef_dir(windows: true))}\\\\trusted_certs"\n}
end
if chef_config[:fips]
diff --git a/lib/chef/resource/chef_gem.rb b/lib/chef/resource/chef_gem.rb
index fc23555cbd..2c5b342bce 100644
--- a/lib/chef/resource/chef_gem.rb
+++ b/lib/chef/resource/chef_gem.rb
@@ -49,7 +49,7 @@ class Chef
To install a gem while #{ChefUtils::Dist::Infra::PRODUCT} is configuring the node (the converge phase), set the `compile_time` property to `false`:
```ruby
- chef_gem 'right_aws' do
+ chef_gem 'loofah' do
compile_time false
action :install
end
@@ -57,7 +57,7 @@ class Chef
To install a gem while the resource collection is being built (the compile phase), set the `compile_time` property to `true`:
```ruby
- chef_gem 'right_aws' do
+ chef_gem 'loofah' do
compile_time true
action :install
end
diff --git a/lib/chef/resource/file.rb b/lib/chef/resource/file.rb
index 214f8018ab..b2bba06185 100644
--- a/lib/chef/resource/file.rb
+++ b/lib/chef/resource/file.rb
@@ -32,7 +32,7 @@ class Chef
provides :file
- description "Use the **file** resource to manage files directly on a node."
+ description "Use the **file** resource to manage files directly on a node. Note: Use the **cookbook_file** resource to copy a file from a cookbook's `/files` directory. Use the **template** resource to create a file based on a template in a cookbook's `/templates` directory. And use the **remote_file** resource to transfer a file to a node from a remote location."
if ChefUtils.windows?
# Use Windows rights instead of standard *nix permissions
diff --git a/lib/chef/resource/gem_package.rb b/lib/chef/resource/gem_package.rb
index c893e7a2f9..a3ad5f614b 100644
--- a/lib/chef/resource/gem_package.rb
+++ b/lib/chef/resource/gem_package.rb
@@ -44,8 +44,8 @@ class Chef
**Install a gem file from the local file system**
```ruby
- gem_package 'right_aws' do
- source '/tmp/right_aws-1.11.0.gem'
+ gem_package 'loofah' do
+ source '/tmp/loofah-2.7.0.gem'
action :install
end
```
diff --git a/lib/chef/resource/http_request.rb b/lib/chef/resource/http_request.rb
index de714ab4ab..f53d3e731f 100644
--- a/lib/chef/resource/http_request.rb
+++ b/lib/chef/resource/http_request.rb
@@ -26,7 +26,7 @@ class Chef
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
index 5e4a63c06b..fafa1a5caa 100644
--- a/lib/chef/resource/locale.rb
+++ b/lib/chef/resource/locale.rb
@@ -125,7 +125,7 @@ class Chef
# @raise [Mixlib::ShellOut::ShellCommandFailed] not a supported language or locale
#
def generate_locales
- shell_out!("locale-gen #{unavailable_locales.join(" ")}")
+ shell_out!("locale-gen #{unavailable_locales.join(" ")}", timeout: 1800)
end
# Sets the system locale for the current computer.
diff --git a/lib/chef/resource/mdadm.rb b/lib/chef/resource/mdadm.rb
index 7c1d066488..f2e610c1cf 100644
--- a/lib/chef/resource/mdadm.rb
+++ b/lib/chef/resource/mdadm.rb
@@ -36,7 +36,7 @@ class Chef
property :chunk, Integer,
default: 16,
- description: "The chunk size. This property should not be used for a RAID 1 mirrored pair (i.e. when the level property is set to 1)."
+ description: "The chunk size. This property should not be used for a RAID 1 mirrored pair (i.e. when the `level` property is set to `1`)."
property :devices, Array,
default: lazy { [] },
@@ -63,7 +63,7 @@ class Chef
description: "An optional property to specify the name of the RAID device if it differs from the resource block's name."
property :layout, String,
- description: "The RAID5 parity algorithm. Possible values: left-asymmetric (or la), left-symmetric (or ls), right-asymmetric (or ra), or right-symmetric (or rs)."
+ description: "The RAID5 parity algorithm. Possible values: `left-asymmetric` (or `la`), `left-symmetric` (or ls), `right-asymmetric` (or `ra`), or `right-symmetric` (or `rs`)."
action_class do
def load_current_resource
diff --git a/lib/chef/resource/osx_profile.rb b/lib/chef/resource/osx_profile.rb
index 6c0028301d..491f30be43 100644
--- a/lib/chef/resource/osx_profile.rb
+++ b/lib/chef/resource/osx_profile.rb
@@ -65,13 +65,13 @@ class Chef
{
'mcx_preference_settings' => {
'idleTime' => 0,
- }
- }
- ]
- }
- }
- }
- ]
+ },
+ },
+ ],
+ },
+ },
+ },
+ ],
}
osx_profile 'Install screensaver profile' do
diff --git a/lib/chef/resource/remote_directory.rb b/lib/chef/resource/remote_directory.rb
index b6dc0b7a98..b87fe8c085 100644
--- a/lib/chef/resource/remote_directory.rb
+++ b/lib/chef/resource/remote_directory.rb
@@ -29,7 +29,7 @@ class Chef
provides :remote_directory
- description "Use the **remote_directory** resource to incrementally transfer a directory from a cookbook to a node. The director that is copied from the cookbook should be located under COOKBOOK_NAME/files/default/REMOTE_DIRECTORY. The remote_directory resource will obey file specificity."
+ description "Use the **remote_directory** resource to incrementally transfer a directory from a cookbook to a node. The directory that is copied from the cookbook should be located under `COOKBOOK_NAME/files/default/REMOTE_DIRECTORY`. The `remote_directory` resource will obey file specificity."
default_action :create
allowed_actions :create, :create_if_missing, :delete
diff --git a/lib/chef/resource/ruby.rb b/lib/chef/resource/ruby.rb
index a9f3ae24fd..2c0e65e9da 100644
--- a/lib/chef/resource/ruby.rb
+++ b/lib/chef/resource/ruby.rb
@@ -25,11 +25,7 @@ class Chef
provides :ruby
- description "Use the **ruby** resource to execute scripts using the Ruby interpreter. This"\
- " resource may also use any of the actions and properties that are available"\
- " to the **execute** resource. Commands that are executed with this resource are (by"\
- " their nature) not idempotent, as they are typically unique to the environment"\
- " in which they are run. Use `not_if` and `only_if` to guard this resource for idempotence."
+ description "Use the **ruby** resource to execute scripts using the Ruby interpreter. This resource may also use any of the actions and properties that are available to the **execute** resource. Commands that are executed with this resource are (by their nature) not idempotent, as they are typically unique to the environment in which they are run. Use `not_if` and `only_if` to guard this resource for idempotence."
def initialize(name, run_context = nil)
super
diff --git a/lib/chef/resource/ruby_block.rb b/lib/chef/resource/ruby_block.rb
index 427c3e25da..2d7d2fe8b6 100644
--- a/lib/chef/resource/ruby_block.rb
+++ b/lib/chef/resource/ruby_block.rb
@@ -28,7 +28,7 @@ class Chef
provides :ruby_block, target_mode: true
- description "Use the **ruby_block** resource to execute Ruby code during a #{ChefUtils::Dist::Infra::PRODUCT} run. Ruby code in the ruby_block resource is evaluated with other resources during convergence, whereas Ruby code outside of a ruby_block resource is evaluated before other resources, as the recipe is compiled."
+ description "Use the **ruby_block** resource to execute Ruby code during a #{ChefUtils::Dist::Infra::PRODUCT} run. Ruby code in the `ruby_block` resource is evaluated with other resources during convergence, whereas Ruby code outside of a `ruby_block` resource is evaluated before other resources, as the recipe is compiled."
default_action :run
allowed_actions :create, :run
diff --git a/lib/chef/version.rb b/lib/chef/version.rb
index f61748d3ae..87e55b79c0 100644
--- a/lib/chef/version.rb
+++ b/lib/chef/version.rb
@@ -23,7 +23,7 @@ require_relative "version_string"
class Chef
CHEF_ROOT = File.expand_path("..", __dir__)
- VERSION = Chef::VersionString.new("16.8.14")
+ VERSION = Chef::VersionString.new("16.8.19")
end
#