Sha256: b84e987e4d334cb65e27aa1919425996b8eeb618145e4e95bd2a1be369b7829d

Contents?: true

Size: 548 Bytes

Versions: 2

Compression:

Stored size: 548 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]}
      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

2 entries across 2 versions & 1 rubygems

Version Path
kontena-cli-0.8.0.1 lib/kontena/cli/containers/exec_command.rb
kontena-cli-0.8.0 lib/kontena/cli/containers/exec_command.rb