Sha256: ae81258a04df96176ae438c09e9abc699ad4736098f9187029b4548f0cc1d179

Contents?: true

Size: 1.16 KB

Versions: 3

Compression:

Stored size: 1.16 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 - DEPRECATED'
            app_options
            def logs
              app = ensure_app(options)
              deprecated('This command is deprecated on Aptible v2 stacks.')
              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

3 entries across 3 versions & 1 rubygems

Version Path
aptible-cli-0.6.6 lib/aptible/cli/subcommands/logs.rb
aptible-cli-0.6.4 lib/aptible/cli/subcommands/logs.rb
aptible-cli-0.6.3 lib/aptible/cli/subcommands/logs.rb