Sha256: c9edcce8f4489db43306a0ba96e17f62201e154d89de0e00aa03f1decb14d4ed

Contents?: true

Size: 917 Bytes

Versions: 1

Compression:

Stored size: 917 Bytes

Contents

module Legion
  module Extensions
    module Ssh
      module Runners
        module Command
          include Legion::Extensions::Ssh::Helpers::Connection

          def run(command:, server:, user: 'root', **opts)
            session = session(server: server, user: user, **opts)
            results = session.exec!(command)
            { success: results.exitstatus.zero?, results: results, server: server }
          end

          def run_mulitple(commands:, server:, user: 'root', **opts)
            session = session(server: server, user: user, **opts)
            final_results = []

            commands.each do |command|
              results = session.exec!(command)
              final_results.push({ success: results.exitstatus.zero?, results: results })
            end
            final_results
          end

          include Legion::Extensions::Helpers::Lex
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lex-ssh-0.1.1 lib/legion/extensions/ssh/runners/command.rb