Class: CemAcpt::TestRunner::LogFormatter::BoltOutputFormatter
- Inherits:
-
Base
- Object
- Base
- CemAcpt::TestRunner::LogFormatter::BoltOutputFormatter
show all
- Defined in:
- lib/cem_acpt/test_runner/log_formatter/bolt_output_formatter.rb
Overview
Formats the results of a Bolt action
Constant Summary
Constants inherited
from Base
CemAcpt::TestRunner::LogFormatter::Base::INDENT
Instance Attribute Summary
Attributes inherited from Base
#subject
Instance Method Summary
collapse
Methods inherited from Base
#inspect, #to_s
Constructor Details
#initialize(config, instance_names_ips, subject: nil) ⇒ BoltOutputFormatter
Returns a new instance of BoltOutputFormatter.
10
11
12
13
14
|
# File 'lib/cem_acpt/test_runner/log_formatter/bolt_output_formatter.rb', line 10
def initialize(config, instance_names_ips, subject: nil)
super(subject)
@config = config
@instance_names_ips = instance_names_ips
end
|
Instance Method Details
#host_name(response = nil) ⇒ Object
40
41
42
43
|
# File 'lib/cem_acpt/test_runner/log_formatter/bolt_output_formatter.rb', line 40
def host_name(response = nil)
super(response)
log_subject.items.map { |i| name_from_ip(i.target) }.compact.uniq.join(', ')
end
|
#results(response = nil) ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/cem_acpt/test_runner/log_formatter/bolt_output_formatter.rb', line 24
def results(response = nil)
super(response)
log_subject.results.map do |res|
prefix = success_str(res.success?).capitalize
parts = [
prefix,
"action #{res.action}",
"host(s) #{host_name(log_subject)}",
"object #{res.object}",
"status #{res.status}",
]
parts << res.error if res.error?
parts.join(': ')
end
end
|
#summary(response = nil) ⇒ Object
16
17
18
19
20
21
22
|
# File 'lib/cem_acpt/test_runner/log_formatter/bolt_output_formatter.rb', line 16
def summary(response = nil)
super(response)
[
"SUMMARY: #{test_name(log_subject)}:",
normalize_whitespace(log_subject.summary),
].join(' ')
end
|
#test_name(response = nil) ⇒ Object
45
46
47
48
49
50
|
# File 'lib/cem_acpt/test_runner/log_formatter/bolt_output_formatter.rb', line 45
def test_name(response = nil)
super(response)
test_type = (log_subject.items.find { |i| i.action != 'unknown' }&.action || 'unknown')
test_objects = log_subject.items.map(&:object).uniq.join(', ')
"Bolt #{test_type} test for: #{test_objects}"
end
|