From 70ccecba90d5780437f0d013a39c408fff7a63fb Mon Sep 17 00:00:00 2001 From: mjingle Date: Tue, 8 Dec 2020 10:06:34 +0100 Subject: [PATCH] Apply suggestions from the doc review Signed-off-by: Raphael Geissert --- .../content/inspec/resources/parse_config.md | 4 ++-- .../inspec/resources/parse_config_file.md | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/docs-chef-io/content/inspec/resources/parse_config.md b/docs-chef-io/content/inspec/resources/parse_config.md index d1e40e23b..cf894d517 100644 --- a/docs-chef-io/content/inspec/resources/parse_config.md +++ b/docs-chef-io/content/inspec/resources/parse_config.md @@ -55,7 +55,7 @@ where each test ## Options -This resource supports the following options for parsing configuration data. Use them in an `options` block stated outside of (and immediately before) the actual test: +This resource supports multiple options to parse configuration data. Use the options in an `options` block stated outside of (and immediately before) the actual test. For example: options = { assignment_regex: /^\s*([^:]*?)\s*:\s*(.*?)\s*$/, @@ -129,7 +129,7 @@ Use `standalone_comments: false`, to parse the following: ## Examples -This resource is based on the `parse_config_file` resource. As such please refer to the examples of the [`parse_config_file`](/inspec/resources/parse_config_file) resource. +This resource is based on the `parse_config_file` resource. See the [`parse_config_file`](/inspec/resources/parse_config_file) resource for examples. ## Matchers diff --git a/docs-chef-io/content/inspec/resources/parse_config_file.md b/docs-chef-io/content/inspec/resources/parse_config_file.md index 5f900ed48..bf585c664 100644 --- a/docs-chef-io/content/inspec/resources/parse_config_file.md +++ b/docs-chef-io/content/inspec/resources/parse_config_file.md @@ -50,16 +50,16 @@ where each test - May run a command to `stdout`, and then run the test against that output - May use options to define how configuration data is to be parsed -### Option names containing dots +### Option Names Containing Periods -A possibly unexpected behaviour may occur when attempting to access option names containing dots with `its()`. A known behaviour, there are two ways to work around it: +A possible behavior may occur when attempting to access option names containing periods with `its()`. There are two ways to work around it: * Access the option by using the `params` attribute of the returned resource object -* Since 4.23.9, `its` can be used by passing the option name in a single-element array (cf. examples) +* Since 4.24.5, `its` can be used by passing the option name in a single-element array. See the `parse config file` examples. ## Options -This resource supports the following options for parsing configuration data. Use them in an `options` block stated outside of (and immediately before) the actual test: +This resource supports multiple options to parse configuration data. Use the options in an `options` block stated outside of (and immediately before) the actual test. For example: options = { assignment_regex: /^\s*([^:]*?)\s*:\s*(.*?)\s*$/, @@ -135,25 +135,27 @@ For a full list of available matchers, please visit our [matchers page](/inspec/ The following examples show how to use this Chef InSpec audit resource. -### Test a configuration setting +### Test A Configuration Setting describe parse_config_file('/path/to/file.conf') do its('PARAM_X') { should eq 'Y' } end -### Use options, and then test a configuration setting +### Use Options And Then Test A Configuration Setting describe parse_config_file('/path/to/file.conf', { multiple_values: true }) do its('PARAM_X') { should include 'Y' } end -### Test a file with an ini-like structure (such as a yum.conf) +### Test A File With An INI File Structure + +`yum.conf` is one example of an INI file structure type. describe parse_config_file('/path/to/yum.conf') do its('main') { should include('gpgcheck' => '1') } end -### Test a configuration setting containing dots +### Test A Configuration Setting Containing Periods describe parse_config_file('/etc/sysctl.conf') do its(['kernel.domainname']) { should eq 'example.com' }