Sha256: b6ec9c67d3b588cc7a8a87b61d3ef147e1197035007af1bb8a2172dea7d326ed

Contents?: true

Size: 647 Bytes

Versions: 47

Compression:

Stored size: 647 Bytes

Contents

require_relative '../grid_options'

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

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

    def execute
      require_api_url
      token = require_token

      payload = {cmd: ["sh", "-c", Shellwords.join(cmd_list)]}
      result = client(token).post("containers/#{current_grid}/#{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

47 entries across 47 versions & 1 rubygems

Version Path
kontena-cli-1.1.6 lib/kontena/cli/containers/exec_command.rb
kontena-cli-1.2.0.pre1 lib/kontena/cli/containers/exec_command.rb
kontena-cli-1.1.5 lib/kontena/cli/containers/exec_command.rb
kontena-cli-1.1.5.rc3 lib/kontena/cli/containers/exec_command.rb
kontena-cli-1.1.5.rc2 lib/kontena/cli/containers/exec_command.rb
kontena-cli-1.1.5.rc1 lib/kontena/cli/containers/exec_command.rb
kontena-cli-1.1.4 lib/kontena/cli/containers/exec_command.rb
kontena-cli-1.2.0.dev1 lib/kontena/cli/containers/exec_command.rb
kontena-cli-1.1.3 lib/kontena/cli/containers/exec_command.rb
kontena-cli-1.1.2 lib/kontena/cli/containers/exec_command.rb
kontena-cli-1.1.2.rc2 lib/kontena/cli/containers/exec_command.rb
kontena-cli-1.1.2.rc1 lib/kontena/cli/containers/exec_command.rb
kontena-cli-1.1.1 lib/kontena/cli/containers/exec_command.rb
kontena-cli-1.1.1.rc1 lib/kontena/cli/containers/exec_command.rb
kontena-cli-1.1.0 lib/kontena/cli/containers/exec_command.rb
kontena-cli-1.1.0.rc2 lib/kontena/cli/containers/exec_command.rb
kontena-cli-1.1.0.rc1 lib/kontena/cli/containers/exec_command.rb
kontena-cli-1.1.0.pre1 lib/kontena/cli/containers/exec_command.rb
kontena-cli-1.0.6 lib/kontena/cli/containers/exec_command.rb
kontena-cli-1.0.6.rc1 lib/kontena/cli/containers/exec_command.rb