Use the mount Chef InSpec audit resource to test the mount points on FreeBSD and Linux systems.
This resource is distributed along with Chef InSpec itself. You can use it automatically.
This resource first became available in v1.0.0 of InSpec.
An mount resource block declares the synchronization settings that should be tested:
describe mount('path') do
it { should MATCHER 'value' }
end
where
('path') is the path to the mounted directoryMATCHER is a valid matcher for this resource'value' is the value to be testedThe following examples show how to use this Chef InSpec audit resource.
describe mount('/') do
it { should be_mounted }
its('device') { should eq '/dev/mapper/VolGroup-lv_root' }
its('type') { should eq 'ext4' }
its('options') { should eq ['rw', 'mode=620'] }
end
For a full list of available matchers, please visit our matchers page.
The be_mounted matcher tests if the file is accessible from the file system:
it { should be_mounted }
The device matcher tests the device from the fstab table:
its('device') { should eq '/dev/mapper/VolGroup-lv_root' }
The options matcher tests the mount options for the file system from the fstab table:
its('options') { should eq ['rw', 'mode=620'] }
The type matcher tests the file system type:
its('type') { should eq 'ext4' }
© Chef Software, Inc.
Licensed under the Creative Commons Attribution 3.0 Unported License.
The Chef™ Mark and Chef Logo are either registered trademarks/service marks or trademarks/servicemarks of Chef, in the United States and other countries and are used with Chef Inc's permission.
We are not affiliated with, endorsed or sponsored by Chef Inc.
https://docs.chef.io/inspec/resources/mount/