Alex Pop
88975bff2a
Switch package resource to os.redhat detection and use two spaces as fileds delimited
...
Signed-off-by: Alex Pop <apop@chef.io>
2017-02-15 11:07:10 +00:00
Alex Pop
fae96f6249
Add RedHat support for packages resource
...
Fix dpkg trimming of first line
Signed-off-by: Alex Pop <apop@chef.io>
2017-02-15 11:07:10 +00:00
Adam Leff
417b791baa
Adding new crontab resource
...
The crontab resource parses a particular user's crontab file into
individual entries and allows the user to assert information about
each entry as needed.
Signed-off-by: Adam Leff <adam@leff.co>
2017-02-10 09:33:31 -05:00
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
Alex Pop
a3de32ad04
Fix xinetd parsing of services from the same file. Expose resource.protocols
...
Signed-off-by: Alex Pop <apop@chef.io>
2017-01-31 12:40:29 +00:00
Andrey Aleksandrov
3783357e50
Add version method to kernel_module
...
Signed-off-by: Andrey Aleksandrov <postgred@gmail.com>
2017-01-27 13:33:41 +03:00
Javier Palomo Almena
3f1986eb6f
Mock 'brew info --json=v1 curl' to facilitate unit testing the package resource for the darwin platform
...
Signed-off-by: Javier Palomo Almena <javier.palomo.almena@gmail.com>
2017-01-02 17:57:20 +01:00
Wei, He
fd04daf77c
add testcase for #1332
...
Signed-off-by: Wei, He <weihe924stephen@gmail.com>
2016-11-30 13:25:44 +09:00
username-is-already-taken2
e6e47eec4c
Added unit tests, only took most of the night :)
2016-11-20 20:07:59 +00:00
Alex Pop
70416a35b4
use command instead of comm and set user column width on linux
...
Signed-off-by: Alex Pop <apop@chef.io>
2016-10-17 15:39:13 +01:00
Anirudh Gupta
8efec7ac6c
fix processes resource for os's where username is long to avoid truncation
2016-10-17 11:46:16 +01:00
Christoph Hartmann
dab8ff5c13
replace wmi win32_useraccount with adsi users
2016-09-26 01:31:44 +02:00
Christoph Hartmann
f7ec24a337
implement filter table for group/groups resource
2016-09-23 00:53:24 +02:00
David Pell
155995adfd
In ApacheConf#include_files, check for abs paths
...
If the path is absolute, just use what was passed, otherwise build an
absolute path using `@conf_dir`.
Fixes #1013
2016-09-20 09:11:09 -04:00
Christoph Hartmann
a2143b8249
identify enabled/disabled accounts for windows
2016-09-12 11:40:25 +02:00
Christoph Hartmann
e61f71143d
add unit tests
2016-09-09 12:43:03 +02:00
Jeremy J. Miller
1b92d15d8f
added unit tests
2016-09-02 21:55:28 -04:00
Christoph Hartmann
956d3b7292
add unit test for new package resource
2016-08-24 14:40:26 +02:00
Alex Pop
353dcf10ec
make netstat default for getting ports and get only listening ones
2016-08-12 16:02:56 +01:00
Dominik Richter
c2f34932ad
add port resource for windows 2008
...
using `netstat -an`
2016-07-21 14:58:43 +02:00
Dominik Richter
c6644ebdfe
check service running by ActiveState
...
See http://unix.stackexchange.com/questions/159174/differences-between-inactive-vs-disabled-and-active-vs-enabled-services
2016-07-06 12:57:04 +02:00
Christoph Hartmann
9bdb01f1d5
improve wmi resource
2016-06-19 23:40:45 +02:00
Victoria Jeffrey
1811eb6666
Expose label for processes only on linux
2016-05-10 13:59:13 -04:00
Anirudh Gupta
738ef69bcf
prefixed hpux to cmd file name
2016-05-03 21:38:39 +05:30
Anirudh Gupta
d839f218bf
hpux support for basic port properties
2016-05-03 14:30:59 +05:30
Anirudh Gupta
75534fdaa5
added hpux user and package resource support
2016-04-21 14:01:56 +05:30
Jacob McCann
9dbf5354e5
Add 'static' value as enabled to systemd service enabled check
2016-04-13 14:44:28 -05:00
Christoph Hartmann
cd57b26bd0
wmi unit test
2016-03-20 11:53:56 +01:00
Dominik Richter
4a39275fc0
add xinetd_conf resource
2016-02-26 13:19:16 +01:00
Stephan Renatus
e184347c6d
iptables unit test: add comment examples
...
this is not broken; but it should stay not broken ;)
2016-02-10 09:57:32 +01:00
Stephan Renatus
cd5f47ed33
auditd_rules: unit tests, meet the real world
2016-02-09 11:51:52 +01:00
Stephan Renatus
664561aa80
auditd_rules: status querying (old/new) and unit tests
...
TODO: unit tests for the legacy format
2016-02-09 11:51:52 +01:00
Stephan Renatus
4afb22565e
auditd_rules: teach old dog new tricks
2016-02-09 11:51:52 +01:00
Stephan Renatus
688709356c
upstart_service: add version mock for ubuntu
2016-02-05 13:49:18 +01:00
Christoph Hartmann
62844eee0c
add unit tests
2016-01-28 18:30:38 +01:00
Jeremy W. Chalfant
a2ea1da6e3
move all lsof to formmated output (-F)
2016-01-14 23:03:24 -05:00
Jeremy W. Chalfant
b363e1d147
formatted lsof mockup
2016-01-14 23:03:24 -05:00
Mark Harrison
f5780b69a4
Correctly detect UDP ports on linux
...
netstat on UDP lines doesn't display a port state (e.g. LISTEN), so make this
field optional when parsing the netstat line.
2016-01-14 22:53:38 -05:00
Jacob McCann
f25ab3a373
Fix systemd service enabled check
2016-01-11 15:32:33 -06:00
Christoph Hartmann
a72ba94f10
handle mount results with multiple entries
2016-01-03 00:03:24 +01:00
Christoph Hartmann
a5acb03e49
add mount
resource
2016-01-03 00:03:24 +01:00
Stephan Renatus
7a1cd660c3
[resources/processes] add users, states attribute; update docs
...
processes('bash').user does not actually make much sense for a resource
that is a list -- different entries can belong to different users.
Analogous for processes('bash').state.
The attributes 'users' and 'states' expose the unique values
corresponding to that property of entries in the process list.
Fixes #295 .
2015-12-08 13:06:27 +01:00
Stephan Renatus
79f48afa6c
[resources/apache_conf]: add tests, fix bug
...
before, the resource would throw an exception when include_files
returned nil (i.e., [].flatten!)
added basic unit tests capturing the include_files behaviour
2015-12-07 10:50:48 +01:00
Christoph Hartmann
9231833cad
add unit tests for user resource that cover ldap groups
2015-11-24 18:35:10 +01:00
Seth Chisamore
beade346bf
Add Windows support to the os_env
resource
...
This change allows checks like:
```
describe os_env('PATH') do
its('split') { should include('C:\wix') }
end
```
2015-11-19 15:41:00 +01:00
Christoph Hartmann
27de925c2b
update mock command for registry key
2015-11-17 22:28:11 +01:00
Dominik Richter
17ce88b63d
api: don't force root on os_env
2015-11-13 12:10:22 +01:00
Christoph Hartmann
128eb4a7f6
add tests for iptables
2015-10-12 10:34:24 +02:00
Christoph Hartmann
9774ec7984
add test coverage for apt
2015-10-10 23:28:03 +02:00
Christoph Hartmann
2176039120
add linux tests for host
2015-10-09 19:27:29 +02:00
Christoph Hartmann
5a70133330
add mock files for host windows tests
2015-10-09 19:27:07 +02:00
Christoph Hartmann
3126a46b1e
add bridge unit tests for windows
2015-10-09 15:26:59 +02:00
Christoph Hartmann
b2ed180885
add bridge test for linux
2015-10-09 15:07:58 +02:00
Christoph Hartmann
9d92abf524
add windows support to network adapter
2015-10-08 13:01:50 +02:00
Christoph Hartmann
153c670952
introduce better network interface abstraction, add test cases
2015-10-08 13:01:50 +02:00
Christoph Hartmann
9c893c5653
add mock result for GetWin32 Group
2015-10-07 18:45:08 +02:00
Christoph Hartmann
6b2064ad89
return password expiry information for linux
2015-10-05 11:50:49 +02:00
Christoph Hartmann
cab93a178a
add tests for user resource
2015-10-05 11:50:49 +02:00
Christoph Hartmann
e139070923
increase test coverage for oneget
2015-10-03 13:27:20 +02:00
Christoph Hartmann
007d292890
rewrite systemv service implementation, read enabled services from rc
2015-09-25 12:58:03 +02:00
Christoph Hartmann
5be574693f
add unit tests for freebsd service resource
2015-09-25 12:53:40 +02:00
Christoph Hartmann
d5d517af0a
improve service handling for mac and add unit tests
2015-09-25 12:51:12 +02:00
Christoph Hartmann
cb3d170ce6
add centos 7 unit mock for service resource
2015-09-25 12:48:21 +02:00
Christoph Hartmann
1936383120
add service unit tests for ubuntu 14.04
2015-09-25 11:52:33 +02:00
Christoph Hartmann
3807a7412c
add package unit test for windows
2015-09-23 23:30:31 +02:00
Christoph Hartmann
52e4459d61
rename pacman mock file
2015-09-23 23:30:31 +02:00
Christoph Hartmann
cd6dbd03a1
add sockstat mock result
2015-09-23 23:15:37 +02:00
Christoph Hartmann
b47ec509fd
port resource support for Windows
2015-09-23 23:08:19 +02:00
Christoph Hartmann
4eeb84945c
port resource support for MacOS
2015-09-23 23:07:07 +02:00
Christoph Hartmann
c187230336
implement port resource for linux
2015-09-23 18:12:51 +02:00
Christoph Hartmann
8fc108bcd7
add tests
2015-09-22 02:27:04 +02:00
Christoph Hartmann
baee8daae8
add unit tests for windows feature
2015-09-22 02:27:03 +02:00
Christoph Hartmann
9a6063c267
add resource test for windows
2015-09-22 02:26:59 +02:00
Christoph Hartmann
33f9dd8e87
add oneget resource
2015-09-22 02:17:21 +02:00
Christoph Hartmann
238f1b2016
add pip resource to verify gem packages
2015-09-22 02:15:41 +02:00
Christoph Hartmann
bdb859b730
add npm resource to verify gem packages
2015-09-22 02:15:41 +02:00
Christoph Hartmann
0171b2e2f2
add gem resource to verify gem packages
2015-09-22 02:15:41 +02:00
Christoph Hartmann
02afd48576
add mock resources for package resource
2015-09-22 02:15:41 +02:00
Christoph Hartmann
a7efec310b
implement yum resource
2015-09-22 01:10:56 +02:00
Christoph Hartmann
9554a4ac32
add audit_daemon resource test cases
2015-09-21 14:12:11 +02:00
Christoph Hartmann
90935e75e1
add unit test for audit_policy resource
2015-09-21 14:09:16 +02:00
Christoph Hartmann
888f8588fb
add unit test for registry_key resource
2015-09-21 14:08:27 +02:00
Christoph Hartmann
faf7f44a42
add os_env unit test
2015-09-21 13:58:22 +02:00
Christoph Hartmann
1b643ae1da
implement security policy resource tests
2015-09-21 13:51:43 +02:00
Christoph Hartmann
03a7dd7176
implement unit test for processes resource
2015-09-21 13:43:09 +02:00