Index: server/site_wifitest.py |
diff --git a/server/site_wifitest.py b/server/site_wifitest.py |
index 5f62ae320c7a5ff876611ffbf7d9b05f3ec9bda3..1ba043b22fc335f46cf560ef53a7fcf7292795b6 100644 |
--- a/server/site_wifitest.py |
+++ b/server/site_wifitest.py |
@@ -8,8 +8,8 @@ from autotest_lib.server import autotest, hosts, subcommand |
from autotest_lib.server import site_bsd_router |
from autotest_lib.server import site_linux_router |
from autotest_lib.server import site_host_attributes |
-from autotest_lib.server import site_eap_tls |
from autotest_lib.server import test |
+from autotest_lib.server.site_eap_certs import * |
Paul Stewart
2011/01/13 01:56:06
I'd prefer if you didn't do "import *" here, and r
|
from autotest_lib.client.common_lib import error |
class NotImplemented(Exception): |
@@ -319,17 +319,37 @@ class WiFiTest(object): |
self.client_installed_scripts[script_name] = script_client_file |
return script_client_file |
Paul Stewart
2011/01/13 01:56:06
It doesn't make sense to copy this function here a
|
+ def insert_file(self, host, filename, contents): |
+ """ |
+ If config files are too big, the "host.run()" never returns. |
+ As a workaround, break the file up into lines and append the |
+ file piece by piece |
+ """ |
+ host.run('rm -f %s >/dev/null 2>&1' % filename, ignore_status=True) |
+ content_lines = contents.splitlines() |
+ while content_lines: |
+ buflist = [] |
+ buflen = 0 |
+ while content_lines and buflen + len(content_lines[0]) < 200: |
+ line = content_lines.pop(0) |
+ buflen += len(line) + 1 |
+ buflist.append(line) |
+ |
+ if not buflist: |
+ raise error.TestFail('Cert profile: line too long: %s' % |
+ content_lines[0]) |
+ host.run('cat <<EOF >>%s\n%s\nEOF\n' % |
+ (filename, '\n'.join(buflist))) |
+ |
def connect(self, params): |
""" Connect client to AP/router """ |
script_client_file = self.install_script('site_wlan_connect.py', |
'site_wlan_wait_state.py') |
- if 'eap-tls' in params: |
- params.update(site_eap_tls.client_config(self.client, |
- params['eap-tls'], |
- params.get('server-auth', |
- None))) |
+ if 'files' in params: |
Paul Stewart
2011/01/13 01:56:06
Instead of having this as a parameter to "connect"
|
+ for name,contents in params['files'].iteritems(): |
+ self.insert_file(self.client, name, contents) |
flags = [] |
if params.get('debug', True): |