Merge pull request #4550 from inspec/zenspider/only_if/os

Add no-op resource and switch Rule to use it for skipped resources.
This commit is contained in:
Clinton Wolfe 2019-10-02 00:11:02 -04:00 committed by GitHub
commit d7e39c38f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View file

@ -0,0 +1,9 @@
module Inspec::Resources
class Noop < Inspec.resource(1)
name "noop"
def to_s
"No-op"
end
end
end

View file

@ -227,9 +227,7 @@ module Inspec
msg = "Skipped control due to #{skip_check[:type]} condition."
end
# TODO: we use os as the carrier here, but should consider
# a separate resource to do skipping
resource = rule.os
resource = rule.noop
resource.skip_resource(msg)
[["describe", [resource], nil]]
end