2
0
Fork 0
mirror of https://github.com/inspec/inspec synced 2024-12-20 01:54:08 +00:00
inspec/docs/resources/oneget.md.erb

68 lines
1.4 KiB
Text
Raw Normal View History

2016-09-22 12:43:57 +00:00
---
title: About the oneget Resource
---
# oneget
Use the `oneget` InSpec audit resource to test if the named package and/or package version is installed on the system. This resource uses Oneget, which is `part of the Windows Management Framework 5.0 and Windows 10 <https://github.com/OneGet/oneget>`__. This resource uses the `Get-Package` cmdlet to return all of the package names in the Oneget repository.
## Syntax
2016-09-22 12:43:57 +00:00
A `oneget` resource block declares a package and (optionally) a package version:
describe oneget('name') do
it { should be_installed }
end
where
* `('name')` must specify the name of a package, such as `'VLC'`
* `be_installed` is a valid matcher for this resource
## Matchers
2016-09-22 12:43:57 +00:00
This InSpec audit resource has the following matchers:
### be
2016-09-22 12:43:57 +00:00
<%= partial "/shared/matcher_be" %>
### be_installed
2016-09-22 12:43:57 +00:00
The `be_installed` matcher tests if the named package is installed on the system:
it { should be_installed }
### cmp
2016-09-22 12:43:57 +00:00
<%= partial "/shared/matcher_cmp" %>
### eq
2016-09-22 12:43:57 +00:00
<%= partial "/shared/matcher_eq" %>
### include
2016-09-22 12:43:57 +00:00
<%= partial "/shared/matcher_include" %>
### match
2016-09-22 12:43:57 +00:00
<%= partial "/shared/matcher_match" %>
### version
2016-09-22 12:43:57 +00:00
The `version` matcher tests if the named package version is on the system:
its('version') { should eq '1.2.3' }
## Examples
2016-09-22 12:43:57 +00:00
The following examples show how to use this InSpec audit resource.
### Test if VLC is installed
2016-09-22 12:43:57 +00:00
describe oneget('VLC') do
it { should be_installed }
end