Sha256: abe5cc827323d87c72618f3493718df2ff39ab4f98ddb276ade973e27da984e1

Contents?: true

Size: 1.43 KB

Versions: 5

Compression:

Stored size: 1.43 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']
  $stderr.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

5 entries across 5 versions & 1 rubygems

Version Path
kontena-cli-1.1.6 bin/kontena
kontena-cli-1.1.5 bin/kontena
kontena-cli-1.1.5.rc3 bin/kontena
kontena-cli-1.1.5.rc2 bin/kontena
kontena-cli-1.1.5.rc1 bin/kontena