Sha256: 4ee2115d01d5f1ec93445c901992a25d943b3d68af39a64df2d73d24611b638c

Contents?: true

Size: 1.74 KB

Versions: 36

Compression:

Stored size: 1.74 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

36 entries across 36 versions & 1 rubygems

Version Path
hybrid_platforms_conductor-33.0.0 lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb
hybrid_platforms_conductor-32.18.0 lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb
hybrid_platforms_conductor-32.17.1 lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb
hybrid_platforms_conductor-32.17.0 lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb
hybrid_platforms_conductor-32.16.4 lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb
hybrid_platforms_conductor-32.16.3 lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb
hybrid_platforms_conductor-32.16.2 lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb
hybrid_platforms_conductor-32.16.1 lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb
hybrid_platforms_conductor-32.16.0 lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb
hybrid_platforms_conductor-32.15.0 lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb
hybrid_platforms_conductor-32.14.0 lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb
hybrid_platforms_conductor-32.13.4 lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb
hybrid_platforms_conductor-32.13.3 lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb
hybrid_platforms_conductor-32.13.2 lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb
hybrid_platforms_conductor-32.13.1 lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb
hybrid_platforms_conductor-32.13.0 lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb
hybrid_platforms_conductor-32.12.0 lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb
hybrid_platforms_conductor-32.11.2 lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb
hybrid_platforms_conductor-32.11.1 lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb
hybrid_platforms_conductor-32.11.0 lib/hybrid_platforms_conductor/hpc_plugins/report/stdout.rb