mirror of
https://github.com/inspec/inspec
synced 2024-11-10 23:24:18 +00:00
exception handling when exception in case of no error
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
This commit is contained in:
parent
c28bacdab7
commit
d08b8bb8f3
1 changed files with 6 additions and 2 deletions
|
@ -56,10 +56,14 @@ module Inspec::Resources
|
|||
inspec_cmd = inspec.command(command)
|
||||
out = inspec_cmd.stdout + "\n" + inspec_cmd.stderr
|
||||
|
||||
if inspec_cmd.exit_status != 0 || out.downcase =~ /^error.*/
|
||||
if inspec_cmd.exit_status != 0 || !inspec_cmd.stderr.empty? || out.downcase =~ /^error.*/
|
||||
raise Inspec::Exceptions::ResourceFailed, "Oracle query with errors: #{out}"
|
||||
else
|
||||
DatabaseHelper::SQLQueryResult.new(inspec_cmd, parse_csv_result(inspec_cmd.stdout))
|
||||
begin
|
||||
DatabaseHelper::SQLQueryResult.new(inspec_cmd, parse_csv_result(inspec_cmd.stdout))
|
||||
rescue
|
||||
raise Inspec::Exceptions::ResourceFailed, "Oracle query with errors: #{out}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue