=== modified file 'lava_dispatcher/device/master.py'
@@ -81,6 +81,7 @@
}
self.master_ip = None
+ self.device_version = None
if config.pre_connect_command:
logging_system(config.pre_connect_command)
@@ -88,6 +89,9 @@
self.proc = self._connect_carefully(config.connection_command)
atexit.register(self._close_logging_spawn)
+ def get_device_version(self):
+ return self.device_version
+
def power_on(self):
self._boot_linaro_image()
return self.proc
@@ -400,6 +404,7 @@
runner = MasterCommandRunner(self)
try:
self.master_ip = runner.get_master_ip()
+ self.device_version = runner.get_device_version()
except NetworkError as e:
msg = "Failed to get network up: " % e
logging.warning(msg)
@@ -518,6 +523,27 @@
logging.debug("Master image IP is %s" % ip)
return ip
+ def get_device_version(self):
+ pattern = 'device_version=(\d+-\d+/\d+-\d+)'
+ self.run("echo \"device_version="
+ "$(lava-master-image-info --master-image-hwpack "
+ "| sed 's/[^0-9-]//g; s/^-\+//')"
+ "/"
+ "$(lava-master-image-info --master-image-rootfs "
+ "| sed 's/[^0-9-]//g; s/^-\+//')"
+ "\"",
+ [pattern, pexpect.EOF, pexpect.TIMEOUT],
+ timeout = 5)
+
+ device_version = None
+ if self.match_id == 0:
+ device_version = self.match.group(1)
+ logging.debug('Master image version (hwpack/rootfs) is %s' % device_version)
+ else:
+ logging.warning('Could not determine image version!')
+
+ return device_version
+
def has_partition_with_label(self, label):
if not label:
return False
=== modified file 'lava_dispatcher/job.py'
@@ -148,7 +148,6 @@
metadata = {
'target.hostname': self.target,
- 'target.device_version': self.context.get_device_version(),
}
if 'device_type' in self.job_data:
@@ -232,6 +231,10 @@
self.context.test_data.job_status = 'fail'
raise
finally:
+ device_version = self.context.get_device_version() or 'error'
+ self.context.test_data.add_metadata({
+ 'target.device_version': device_version
+ })
if submit_results:
params = submit_results.get('parameters', {})
action = lava_commands[submit_results['command']](