Class: HybridPlatformsConductor::HpcPlugins::Report::Stdout
- Defined in:
- lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb
Overview
Export on stdout
Constant Summary
Constants included from LoggerHelpers
LoggerHelpers::LEVELS_MODIFIERS, LoggerHelpers::LEVELS_TO_STDERR
Class Method Summary collapse
-
.supported_locales ⇒ Object
Give the list of supported locales by this report generator [API] - This method is mandatory.
Instance Method Summary collapse
-
#report_for(nodes, locale_code) ⇒ Object
Create a report for a list of nodes, in a given locale [API] - This method is mandatory.
Methods inherited from Report
Methods inherited from Plugin
extend_config_dsl_with, #initialize, valid?
Methods included from LoggerHelpers
#err, #init_loggers, #log_component=, #log_debug?, #log_level=, #out, #section, #set_loggers_format, #stderr_device, #stderr_device=, #stderr_displayed?, #stdout_device, #stdout_device=, #stdout_displayed?, #stdouts_to_s, #with_progress_bar
Constructor Details
This class inherits a constructor from HybridPlatformsConductor::Report
Class Method Details
.supported_locales ⇒ Object
Give the list of supported locales by this report generator
- API
-
This method is mandatory.
-
- Result
-
Array<Symbol>: List of supported locales
18 19 20 |
# File 'lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb', line 18 def self.supported_locales [:en] end |
Instance Method Details
#report_for(nodes, locale_code) ⇒ Object
Create a report for a list of nodes, in a given locale
- API
-
This method is mandatory.
-
- Parameters
-
nodes (Array<String>): List of nodes
-
locale_code (Symbol): The locale code
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb', line 28 def report_for(nodes, locale_code) @nodes_handler. nodes, %i[hostname host_ip physical image description services] out(Terminal::Table.new(headings: [ 'Node', 'Platform', 'Host name', 'IP', 'Physical?', 'OS', 'Description', 'Services' ]) do |table| nodes.sort.each do |node| table << [ node, @platforms_handler.known_platforms.find { |platform| platform.known_nodes.include?(node) }&.name, @nodes_handler.get_hostname_of(node), @nodes_handler.get_host_ip_of(node), @nodes_handler.get_physical_of(node) ? 'Yes' : 'No', @nodes_handler.get_image_of(node), @nodes_handler.get_description_of(node), (@nodes_handler.get_services_of(node) || []).sort.join(', ') ] end end) end |