Commit graph

344 commits

Author SHA1 Message Date
Kimberly Garmoe
73f2eebea5 Refactors docker_image resource (#2518)
Signed-off-by: kagarmoe <kgarmoe@chef.io>
2018-02-02 08:13:04 -05:00
Kimberly Garmoe
288e9f2607 Refactors docker_container resource (#2517)
* Refactors docker_container resource

Signed-off-by: kagarmoe <kgarmoe@chef.io>

* Edits matchers to properties

Signed-off-by: kagarmoe <kgarmoe@chef.io>
2018-02-02 08:10:47 -05:00
Kimberly Garmoe
3e7e806eba Updates cran resource doc (#2512)
Signed-off-by: kagarmoe <kgarmoe@chef.io>
2018-02-02 07:36:36 -05:00
Kimberly Garmoe
d3a2957766 Kg/cpan (#2511)
* Refactors cpan resource doc

Signed-off-by: kagarmoe <kgarmoe@chef.io>

* Copy edit

Signed-off-by: kagarmoe <kgarmoe@chef.io>
2018-02-02 07:35:50 -05:00
Kimberly Garmoe
16325b8a9b Refactors the bridge property (#2505)
Signed-off-by: kagarmoe <kgarmoe@chef.io>
2018-02-01 17:45:33 -05:00
Kimberly Garmoe
c9a226c4ab Refactors 'bash' resource docs page (#2500)
* Refactors 'bash' resource docs page

Signed-off-by: kagarmoe <kgarmoe@chef.io>

* Changes 'exist' description

Signed-off-by: kagarmoe <kgarmoe@chef.io>
2018-02-01 17:44:10 -05:00
Kimberly Garmoe
6ed7616ac9 Refactors bsd_service resource doc (#2507)
Signed-off-by: kagarmoe <kgarmoe@chef.io>
2018-02-01 17:43:16 -05:00
Kimberly Garmoe
66e25fab8d Refactors command resource (#2508)
Signed-off-by: kagarmoe <kgarmoe@chef.io>
2018-02-01 17:42:27 -05:00
Kimberly Garmoe
010ca42b2d Changes 'matcher' to 'property' in examples (#2499)
Signed-off-by: kagarmoe <kgarmoe@chef.io>
2018-02-01 11:51:12 +01:00
Kimberly Garmoe
7dc72c7491 Edits to audit_policy resource language (#2498)
Signed-off-by: kagarmoe <kgarmoe@chef.io>
2018-01-31 07:24:57 -05:00
Kimberly Garmoe
b45b77cd13 Simplifies 'matchers' language in docs (#2496)
Signed-off-by: kagarmoe <kgarmoe@chef.io>
2018-01-31 07:24:16 -05:00
Adam Leff
689fe34cc9 apache resource: document and deprecate (#2494)
* Docs for apache resource

Signed-off-by: kgarmoe <kgarmoe@chef.io>

* Add deprecation warning to apache docs and resource, and clean up examples.

Signed-off-by: Adam Leff <adam@leff.co>

* Update apache_conf resource to remove dependency on apache resource

Signed-off-by: Adam Leff <adam@leff.co>

* Make conf_dir method public

Signed-off-by: Adam Leff <adam@leff.co>

* Removes unnecessary aide_conf commit, pulled in from e25f0a45

Signed-off-by: Adam Leff <adam@leff.co>

* Switch to Pathname to calculate conf_dir

Needed to avoid Windows adding `C:\` in unit tests when calling
File.expand_path.

Signed-off-by: Adam Leff <adam@leff.co>
2018-01-31 11:16:15 +01:00
Franklin Webber
2cc446a686 Doc fixes the apache_conf properties returns an array (#2479)
* Fixes the apache_conf Listen property returns an array

The result is an array and not a string even when there is one value.

Signed-off-by: Franklin Webber <franklin@chef.io>

* Updates the apache_conf timeout, allowoverride, and maxclients to include

It seems that all of these values are placed in an array of values so
the matcher needs to be `include`.

Signed-off-by: Franklin Webber <franklin@chef.io>

* Updates docs for apache_conf

* Uses the suggested `cmp` instead of `include`
* Adds the way to properly compare a list of multiple ports

Signed-off-by: Franklin Webber <franklin@chef.io>
2018-01-29 13:03:36 -05:00
Jerry Aldrich
d96a6affa7 packages resource: Add architectures support (#2469)
This adds support for `architectures` to the `packages` resource.

Example:

```
describe packages(/compat-libstdc++-33/) do
  its('architectures') { should include 'x86_64' }
  its('architectures') { should include 'i686' }
end
```

This also adds documentation for the `packages` resource

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2018-01-25 23:57:34 -08:00
Vern Burton
55abdebdc9 filesystem resource: inspect linux filesystems (#2441)
* adding df resource

Signed-off-by: Vern Burton <me@vernburton.com>

* adding unit tests and required mocks for them, created integration test

Signed-off-by: Vern Burton <me@vernburton.com>

* cleaning up skip test to include only the filename and not full path

Signed-off-by: Vern Burton <me@vernburton.com>

* adding docs

Signed-off-by: Vern Burton <me@vernburton.com>

* size makes more sense than space

Signed-off-by: Vern Burton <me@vernburton.com>

* removing unneeded author lines

Signed-off-by: Vern Burton <me@vernburton.com>

* as the command changed, changing mock to the new sha

Signed-off-by: Vern Burton <me@vernburton.com>

* updating to address comments from #2441

* removing author lines
* using attr_reader functions
* using ruby string functions rather than pipe to sed
* adding os family detection
* using ResourceFailed as the pattern already existed for OS family detection
* using if for future case support for unix and unix-like (FreeBSD)

Signed-off-by: Vern Burton <me@vernburton.com>

* adding supports to resource metadata, and adding tests that show that resource says that it is not supported on windows/unix.

Signed-off-by: Vern Burton <me@vernburton.com>

* focusing on linux os family and removing logic for assumed future cases

Signed-off-by: Vern Burton <me@vernburton.com>

* changing df to filesystem

Signed-off-by: Vern Burton <me@vernburton.com>
2018-01-25 09:29:31 -05:00
Matt Kulka
c067798fc5 Docker Swarm service resource (#2456)
This change adds the `docker_service` resource for Docker swarm mode services. This
branches off some of the common elements (id, exists) into a `DockerObject` module along
with a utility function for parsing the image/repo string. That function was implemented
separately by `docker_image` and `docker_container`, now with a third resource, it made
sense to consolidate that into an included module. I used the most comprehensive
implementation. Existing classes had to be slightly modified for the genericization.

Signed-off-by: Matt Kulka <mkulka@parchment.com>
2018-01-23 12:30:14 -08:00
Markus Grobelin
dee94b6416 pip resource docs: mention custom path to pip as introduced by GH-2097 (#2459)
Signed-off-by: Markus Grobelin <grobi@koppzu.de>
2018-01-19 17:03:00 -05:00
djenniex-bene
2cfc0acaae SMTP example for the ini resource was incorrect and did not work (#2461)
* SMTP example for the ini resource was incorrect and did not work

Obvious fix.

* Fixed documentation and removed semicolons as the ini parser includes those semicolons

Obvious fix.
2018-01-17 11:41:33 -08:00
Vern Burton
175c3e1189 xml resource: support fetching attributes (#2423)
* adding database.xml with attributes to files and mocking it in the helper.rb

Signed-off-by: Vern Burton <me@vernburton.com>

* adding logic to test class returned by XPATH and using functions from respective classes to fill a array for return, and unit and integration tests to ensure functionality

Signed-off-by: Vern Burton <me@vernburton.com>

* updating docs to show how attributes are used

Signed-off-by: Vern Burton <me@vernburton.com>

* 'and' instead of 'or' makes more sense

Signed-off-by: Vern Burton <me@vernburton.com>

* adding default else for capturing unknown classes from REXML

Signed-off-by: Vern Burton <me@vernburton.com>

* removing extra newline

Signed-off-by: Vern Burton <me@vernburton.com>

* adding fail case with enough information to debug in future case

Signed-off-by: Vern Burton <me@vernburton.com>
2018-01-16 14:26:39 -08:00
Vern Burton
9b4a276e9f firewalld resource: prepend rule string only when necessary (#2430)
* adding control statement to add rule in front of string as long as it doesn't already contain rule.

Correcting resource name in firewalld from etc_hosts_deny

adding tests for both branches of the statement created in firewalld

Signed-off-by: Vern Burton <me@vernburton.com>

* moving to unless with a start_with

Signed-off-by: Vern Burton <me@vernburton.com>

* adding documentation that states that it is not needed to add `rule` string

Signed-off-by: Vern Burton <me@vernburton.com>
2018-01-16 14:20:58 -08:00
Nathen Harvey
65589f8f78 Markdown titles sometimes need _s escaped (#2451)
When a header includes two `_`s, they must be escaped, otherwise, the
text between the two `_`s is rendered with emphasis.  E.g.,

`<h1 id="etchostsallow">etc<em>hosts</em>allow</h1>`

Escaping the `_`s fixes this and the header is rendered properly.

This is a fix for:

* etc_hosts_allow
* etc_hosts_deny
* postgres_hba_conf
* postgres_ident_conf

This change also adds the `h1` title to the windows_hotfix resource
page.

Signed-off-by: Nathen Harvey <nharvey@chef.io>
2018-01-08 13:09:13 -05:00
Dominik Richter
be9ece65b9 load local dependencies in inspec shell (#2438)
* add --depends to inspec shell

for loading dependencies from local folders. mainly used for development.

Signed-off-by: Dominik Richter <dominik.richter@gmail.com>

* lint

Signed-off-by: Dominik Richter <dominik.richter@gmail.com>

* depends is not defined...

Signed-off-by: Dominik Richter <dominik.richter@gmail.com>

* much nicer description for --depends

kudos @adamleff

Signed-off-by: Dominik Richter <dominik.richter@gmail.com>

* add documentation for inspec shell --depends

Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2018-01-04 14:39:01 -05:00
Eammon Hanlon
f6c7bffe78 Add bonding mode matcher to bond resource (#2414)
* Add mode method to test the value of Bonding Mode

Signed-off-by: Eammon Hanlon <eammon.hanlon@microsoft.com>

* Add test for bonding mode in bond unit test

Signed-off-by: Eammon Hanlon <eammon.hanlon@microsoft.com>

* Add documentation on mode matcher for bond resource

Signed-off-by: Eammon Hanlon <eammon.hanlon@microsoft.com>

* Update example for 'Test parameters for bond0'

Signed-off-by: Eammon Hanlon <eammon.hanlon@microsoft.com>
2017-12-22 15:02:40 +01:00
Adam Leff
777c90e43a docs: fix XML resource example to use alternate syntax (#2395)
Signed-off-by: Adam Leff <adam@leff.co>
2017-12-22 14:56:18 +01:00
Jerry Aldrich
0178602d02 Correct .where usage in passwd documentation (#2419)
Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2017-12-21 22:59:20 -05:00
Franklin Webber
1cd7e1a120 Updates the docs for mysql_session (#2392)
* Fixes usage of 'output' to 'stdout'
* Adds examples for 'exit_status' and 'stderr'
* Modifies the matchers section to point to the command resource

Signed-off-by: Franklin Webber <franklin@chef.io>
2017-12-21 17:06:39 -05:00
Adam Leff
470582a84e xml resource: update docs with alternate syntax for keys with periods (#2389)
Signed-off-by: Adam Leff <adam@leff.co>
2017-12-12 16:31:50 +01:00
Andy Boutte
ac5ca9b5bc Added missing quote and removed extra bracket (#2386)
Signed-off-by: Andy Boutte <andy.boutte@reancloud.com>
2017-12-11 15:07:54 -05:00
Jordan Craig
d928c76702 Fix incorrect case in paragraph. (#2363)
Incorrect case used in paragraph to describe interactive debugging with Pry.

Obvious fix.
2017-12-04 11:55:33 -05:00
Patrick Münch
bd6a8fd980 kernel_module: correct docs style for code boxes (#2348)
Signed-off-by: Patrick Münch <patrick.muench1111@gmail.com>
2017-11-28 18:12:05 -05:00
David Alexander
71b90f1b22 file resource: fix NilClass error when using advanced windows permissions (#2344)
* Fixes #2343 (Windows file permissions regression)

Signed-off-by: David Alexander <opensource@thelonelyghost.com>

* Updates docs with missing info on `be_allowed()` matcher

Signed-off-by: David Alexander <opensource@thelonelyghost.com>
2017-11-28 09:18:49 +01:00
Patrick Münch
95f825aec2 correct syntax of first describe example and correct style of further examples (#2324)
* remove second end in first describe example, because of wrong syntax

Signed-off-by: Patrick Münch <patrick.muench1111@gmail.com>

* correct style of the examples

Signed-off-by: Patrick Münch <patrick.muench1111@gmail.com>
2017-11-27 11:15:51 -05:00
Adam Leff
0e8eccfa9b Add clarification to INI resource re: settings in sections (#2320)
Signed-off-by: Adam Leff <adam@leff.co>
2017-11-20 13:08:51 +01:00
dragon788
a1672dac28 Fix minor typo (#2319)
Amazingly doesn't appear anywhere else in the codebase from a brief search.

Obvious fix.
2017-11-17 16:47:45 -05:00
Jerry Aldrich III
43b71ff132 Add non-halting exception support to resources (#2235)
* Add non-halting exception support to resources

This adds two `Inspec::Exceptions` that can be used within resources to
either skip or fail a test without halting execution.

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>
2017-11-06 13:28:53 -05:00
Szymon Szypulski
615779c538 Use names when quering for containers (#2270)
Name does not work.

Obvious fix.
2017-10-31 16:37:33 -04:00
Adam Leff
cdbb288d39 shadow resource: Docs clarification of the passwords property (#2269)
Signed-off-by: Adam Leff <adam@leff.co>
2017-10-27 10:31:48 +02:00
Adam Leff
a238083403 Fix the docs for the shadow resource (#2266)
* Fix the docs for the shadow resource

Inspired by the work in PR #2246

Signed-off-by: Adam Leff <adam@leff.co>

* Fix typo

Signed-off-by: Adam Leff <adam@leff.co>
2017-10-25 12:23:52 -04:00
Markus Grobelin
2251270929 cran resource: check for R module installation (#2255)
* Added CRAN resource to check R modules

control 'cran-1' do
  impact 1.0
  desc '
    Ensure R module DBI is installed.
  '

  describe cpan('DBI') do
    it { should be_installed }
    its('version') { should cmp >= '3.0' }
  end
end

Signed-off-by: Markus Grobelin <grobi@koppzu.de>

* cran resource: made lint happy, added negative unit test, removed unused arg perl_lib_path

Signed-off-by: Markus Grobelin <grobi@koppzu.de>
2017-10-25 16:14:29 +02:00
Markus Grobelin
c626dfdbd9 cpan resource: check for Perl module installation (#2254)
* Added CPAN resource to check Perl modules

control 'cpan-1' do
  impact 1.0
  desc '
    Ensure Perl modules DBI and DBD::Pg are installed.
  '

  describe cpan('DBI') do
    it { should be_installed }
  end

  describe cpan('DBD::Pg') do
    it { should be_installed }
    its('version') { should cmp >= '3.0' }
  end
end

Signed-off-by: Markus Grobelin <grobi@koppzu.de>

* cpan resource: fixed unit test for non-installed module

Signed-off-by: Markus Grobelin <grobi@koppzu.de>
2017-10-25 16:01:26 +02:00
lhasadreams
7df4d2d418 Corrected name to be service_name (#2262)
Signed-off-by: Adrian Daniels <adrian@chef.io>
2017-10-24 17:51:30 -04:00
Adam Leff
8dc48533aa new resource: elasticsearch resource, test cluster/node state (#2261)
* new resource: elasticsearch resource, test cluster/node state

This is a new resource for testing an Elasticsearch cluster. It operates
by fetching the `_nodes` endpoint from a given Elasticsearch node and
collects data about each node in a cluster, even if there's only a
single node.

This work is based on inspiration from an initial PR #1956 submitted by
@rx294.

Signed-off-by: Rony Xavier <rx294@nyu.edu>
Signed-off-by: Aaron Lippold <lippold@gmail.com>
Signed-off-by: Adam Leff <adam@leff.co>

* Reduce mock data on non-default tests

Signed-off-by: Adam Leff <adam@leff.co>
2017-10-20 17:28:48 -04:00
J Burns
58eae32688 etc_fstab resource: properly namespace the resource, add nfs_file_systems documentation (#2190)
* Updated nfs_file_systems example in docs

Signed-off-by: Jennifer Burns <jburns@mitre.org>
2017-10-12 11:30:33 +01:00
eramoto
b0e9654712 Fix documentation of split matcher (#2240)
Describes actual behavior for the `split` of os_env matcher.

Signed-off-by: ERAMOTO Masaya <eramoto.masaya@jp.fujitsu.com>
2017-10-12 07:45:37 +01:00
Adam Leff
cbf58c7afa Enhance cmp matcher to work with symbols, fix file documentation (#2224)
* Enhance cmp matcher to work with symbols

The `cmp` matcher will now stringify symbol actual values if the
expected value was passed in as a string. This will help with the file
resource `type` method where Train returns the file type as a symbol.

Signed-off-by: Adam Leff <adam@leff.co>

* Fix documentation for file type character_device

Signed-off-by: Adam Leff <adam@leff.co>

* Fix docs for block_device

Signed-off-by: Adam Leff <adam@leff.co>

* Fix file mtime docs

Signed-off-by: Adam Leff <adam@leff.co>
2017-10-07 12:28:07 +02:00
Adam Leff
939ee5ecfc processes resource: support busybox ps (#2222)
This change enhances the processes resource to support the busybox
ps command which is common on Alpine, for example. The way we
map ps fields to the structs needed by FilterTable have also been
refactored to be more flexible so we can support multiple formats
in the future.

Also, the processes resource now allows the grep argument to be optional
thus allowing a user to query all resources without passing in a
match-all regex.

Signed-off-by: Adam Leff <adam@leff.co>
2017-10-06 19:32:39 +02:00
Adam Leff
359fd48af0 Update docs for the os resource (#2218)
The docs for the `os` resource did not have the proper parameters
listed and also improperly had `os[:debian]` examples instead of
`os.debian?`

Signed-off-by: Adam Leff <adam@leff.co>
2017-10-06 15:44:32 +02:00
Clinton Wolfe
90fc6affd2 Docs: describe custom matcher cmp on version strings (#2214)
* Docs update to describe using cmp for version matching on packages

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>

* Add 'and' and force Travis to re-run checks

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2017-10-05 13:18:12 -04:00
Adam Leff
21ba43d6a5 http resource: properly execute tests on remote target (#2209)
Currently, the http resource always executes locally, even when scanning
a remote machine with `--target` which leads to undesireable behavior.

This change adds the ability to remotely execute tests with curl. This
behavior is currently opt-in with the `enable_remote_worker` flag, but
will become the default behavior in InSpec 2.0. Deprecation warnings
are emitted if the user is scanning a remote target but has not opted
in to the new behavior.

Signed-off-by: Adam Leff <adam@leff.co>
2017-10-04 22:44:09 +02:00
Adam Leff
97a9b3f42a Adding examples of using expect syntax (#2213)
As discussed during the Chef Community Summit 2017 in Seattle, many
more technical users wish to use `expect` syntax and wish to see
more examples of how to do so with InSpec resources.

Signed-off-by: Adam Leff <adam@leff.co>
2017-10-04 22:43:20 +02:00