inspec/lib/resources
jtimberman d7fad68541 add "packages" resource
This pull request adds a packages resource so that we can check for pattern matches against all the packages on a system. This initially implements only dpkg support for debian-based platforms so we can cover this use case:

```ruby
describe packages(/^xserver-xorg.*/) do
  its("list") { should be_empty }
end
```

This uses FilterTable so we can supply additional queries, too.

```ruby
describe packages(/vi.+/).where { status != 'installed' } do
  its('statuses') { should be_empty }
end
```

Users can specify the name as a string or a regular expression. If it is a string, we will escape it and convert it to a regular expression to use in matching against the full returned list of packages. If it is a regular expression, we take that as is and use it to filter the results.

While some package management systems such as `dpkg` can take a shell glob argument to filter their results, we eschew this and require a regular expression to match multiple package names because we will need this to work across other platforms in the future. This means that the following:

```ruby
packages("vim")
```

Will return *all* the "vim" packages on the system. The `packages` resource will take `"vim"`, turn it into `/vim/`, and greedily match anything with "vim" in the name. To match only a single package named `vim`, it needs to be an anchored regular expression.

```ruby
packages(/^vim$/)
```

Signed-off-by: Joshua Timberman <joshua@chef.io>

Use entries instead of list

Added a few more tests and non installed package in output
Signed-off-by: Alex Pop <apop@chef.io>

fix lint

Signed-off-by: Alex Pop <apop@chef.io>

