mirror of
https://github.com/inspec/inspec
synced 2024-11-10 23:24:18 +00:00
Apply suggestions from the doc review
Signed-off-by: Raphael Geissert <atomo64@gmail.com>
This commit is contained in:
parent
cc9d0df17b
commit
70ccecba90
2 changed files with 12 additions and 10 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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' }
|
||||
|
|
Loading…
Reference in a new issue