Sha256: 3b4bb97bd0db544648a655d676bc62c5fc2e9e11caa7a5b051cb062d196bed5c

Contents?: true

Size: 980 Bytes

Versions: 1

Compression:

Stored size: 980 Bytes

Contents

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

          def reboot(server:, user: 'root', delay: 0, **opts)
            session = session(server: server, user: user, **opts)
            command = delay.zero? ? 'shutdown -r now' : "shutdown -r +#{delay}"
            results = session.exec!(command)
            { success: results.exitstatus.zero?, results: results, server: server, delay: delay }
          end

          def shutdown(server:, user: 'root', delay: 0, **opts)
            session = session(server: server, user: user, **opts)
            command = delay.zero? ? 'shutdown -h now' : "shutdown -h +#{delay}"
            results = session.exec!(command)
            { success: results.exitstatus.zero?, results: results, server: server, delay: delay }
          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/state.rb