Signed-off-by: Joshua Timberman <joshua@chef.io>
2017-02-07 10:29:11 +00:00
..
apache.rb Update inspec for os[:family] change in Train 2016-08-04 13:32:35 +01:00
apache_conf.rb In ApacheConf#include_files, check for abs paths 2016-09-20 09:11:09 -04:00
apt.rb improved regex for matching deb sources 2016-11-09 11:10:46 -06:00
audit_policy.rb Placing all resources in the Inspec::Resources namespace 2016-03-08 13:40:16 -05:00
auditd_conf.rb Placing all resources in the Inspec::Resources namespace 2016-03-08 13:40:16 -05:00
auditd_rules.rb Update inspec for os[:family] change in Train 2016-08-04 13:32:35 +01:00
bash.rb remodel bash and shell wrappers 2016-04-18 11:48:42 -04:00
bond.rb rename internal File -> FileResource 2016-03-09 10:48:48 +01:00
bridge.rb Placing all resources in the Inspec::Resources namespace 2016-03-08 13:40:16 -05:00
command.rb Update inspec for os[:family] change in Train 2016-08-04 13:32:35 +01:00
csv.rb Placing all resources in the Inspec::Resources namespace 2016-03-08 13:40:16 -05:00
directory.rb rename internal File -> FileResource 2016-03-09 10:48:48 +01:00
etc_group.rb Placing all resources in the Inspec::Resources namespace 2016-03-08 13:40:16 -05:00
file.rb fix file permission check by mask 2016-11-03 12:46:48 +01:00
gem.rb making the examples in the code consistent with rst docs 2016-09-21 11:33:17 +05:30
groups.rb implement filter table for group/groups resource 2016-09-23 00:53:24 +02:00
grub_conf.rb Update inspec for os[:family] change in Train 2016-08-04 13:32:35 +01:00
host.rb Update host.rb 2016-08-23 17:15:33 +02:00
http.rb switch to faraday as http backend 2017-02-02 22:13:36 +01:00
iis_site.rb add fallback syntax for serverspec tests 2016-12-15 16:16:17 +01:00
inetd_conf.rb overwrite exec for inetd because respec its is executing exec 2016-10-28 12:10:45 +03:00
ini.rb Placing all resources in the Inspec::Resources namespace 2016-03-08 13:40:16 -05:00
interface.rb Use only strings in resource examples, docs and tests 2016-05-03 23:27:18 +01:00
iptables.rb Placing all resources in the Inspec::Resources namespace 2016-03-08 13:40:16 -05:00
json.rb Make "permission denied" condition match that of Train 2016-12-28 22:20:40 -05:00
kernel_module.rb Minor improvements 2017-01-27 13:51:45 +03:00
kernel_parameter.rb Use only strings in resource examples, docs and tests 2016-05-03 23:27:18 +01:00
limits_conf.rb Placing all resources in the Inspec::Resources namespace 2016-03-08 13:40:16 -05:00
login_def.rb Placing all resources in the Inspec::Resources namespace 2016-03-08 13:40:16 -05:00
mount.rb update mount example with include 2016-05-06 14:27:42 +01:00
mssql_session.rb fixing rubocop error 2016-07-17 14:22:04 -04:00
mysql.rb fix os exception 2016-09-02 15:24:50 +01:00
mysql_conf.rb descope calls to global File 2016-03-09 10:48:54 +01:00
mysql_session.rb Use only strings in resource examples, docs and tests 2016-05-03 23:27:18 +01:00
npm.rb Placing all resources in the Inspec::Resources namespace 2016-03-08 13:40:16 -05:00
ntp_conf.rb Placing all resources in the Inspec::Resources namespace 2016-03-08 13:40:16 -05:00
oneget.rb making the examples in the code consistent with rst docs 2016-09-21 11:33:17 +05:30
os.rb making the examples in the code consistent with rst docs 2016-09-21 11:33:17 +05:30
os_env.rb Update inspec for os[:family] change in Train 2016-08-04 13:32:35 +01:00
package.rb fixes brew json parsing 2017-01-03 12:24:57 +01:00
packages.rb add "packages" resource 2017-02-07 10:29:11 +00:00
parse_config.rb remove whitespace 2016-09-26 01:29:18 +02:00
passwd.rb expose deprecated fields in passwd 2016-05-04 15:27:58 +02:00
pip.rb fix double-space in pip to_s resource 2016-09-21 12:02:36 +02:00
port.rb Update port.rb 2016-08-25 19:57:41 +02:00
postgres.rb Improve detection of postgresql conf dir and data dir 2016-08-10 18:44:15 +02:00
postgres_conf.rb optimize regular expression for postgres config parsing 2017-01-05 13:16:47 +01:00
postgres_session.rb Placing all resources in the Inspec::Resources namespace 2016-03-08 13:40:16 -05:00
powershell.rb fix integration tests for usage with winrm v2 2016-09-05 13:36:48 +02:00
processes.rb deprecate .list 2017-02-03 08:28:46 +00:00
registry_key.rb Remove extra ' in registry key examples 2016-11-21 10:18:01 -06:00
security_policy.rb return empty array for known privileges 2016-09-26 01:48:59 +02:00
service.rb Updated Windows Service check for Enabled state to allow both Auto and 2016-11-03 11:28:38 -05:00
shadow.rb fix the shadow password example now that cmp can handle arrays 2016-04-20 11:57:34 -04:00
ssh_conf.rb 'execution' is spelled correctly 2017-01-24 23:19:30 -05:00
ssl.rb fix nil timeout and retries 2016-10-26 20:43:46 +01:00
sys_info.rb Fix minor typo in sys_info documentation 2016-09-26 10:56:16 +01:00
users.rb replace wmi win32_useraccount with adsi users 2016-09-26 01:31:44 +02:00
vbscript.rb fix integration tests for usage with winrm v2 2016-09-05 13:36:48 +02:00
windows_feature.rb Update inspec for os[:family] change in Train 2016-08-04 13:32:35 +01:00
windows_task.rb Fixing errors reported in Travis 2016-11-20 20:32:48 +00:00
wmi.rb improve wmi resource 2016-06-19 23:40:45 +02:00
xinetd.rb derive xinetd protocol from socket_type when not defined in the config file 2017-02-01 11:19:24 +00:00
yaml.rb Placing all resources in the Inspec::Resources namespace 2016-03-08 13:40:16 -05:00
yum.rb Yum.repo should show correct name 2017-01-04 11:10:38 +09:00