mirror of
https://github.com/inspec/inspec
synced 2024-11-10 15:14:23 +00:00
CFINSPEC-96: Add documentation for zfs resource
Signed-off-by: Sonu Saha <sonu.saha@progress.com>
This commit is contained in:
parent
ada1eaefcc
commit
96d9b2fcdb
2 changed files with 83 additions and 1 deletions
82
docs-chef-io/content/inspec/resources/zfs.md
Normal file
82
docs-chef-io/content/inspec/resources/zfs.md
Normal file
|
@ -0,0 +1,82 @@
|
|||
+++
|
||||
title = "zfs resource"
|
||||
draft = false
|
||||
gh_repo = "inspec"
|
||||
platform = "linux"
|
||||
|
||||
[menu]
|
||||
[menu.inspec]
|
||||
title = "zfs"
|
||||
identifier = "inspec/resources/os/zfs.md zfs resource"
|
||||
parent = "inspec/resources/os"
|
||||
+++
|
||||
|
||||
Use the `zfs` Chef InSpec audit resource to test if the named ZFS Pool is present and/or has certain properties.
|
||||
|
||||
|
||||
## Availability
|
||||
|
||||
### Installation
|
||||
|
||||
This resource is distributed with Chef InSpec.
|
||||
|
||||
## Syntax
|
||||
|
||||
A `zfs` Chef InSpec audit resource allows to test if the named ZFS Pool is present and/or has certain properties.
|
||||
|
||||
```ruby
|
||||
describe zfs(zfs_pool_name) do
|
||||
it { should exist }
|
||||
it { should have_property({ "key1" => "value1", "key2" => "value2" }) }
|
||||
end
|
||||
```
|
||||
> where
|
||||
>
|
||||
> - `'zfs_pool_name'` is the name of a ZFS Pool
|
||||
> - `exist` and `have_property` are matchers of this resource
|
||||
> - `{ "key1" => "value1", "key2" => "value2" }` are properties of the ZFS Pool to test.
|
||||
|
||||
## Matchers
|
||||
|
||||
For a full list of available matchers, please visit our [matchers page](https://docs.chef.io/inspec/matchers/).
|
||||
|
||||
The specific matchers of this resource are: `exist` and `have_property`
|
||||
|
||||
### exist
|
||||
|
||||
The `exist` matcher tests if the ZFS Pool exist on the system.
|
||||
|
||||
```ruby
|
||||
it { should exist }
|
||||
```
|
||||
|
||||
### have_property
|
||||
|
||||
The `have_property` matcher accepts properties in hash format and tests if the given properties are valid ZFS Pool properties.
|
||||
|
||||
```ruby
|
||||
it { should have_property({ "key1" => "value1", "key2" => "value2" }) }
|
||||
```
|
||||
|
||||
## Examples
|
||||
The following examples show how to use this Chef InSpec audit resource.
|
||||
|
||||
### Test if the ZFS Pool exist on the system
|
||||
|
||||
`exist` matcher allows to test if the ZFS Pool exist on the system.
|
||||
|
||||
```ruby
|
||||
describe zfs("new-pool") do
|
||||
it { should exist }
|
||||
end
|
||||
```
|
||||
|
||||
### Test if the given properties are valid ZFS Pool properties.
|
||||
|
||||
`have_property` matcher allows to test if the given properties are valid ZFS Pool properties.
|
||||
|
||||
```ruby
|
||||
describe zfs("new-pool") do
|
||||
it { should have_property({ "failmode" => "wait", "capacity" => "0" }) }
|
||||
end
|
||||
```
|
|
@ -13,7 +13,7 @@ module Inspec::Resources
|
|||
example <<~EXAMPLE
|
||||
describe zfs("new-pool") do
|
||||
it { should exist }
|
||||
it { should have_property({"failmode" => "wait", "capacity" => "0"}) }
|
||||
it { should have_property({ "failmode" => "wait", "capacity" => "0" }) }
|
||||
end
|
||||
EXAMPLE
|
||||
|
||||
|
|
Loading…
Reference in a new issue