class Kontena::Cli::Vpn::ConfigCommand

Public Instance Methods

execute() click to toggle source
# File lib/kontena/cli/vpn/config_command.rb, line 6
def execute
  require 'rbconfig'
  require_api_url
  payload = {cmd: ['/usr/local/bin/ovpn_getclient', 'KONTENA_VPN_CLIENT']}
  service = client(require_token).get("services/#{current_grid}/vpn/server/containers")['containers'][0]
  stdout, stderr = client(require_token).post("containers/#{service['id']}/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
linux?() click to toggle source

@return [Boolean]

# File lib/kontena/cli/vpn/config_command.rb, line 22
def linux?
  host_os = RbConfig::CONFIG['host_os']
  host_os.include?('linux')
end