=== modified file 'lava_dispatcher/__init__.py'
@@ -47,8 +47,7 @@
@property
def image_type(self):
- if self.job_data.has_key('image_type'):
- return self.job_data['image_type']
+ return self.job_data.get('image_type')
def run(self):
lava_commands = get_all_cmds()
@@ -135,17 +134,12 @@
def _assign_uuid(self):
self._test_run['analyzer_assigned_uuid'] = str(uuid1())
- @property
- def job_status(self):
- return self._job_status
-
- @job_status.setter
- def job_status(self, status):
- self._job_status = status
-
def add_result(self, test_case_id, result, message=""):
- result_data = { 'test_case_id': test_case_id, 'result': result \
- , 'message': message}
+ result_data = {
+ 'test_case_id': test_case_id,
+ 'result': result,
+ 'message': message
+ }
self._test_run['test_results'].append(result_data)
def add_attachment(self, attachment):
=== modified file 'lava_dispatcher/actions/deploy.py'
@@ -20,7 +20,6 @@
from commands import getoutput, getstatusoutput
import os
-import sys
import re
import shutil
import traceback
@@ -50,8 +49,8 @@
raise CriticalError("Unable to reach LAVA server, check network")
try:
- boot_tgz, root_tgz = self.generate_tarballs(hwpack, rootfs,
- use_cache)
+ boot_tgz, root_tgz = self.generate_tarballs(
+ hwpack, rootfs, use_cache)
except:
tb = traceback.format_exc()
client.sio.write(tb)
=== modified file 'lava_dispatcher/actions/lava-test.py'
@@ -21,12 +21,12 @@
# with this program; if not, see <http://www.gnu.org/licenses>.
from datetime import datetime
-import sys
import traceback
from lava_dispatcher.actions import BaseAction
from lava_dispatcher.client import OperationFailed
from lava_dispatcher.config import LAVA_RESULT_DIR, MASTER_STR
+
def _setup_testrootfs(client):
#Make sure in master image
#, or exception can be caught and do boot_master_image()
@@ -44,6 +44,7 @@
# (/dev/pts not mounted?), does not work
client.run_cmd_master('mount --rbind /dev /mnt/root/dev')
+
def _teardown_testrootfs(client):
client.run_cmd_master(
'cp -f /mnt/root/etc/resolv.conf.bak /mnt/root/etc/resolv.conf')
@@ -54,6 +55,7 @@
client.run_cmd_master(
'umount /mnt/root')
+
def _install_lava_test(client):
#install bazaar in tester image
client.run_cmd_master(
@@ -78,6 +80,7 @@
_teardown_testrootfs(client)
raise OperationFailed("lava-test deployment failed")
+
class cmd_lava_test_run(BaseAction):
def run(self, test_name, timeout=-1):
#Make sure in test image now
@@ -119,6 +122,7 @@
_teardown_testrootfs(client)
+
class cmd_add_apt_repository(BaseAction):
"""
add apt repository to test image rootfs by chroot
@@ -127,7 +131,7 @@
def run(self, arg):
client = self.client
_setup_testrootfs(client)
-
+
#install add-apt-repository
client.run_cmd_master('chroot /mnt/root apt-get -y install python-software-properties')
@@ -136,5 +140,3 @@
client.run_cmd_master('chroot /mnt/root apt-get update')
_teardown_testrootfs(client)
-
-
=== modified file 'lava_dispatcher/android_client.py'
@@ -109,7 +109,7 @@
network_interface = self.board.default_network_interface
try:
self.run_cmd_tester(
- 'netcfg %s dhcp' % network_interface, timeout = 60)
+ 'netcfg %s dhcp' % network_interface, timeout=60)
except:
print "netcfg %s dhcp exception" % network_interface
return False
@@ -120,7 +120,7 @@
self.proc.sendline('')
self.proc.sendline(cmd)
try:
- id = self.proc.expect([ip_pattern, pexpect.EOF], timeout = 60)
+ id = self.proc.expect([ip_pattern, pexpect.EOF], timeout=60)
except:
print "ifconfig can not match ip pattern"
return False
=== modified file 'lava_dispatcher/client.py'
@@ -45,13 +45,13 @@
self.board = BOARDS[hostname]
@property
- def master_str(self):
+ def master_str(self):
return self._master_str
-
+
@property
- def tester_str(self):
+ def tester_str(self):
return self._tester_str
-
+
def in_master_shell(self):
""" Check that we are in a shell on the master image
"""
@@ -176,6 +176,7 @@
def get_seriallog(self):
return self.sio.getvalue()
+
class SerialIO(file):
def __init__(self, logfile):
self.serialio = StringIO()
@@ -195,27 +196,32 @@
def getvalue(self):
return self.serialio.getvalue()
+
class DispatcherError(Exception):
"""
Base exception and error class for dispatcher
"""
+
class CriticalError(DispatcherError):
"""
The critical error
"""
+
class GeneralError(DispatcherError):
"""
The non-critical error
"""
+
class NetworkError(CriticalError):
"""
This is used when a network error occurs, such as failing to bring up
the network interface on the client
"""
+
class OperationFailed(GeneralError):
pass