Sha256: ab8f828440c11b4a705f2399f32a13b52facaf058ea4b0f383f25dbba9125398

Contents?: true

Size: 636 Bytes

Versions: 20

Compression:

Stored size: 636 Bytes

Contents

module Kontena::Cli::Containers
  class ExecCommand < Clamp::Command
    include Kontena::Cli::Common

    parameter "CONTAINER_ID", "Container id"
    parameter "CMD ...", "Command"

    def execute
      require_api_url
      token = require_token

      payload = {cmd: ['sh', '-c', cmd_list.join(' ')]}
      service_name = container_id.match(/(.+)-(\d+)/)[1]
      result = client(token).post("containers/#{current_grid}/#{service_name}/#{container_id}/exec", payload)
      puts result[0].join(" ") unless result[0].size == 0
      STDERR.puts result[1].join(" ") unless result[1].size == 0
      exit result[2]
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
kontena-cli-0.11.7 lib/kontena/cli/containers/exec_command.rb
kontena-cli-0.11.6 lib/kontena/cli/containers/exec_command.rb
kontena-cli-0.11.5 lib/kontena/cli/containers/exec_command.rb
kontena-cli-0.11.4 lib/kontena/cli/containers/exec_command.rb
kontena-cli-0.11.3 lib/kontena/cli/containers/exec_command.rb
kontena-cli-0.11.2 lib/kontena/cli/containers/exec_command.rb
kontena-cli-0.11.1 lib/kontena/cli/containers/exec_command.rb
kontena-cli-0.11.0 lib/kontena/cli/containers/exec_command.rb
kontena-cli-0.10.3 lib/kontena/cli/containers/exec_command.rb
kontena-cli-0.10.2 lib/kontena/cli/containers/exec_command.rb
kontena-cli-0.10.1 lib/kontena/cli/containers/exec_command.rb
kontena-cli-0.10.0 lib/kontena/cli/containers/exec_command.rb
kontena-cli-0.9.3 lib/kontena/cli/containers/exec_command.rb
kontena-cli-0.9.2 lib/kontena/cli/containers/exec_command.rb
kontena-cli-0.9.1 lib/kontena/cli/containers/exec_command.rb
kontena-cli-0.9.0 lib/kontena/cli/containers/exec_command.rb
kontena-cli-0.8.4 lib/kontena/cli/containers/exec_command.rb
kontena-cli-0.8.3 lib/kontena/cli/containers/exec_command.rb
kontena-cli-0.8.2 lib/kontena/cli/containers/exec_command.rb
kontena-cli-0.8.1 lib/kontena/cli/containers/exec_command.rb