Module: Aptible::CLI::Subcommands::Ps

Included in:
Agent
Defined in:
lib/aptible/cli/subcommands/ps.rb

Class Method Summary collapse

Class Method Details

.included(thor) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/aptible/cli/subcommands/ps.rb', line 7

def self.included(thor)
  thor.class_eval do
    include Helpers::Operation
    include Helpers::App
    include Helpers::Env

    desc 'ps', 'Display running processes for an app - DEPRECATED'
    app_options
    def ps
      app = ensure_app(options)
      deprecated('This command is deprecated on Aptible v2 stacks.')

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

      set_env('ACCESS_TOKEN', fetch_token)
      set_env('APTIBLE_APP', app.handle)
      set_env('APTIBLE_CLI_COMMAND', 'ps')

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