svn:keywords
[bootmanager.git] / source / steps / StartRunlevelAgent.py
1 #!/usr/bin/python
2 #
3 # $Id$
4 # $URL$
5 #
6 # Copyright (c) 2003 Intel Corporation
7 # All rights reserved.
8 #
9 # Copyright (c) 2004-2006 The Trustees of Princeton University
10 # All rights reserved.
11
12
13 import os
14
15 from Exceptions import *
16 import BootAPI
17
18
19 def Run( vars, log ):
20     """
21         Start the RunlevelAgent.py script.  Should follow
22         AuthenticateWithPLC() in order to guarantee that
23         /etc/planetlab/session is present.
24     """
25
26     log.write( "\n\nStep: Starting RunlevelAgent.py\n" )
27
28     try:
29         cmd = "%s/monitor-runlevelagent" % vars['BM_SOURCE_DIR']
30         # raise error if script is not present.
31         os.stat(cmd)
32         # init script only starts RLA once.
33         os.system("/bin/sh %s start bootmanager" % cmd)
34     except KeyError, var:
35         raise BootManagerException, "Missing variable in vars: %s\n" % var
36     except ValueError, var:
37         raise BootManagerException, "Variable in vars, shouldn't be: %s\n" % var
38
39     return 1
40     
41