Class: Ecsl::Exec

Inherits:
Object
  • Object
show all
Defined in:
lib/ecsl/exec.rb

Instance Method Summary collapse

Constructor Details

#initializeExec

Returns a new instance of Exec.



10
11
12
13
14
15
16
17
# File 'lib/ecsl/exec.rb', line 10

def initialize
  @profile = nil
  @filter = nil
  @region = nil
  @prompt = TTY::Prompt.new(interrupt: :exit)
  @ecs_client = nil
  parse_options
end

Instance Method Details

#runObject



19
20
21
22
23
24
25
26
27
# File 'lib/ecsl/exec.rb', line 19

def run
  cluster = select_cluster
  task, container = select_service_and_container(cluster)

  command = ["aws", "--profile", @profile, "--region", @region, "ecs", "execute-command",
            "--cluster", cluster, "--task", task, "--container", container,
            "--interactive", "--command", "/bin/bash"].join(" ")
  puts command
end