First pass at an implementation of a message of the day. Decided
that storing the motd in a file called motd.txt in the same dir
as rpc_interface.py was the simplest solution.
Signed-off-by: Travis Miller <raphtee@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@2659 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/frontend/afe/rpc_utils.py b/frontend/afe/rpc_utils.py
index ad0080f..cf621bc 100644
--- a/frontend/afe/rpc_utils.py
+++ b/frontend/afe/rpc_utils.py
@@ -215,3 +215,19 @@
'(%d/%s, %d included, %d expected'
% (queue_entry.job.id, queue_entry.execution_subdir,
execution_count, queue_entry.job.synch_count)})
+
+
+def get_motd():
+ dirname = os.path.dirname(__file__)
+ filename = os.path.join(dirname, "..", "..", "motd.txt")
+ text = ''
+ try:
+ fp = open(filename, "r")
+ try:
+ text = fp.read()
+ finally:
+ fp.close()
+ except:
+ pass
+
+ return text