Sha256: 4f626ab198be34f024f763c6d1c34e69d80ca76822ea492db276e36a8ce39964

Contents?: true

Size: 756 Bytes

Versions: 9

Compression:

Stored size: 756 Bytes

Contents

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

    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 << "script-security 2 system\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

9 entries across 9 versions & 1 rubygems

Version Path
kontena-cli-0.17.0.pre1 lib/kontena/cli/vpn/config_command.rb
kontena-cli-0.16.3 lib/kontena/cli/vpn/config_command.rb
kontena-cli-0.16.3.rc1 lib/kontena/cli/vpn/config_command.rb
kontena-cli-0.16.2 lib/kontena/cli/vpn/config_command.rb
kontena-cli-0.16.2.rc1 lib/kontena/cli/vpn/config_command.rb
kontena-cli-0.16.1 lib/kontena/cli/vpn/config_command.rb
kontena-cli-0.16.1.rc3 lib/kontena/cli/vpn/config_command.rb
kontena-cli-0.16.1.rc2 lib/kontena/cli/vpn/config_command.rb
kontena-cli-0.16.1.rc1 lib/kontena/cli/vpn/config_command.rb