Sha256: 2bd3574ce4d8cdb6b204e74a4e8188d54720de9c88fa7a12b0ec73613814b8da

Contents?: true

Size: 768 Bytes

Versions: 7

Compression:

Stored size: 768 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("services/#{current_grid}/vpn/server/containers/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

7 entries across 7 versions & 1 rubygems

Version Path
kontena-cli-1.0.0.pre3 lib/kontena/cli/vpn/config_command.rb
kontena-cli-1.0.0.pre2 lib/kontena/cli/vpn/config_command.rb
kontena-cli-1.0.0.pre1 lib/kontena/cli/vpn/config_command.rb
kontena-cli-0.17.0.pre5 lib/kontena/cli/vpn/config_command.rb
kontena-cli-0.17.0.pre4 lib/kontena/cli/vpn/config_command.rb
kontena-cli-0.17.0.pre3 lib/kontena/cli/vpn/config_command.rb
kontena-cli-0.17.0.pre2 lib/kontena/cli/vpn/config_command.rb