OLD | NEW |
---|---|
(Empty) | |
1 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved. | |
2 # Use of this source code is governed by a BSD-style license that can be | |
3 # found in the LICENSE file. | |
4 | |
5 import logging, re, time | |
6 from autotest_lib.client.common_lib import error | |
7 | |
8 class LinuxServer(object): | |
9 """ | |
10 Linux Server: A machine which hosts network services. | |
11 | |
12 """ | |
13 | |
14 def __init__(self, server, params): | |
15 self.server = server # Server host. | |
16 | |
17 def vpn_create_server_config(self, params): | |
18 """ Configure the server side of the VPN. """ | |
19 conf = {} | |
20 for k, v in params.iteritems(): | |
21 conf[k] = v | |
22 | |
23 # Generate config file. | |
24 self.server.run("mkdir -p /tmp/vpn && cat <<EOF >%s\n%s\nEOF\n" % | |
25 ('/tmp/vpn/server.conf', '\n'.join( | |
26 "%s %s" % kv for kv in conf.iteritems()))) | |
27 | |
28 def vpn_launch_server(self, params): | |
Paul Stewart
2011/03/03 23:18:42
The function name says "vpn_xxx" but you're really
| |
29 """ Begin executing the server side of the VPN. """ | |
30 self.server.run("/usr/sbin/openvpn --config /tmp/vpn/server.conf &") | |
31 | |
32 def vpn_kill_server(self, params): | |
33 """ Kill the OpenVPN server. """ | |
34 self.server.run("pkill /usr/sbin/openvpn") | |
OLD | NEW |