Sha256: 89d652b327e1f6840e6ed996457bfa7ca7e7e89524083f2b8f472400ee90c77d

Contents?: true

Size: 674 Bytes

Versions: 18

Compression:

Stored size: 674 Bytes

Contents

module Kontena::Cli::Containers
  class ExecCommand < Clamp::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', 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

18 entries across 18 versions & 1 rubygems

Version Path
kontena-cli-0.14.7 lib/kontena/cli/containers/exec_command.rb
kontena-cli-0.14.6 lib/kontena/cli/containers/exec_command.rb
kontena-cli-0.14.5 lib/kontena/cli/containers/exec_command.rb
kontena-cli-0.14.4 lib/kontena/cli/containers/exec_command.rb
kontena-cli-0.14.3 lib/kontena/cli/containers/exec_command.rb
kontena-cli-0.14.2 lib/kontena/cli/containers/exec_command.rb
kontena-cli-0.14.1 lib/kontena/cli/containers/exec_command.rb
kontena-cli-0.14.0 lib/kontena/cli/containers/exec_command.rb
kontena-cli-0.13.4 lib/kontena/cli/containers/exec_command.rb
kontena-cli-0.13.3 lib/kontena/cli/containers/exec_command.rb
kontena-cli-0.13.2 lib/kontena/cli/containers/exec_command.rb
kontena-cli-0.13.1 lib/kontena/cli/containers/exec_command.rb
kontena-cli-0.13.0.1 lib/kontena/cli/containers/exec_command.rb
kontena-cli-0.13.0 lib/kontena/cli/containers/exec_command.rb
kontena-cli-0.12.3 lib/kontena/cli/containers/exec_command.rb
kontena-cli-0.12.2 lib/kontena/cli/containers/exec_command.rb
kontena-cli-0.12.1 lib/kontena/cli/containers/exec_command.rb
kontena-cli-0.12.0 lib/kontena/cli/containers/exec_command.rb