inspec/docs/resources/oneget.md.erb

53 lines
1.3 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.
<br>
## 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
<br>
2016-09-22 12:43:57 +00:00
## Examples
2016-09-22 12:43:57 +00:00
The following examples show how to use this InSpec audit resource.
2016-09-22 12:43:57 +00:00
### Test if VLC is installed
2016-09-22 12:43:57 +00:00
describe oneget('VLC') do
it { should be_installed }
end
2016-09-22 12:43:57 +00:00
<br>
2016-09-22 12:43:57 +00:00
## Matchers
2016-09-22 12:43:57 +00:00
This InSpec audit resource has the following matchers. For a full list of available matchers please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).
2016-09-22 12:43:57 +00:00
### be_installed
2016-09-22 12:43:57 +00:00
The `be_installed` matcher tests if the named package is installed on the system:
2016-09-22 12:43:57 +00:00
it { should be_installed }
2016-09-22 12:43:57 +00:00
### 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' }