Use the packages Chef InSpec audit resource to test the properties of multiple packages on the system.
This resource is distributed along with Chef InSpec itself. You can use it automatically.
This resource first became available in v1.51.15 of InSpec.
A packages resource block declares a regular expression search to select packages
describe packages(/name/) do
its('statuses') { should cmp 'installed' }
end
The statuses property tests if packages are installed on the system:
its('statuses') { should cmp 'installed' }
The versions property tests the versions of the packages installed on the system
its('versions') { should cmp '3.4.0.2-4.el7' }
The architectures property tests the architecture of packages installed on the system
its('architectures') { should include 'i686' }
The following examples show how to use this Chef InSpec audit resource.
xserver packages are installeddescribe packages(/xserver/) do
its('statuses') { should_not cmp 'installed' }
end
openssl packages match a certain versiondescribe packages(/openssl/) do
its('versions') { should cmp '1.0.1e-42.el7' }
end
i686 and x86_64 versions of libgcc are installeddescribe packages(/libgcc/) do
its('architectures') { should include 'x86_64' }
its('architectures') { should include 'i686' }
end
For a full list of available matchers, please visit our matchers page.
© 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/packages/