mirror of
https://github.com/inspec/inspec
synced 2024-11-15 01:17:08 +00:00
15433e8661
* Not applicable if logic addition Signed-off-by: Nikita Mathur <nikita.mathur@chef.io> * Changes from not applicable if to only applicable if Signed-off-by: Nikita Mathur <nikita.mathur@chef.io> * Fix to enable placing only_applicable_if at any position in control and for keeping impact zero intact Signed-off-by: Nikita Mathur <nikita.mathur@chef.io> * Doc change added for only_applicable_if Signed-off-by: Nikita Mathur <nikita.mathur@chef.io> * Doc Review Signed-off-by: Deepa Kumaraswamy <dkumaras@progress.com> * Added generic examples that supports cross platform for testing Signed-off-by: Nikita Mathur <nikita.mathur@chef.io> * Yet another build fix due to changes in test Signed-off-by: Nikita Mathur <nikita.mathur@chef.io> Signed-off-by: Nikita Mathur <nikita.mathur@chef.io> Signed-off-by: Deepa Kumaraswamy <dkumaras@progress.com> Co-authored-by: Deepa Kumaraswamy <dkumaras@progress.com>
20 lines
551 B
Ruby
20 lines
551 B
Ruby
module Inspec
|
|
module EnhancedOutcomes
|
|
|
|
def self.determine_status(results, impact)
|
|
# No-op exception occurs in case of not_applicable_if
|
|
if results.any? { |r| !r[:exception].nil? && !r[:backtrace].nil? && r[:resource_class] != "noop" }
|
|
"error"
|
|
elsif !impact.nil? && impact.to_f == 0.0
|
|
"not_applicable"
|
|
elsif results.all? { |r| r[:status] == "skipped" }
|
|
"not_reviewed"
|
|
elsif results.any? { |r| r[:status] == "failed" }
|
|
"failed"
|
|
else
|
|
"passed"
|
|
end
|
|
end
|
|
|
|
end
|
|
end
|