inspec/lib/utils
Jerry Aldrich III 71057675de Allow skipping/failing resources in FilterTable (#2349)
* Allow skipping/failing resources in FilterTable

`FilterTable` is commonly used in the class body of a resource and is
evaluated during an `instance_eval`. This means that if you raise an
exception (e.g. SkipResource) it will halt `inspec exec` and
`inspec check`.

This adds an `ExceptionCatcher` class that will postpone evaluation
until test execution.

This allows `inspec check` and `inspec exec` to perform as intended when
skipping/failing a resource in `FilterTable`

Huge thanks to @adamleff for providing the starting code/ideas!

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>

* Comment why `ExceptionCatcher` doesn't raise

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>

* Remove `accessor` from `ExceptionCatcher`

Signed-off-by: Jerry Aldrich <jerryaldrichiii@gmail.com>

* Return the existing ExceptionCatcher object rather than creating new

Signed-off-by: Adam Leff <adam@leff.co>
2017-11-29 07:32:40 -05:00
..
command_wrapper.rb Bump Rubocop to 0.49.1 (#2323) 2017-11-21 08:49:41 +01:00
convert.rb lint 2016-01-15 04:07:25 +01:00
database_helpers.rb oracle_session and mssql_session improvement (#1857) 2017-06-29 11:01:32 -04:00
erlang_parser.rb add rabbitmq config resource 2017-04-12 20:51:12 +02:00
filter.rb Allow skipping/failing resources in FilterTable (#2349) 2017-11-29 07:32:40 -05:00
filter_array.rb Remove any "All Rights Reserved" references (#1969) 2017-06-28 04:14:19 -07:00
find_files.rb Add wildcard support to Utils::FindFiles (#2159) 2017-09-23 09:17:34 +02:00
hash.rb implement be_mounted.with for file resources 2016-01-03 00:03:24 +01:00
json_log.rb Bump Rubocop to 0.49.1 (#2323) 2017-11-21 08:49:41 +01:00
latest_version.rb Bump Rubocop to 0.49.1 (#2323) 2017-11-21 08:49:41 +01:00
modulator.rb add author header 2015-10-06 18:55:44 +02:00
nginx_parser.rb nginx resource: support quoted identifiers (#2292) 2017-11-08 12:42:37 -05:00
object_traversal.rb Bump Rubocop to 0.49.1 (#2323) 2017-11-21 08:49:41 +01:00
parser.rb Bump Rubocop to 0.49.1 (#2323) 2017-11-21 08:49:41 +01:00
plugin_registry.rb Address rubocop violations 2017-02-08 16:49:16 -06:00
simpleconfig.rb Remove any "All Rights Reserved" references (#1969) 2017-06-28 04:14:19 -07:00
spdx.rb verifies that inspec.yml uses licenses in SPDX format 2017-05-31 00:21:05 -05:00
spdx.txt update unit tests 2017-05-31 00:21:05 -05:00