mirror of
https://github.com/inspec/inspec
synced 2024-11-26 22:50:36 +00:00
Fix handling using resources with incompatible resources (eg file + aws).
Signed-off-by: Ryan Davis <zenspider@chef.io>
This commit is contained in:
parent
14c245eccb
commit
d3df69213b
3 changed files with 17 additions and 1 deletions
|
@ -165,7 +165,11 @@ module Inspec::Resources
|
|||
end
|
||||
|
||||
def to_s
|
||||
"File #{source_path}"
|
||||
if file then
|
||||
"File #{source_path}"
|
||||
else
|
||||
"Bad File on %s" % [inspec.backend.class]
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -23,6 +23,15 @@ describe "inspec exec" do
|
|||
skip_windows!
|
||||
end
|
||||
|
||||
it "cleanly fails if mixing incompatible resource and transports" do
|
||||
# TODO: I do not know how to test this more directly. It should be possible.
|
||||
inspec "exec -t aws:// #{profile_path}/incompatible_resource_for_transport.rb"
|
||||
|
||||
stdout.must_include "Bad File on TrainPlugins::Aws::Connection"
|
||||
stdout.must_include "Resource `file` is not supported on platform aws/train-aws"
|
||||
stderr.must_equal ""
|
||||
end
|
||||
|
||||
it "can execute the profile" do
|
||||
inspec("exec " + example_profile + " --no-create-lockfile")
|
||||
stderr.must_equal ""
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
describe file('/tmp/foo') do
|
||||
it { should exist }
|
||||
end
|
Loading…
Reference in a new issue