I wanted some jobs to select the server side component based on a platform
label, so this patch will add a function that returns the platform_label of
the specified hostname.
Long term, I think it would be best to expose this as an attribute of the
AbstractSSHHost class, since it would then be very easy to access these
details and we wouldn't need to run any methods to grab them. I'm not
familiar enough yet with the code to understand how to best implement this,
so my work around is the attached patch.
Kelly
--
K.D. Lucas
[email protected]
Index: client/common_lib/utils.py
===================================================================
--- client/common_lib/utils.py (revision 4241)
+++ client/common_lib/utils.py (working copy)
@@ -1239,3 +1239,22 @@
command = command.replace('"', r'\"')
command = command.replace('`', r'\`')
return command
+
+
+def get_platform_label(machine, resultdir):
+ """
+ Determines the platform label of a host, if it has one.
+
+ Args:
+ machine: host name of the machine.
+ resultdir: the path of the job result directory (job.resultdir).
+ Returns:
+ string: the platform label. None if there is no platform label.
+ """
+
+ keyval_path = os.path.join(resultdir, 'host_keyvals', machine)
+ keyvals = read_keyval(keyval_path)
+ if 'platform' in keyvals:
+ return keyvals['platform']
+ else:
+ return None
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest