Sha256: bd413327c543de2faa8379e6ee82c8fe9ced63473cac437ef1aba8a321caaaad

Contents?: true

Size: 1.42 KB

Versions: 11

Compression:

Stored size: 1.42 KB

Contents

#!/usr/bin/env ruby
# encoding: UTF-8

# resolve bin path, ignoring symlinks
require 'pathname'
bin_file = Pathname.new(__FILE__).realpath

# add self to libpath
$:.unshift File.expand_path('../../lib', bin_file)

require 'kontena_cli'
STDOUT.sync = true

begin
  Kontena::PluginManager.instance.init
  Kontena::MainCommand.run
rescue Excon::Errors::SocketError => exc
  if exc.message.include?('Unable to verify certificate')
    $stderr.puts " [#{Kontena.pastel.red('error')}] The server uses a certificate signed by an unknown authority."
    $stderr.puts "         You can trust this server by copying server CA pem file to: #{Kontena.pastel.yellow("~/.kontena/certs/<hostname>.pem")}"
    $stderr.puts "         Protip: you can bypass the certificate check by setting #{Kontena.pastel.yellow('SSL_IGNORE_ERRORS=true')} env variable, but any data you send to the server could be intercepted by others."
    abort
  else
    abort(exc.message)
  end
rescue Kontena::Errors::StandardError => exc
  raise exc if ENV['DEBUG']
  puts " [#{Kontena.pastel.red('error')}] #{exc.message}"
  abort
rescue Errno::EPIPE
  # If user is piping the command outputs to some other command that might exit before CLI has outputted everything
  abort
rescue => exc
  raise exc if ENV['DEBUG']
  $stderr.puts " [#{Kontena.pastel.red('error')}] #{exc.message}"
  $stderr.puts "         Rerun the command with environment DEBUG=true set to get the full exception"
  abort
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
kontena-cli-1.1.4 bin/kontena
kontena-cli-1.1.3 bin/kontena
kontena-cli-1.1.2 bin/kontena
kontena-cli-1.1.2.rc2 bin/kontena
kontena-cli-1.1.2.rc1 bin/kontena
kontena-cli-1.1.1 bin/kontena
kontena-cli-1.1.1.rc1 bin/kontena
kontena-cli-1.1.0 bin/kontena
kontena-cli-1.1.0.rc2 bin/kontena
kontena-cli-1.1.0.rc1 bin/kontena
kontena-cli-1.1.0.pre1 bin/kontena