Sha256: dd4cfd37ef0f1fc82fc9318fb778b3fa33aec2bc0bc738487caff5b631111fe5

Contents?: true

Size: 1.11 KB

Versions: 8

Compression:

Stored size: 1.11 KB

Contents

require 'shellwords'

module Aptible
  module CLI
    module Subcommands
      module Logs
        def self.included(thor)
          thor.class_eval do
            include Helpers::Operation
            include Helpers::App

            desc 'logs', 'Follows logs from a running app'
            option :app
            option :remote, aliases: '-r'
            def logs
              app = ensure_app(options)

              unless app.status == 'provisioned' && app.services.any?
                fail Thor::Error, 'Unable to retrieve logs. ' \
                                  "Have you deployed #{app.handle} yet?"
              end

              host = app.account.bastion_host
              port = app.account.dumptruck_port

              ENV['ACCESS_TOKEN'] = fetch_token
              ENV['APTIBLE_APP'] = app.handle
              ENV['APTIBLE_CLI_COMMAND'] = 'logs'

              opts = " -o 'SendEnv=*' -o StrictHostKeyChecking=no " \
                     '-o UserKnownHostsFile=/dev/null'
              Kernel.exec "ssh #{opts} -p #{port} root@#{host}"
            end
          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
aptible-cli-0.6.0 lib/aptible/cli/subcommands/logs.rb
aptible-cli-0.5.15 lib/aptible/cli/subcommands/logs.rb
aptible-cli-0.5.14 lib/aptible/cli/subcommands/logs.rb
aptible-cli-0.5.13 lib/aptible/cli/subcommands/logs.rb
aptible-cli-0.5.12 lib/aptible/cli/subcommands/logs.rb
aptible-cli-0.5.11 lib/aptible/cli/subcommands/logs.rb
aptible-cli-0.5.10 lib/aptible/cli/subcommands/logs.rb
aptible-cli-0.5.9 lib/aptible/cli/subcommands/logs.rb