Sha256: 43e351003c790c8f54efa489cc115e2ff158a7b6a9e8586f51f098dbb251b115

Contents?: true

Size: 669 Bytes

Versions: 14

Compression:

Stored size: 669 Bytes

Contents

module Kontena::Cli::Vpn
  class ConfigCommand < Clamp::Command
    include Kontena::Cli::Common

    def execute
      require 'rbconfig'
      require_api_url
      payload = {cmd: ['/usr/local/bin/ovpn_getclient', 'KONTENA_VPN_CLIENT']}
      stdout, stderr = client(require_token).post("containers/#{current_grid}/vpn/vpn-1/exec", payload)
      if linux?
        stdout << "\n"
        stdout << "up /etc/openvpn/update-resolv-conf\n"
        stdout << "down /etc/openvpn/update-resolv-conf\n"
      end
      puts stdout
    end

    # @return [Boolean]
    def linux?
      host_os = RbConfig::CONFIG['host_os']
      host_os.include?('linux')
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
kontena-cli-0.11.7 lib/kontena/cli/vpn/config_command.rb
kontena-cli-0.11.6 lib/kontena/cli/vpn/config_command.rb
kontena-cli-0.11.5 lib/kontena/cli/vpn/config_command.rb
kontena-cli-0.11.4 lib/kontena/cli/vpn/config_command.rb
kontena-cli-0.11.3 lib/kontena/cli/vpn/config_command.rb
kontena-cli-0.11.2 lib/kontena/cli/vpn/config_command.rb
kontena-cli-0.11.1 lib/kontena/cli/vpn/config_command.rb
kontena-cli-0.11.0 lib/kontena/cli/vpn/config_command.rb
kontena-cli-0.10.3 lib/kontena/cli/vpn/config_command.rb
kontena-cli-0.10.2 lib/kontena/cli/vpn/config_command.rb
kontena-cli-0.10.1 lib/kontena/cli/vpn/config_command.rb
kontena-cli-0.10.0 lib/kontena/cli/vpn/config_command.rb
kontena-cli-0.9.3 lib/kontena/cli/vpn/config_command.rb
kontena-cli-0.9.2 lib/kontena/cli/vpn/config_command.rb