Sha256: 97e77533d0a3cdf76065aa0e95b237e0659a2b8fcd8f2e2ac6a241466964cdf4

Contents?: true

Size: 1.85 KB

Versions: 31

Compression:

Stored size: 1.85 KB

Contents

require 'hybrid_platforms_conductor/report'
require 'terminal-table'

module HybridPlatformsConductor

  module HpcPlugins

    module Report

      # Export on stdout
      class Stdout < HybridPlatformsConductor::Report

        # Give the list of supported locales by this report generator
        # [API] - This method is mandatory.
        #
        # Result::
        # * Array<Symbol>: List of supported locales
        def self.supported_locales
          [:en]
        end

        # 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
        def report_for(nodes, _locale_code)
          @nodes_handler.prefetch_metadata_of 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

      end

    end

  end

end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
hybrid_platforms_conductor-33.9.5 lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb
hybrid_platforms_conductor-33.9.4 lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb
hybrid_platforms_conductor-33.9.2 lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb
hybrid_platforms_conductor-33.9.1 lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb
hybrid_platforms_conductor-33.9.0 lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb
hybrid_platforms_conductor-33.8.4 lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb
hybrid_platforms_conductor-33.8.3 lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb
hybrid_platforms_conductor-33.8.2 lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb
hybrid_platforms_conductor-33.8.1 lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb
hybrid_platforms_conductor-33.8.0 lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb
hybrid_platforms_conductor-33.7.4 lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb
hybrid_platforms_conductor-33.7.3 lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb
hybrid_platforms_conductor-33.7.2 lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb
hybrid_platforms_conductor-33.7.1 lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb
hybrid_platforms_conductor-33.7.0 lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb
hybrid_platforms_conductor-33.6.0 lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb
hybrid_platforms_conductor-33.5.1 lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb
hybrid_platforms_conductor-33.5.0 lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb
hybrid_platforms_conductor-33.4.0 lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb
hybrid_platforms_conductor-33.3.0 lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb