mirror of
https://github.com/inspec/inspec
synced 2025-02-17 14:38:43 +00:00
Merge pull request #981 from chef/vj/document-ini-resource
document ini resource
This commit is contained in:
commit
1dbcab3c7f
1 changed files with 43 additions and 0 deletions
|
@ -23,6 +23,7 @@ The following InSpec audit resources are available:
|
|||
* `host`_
|
||||
* `iis_site`_
|
||||
* `inetd_conf`_
|
||||
* `ini`_
|
||||
* `interface`_
|
||||
* `iptables`_
|
||||
* `kernel_module`_
|
||||
|
@ -1999,6 +2000,48 @@ then the same test will return ``false`` for ``ftp`` and the entire test will fa
|
|||
end
|
||||
|
||||
|
||||
ini
|
||||
=====================================================
|
||||
Use the ``ini`` |inspec resource| to test data in a INI file.
|
||||
|
||||
**Stability: Stable**
|
||||
|
||||
Syntax
|
||||
-----------------------------------------------------
|
||||
An ``ini`` |inspec resource| block declares the content of the ``ini`` file:
|
||||
|
||||
.. code-block:: ruby
|
||||
|
||||
describe ini('path/to/ini_file.ini') do
|
||||
its('auth_protocol') { should eq 'https' }
|
||||
end
|
||||
|
||||
where
|
||||
|
||||
* ``'auth_protocol'`` is a key in the ``ini`` file
|
||||
* ``('https')`` is the expected value associated with the above key in the ``ini`` file
|
||||
|
||||
Matchers
|
||||
-----------------------------------------------------
|
||||
This |inspec resource| matches any content in the ``ini`` file:
|
||||
|
||||
.. code-block:: ruby
|
||||
|
||||
its('port') { should eq '143' }
|
||||
|
||||
Examples
|
||||
-----------------------------------------------------
|
||||
The following examples show how to use this InSpec audit resource.
|
||||
|
||||
For example:
|
||||
|
||||
.. code-block:: ruby
|
||||
|
||||
describe ini('path/to/ini_file.ini') do
|
||||
its('port') { should eq '143' }
|
||||
its('server') { should eq '192.0.2.62' }
|
||||
end
|
||||
|
||||
|
||||
interface
|
||||
=====================================================
|
||||
|
|
Loading…
Add table
Reference in a new issue