add plc_rt_dbpassword
[plcrt.git] / callplcsh.py
1 #!/usr/bin/python
2
3 import os
4 import sys
5
6 #NOTE: I'm so sorry for this.
7 try:
8         # if this file deos not exist, then we will jump to the exception and use
9         # the local PLCSH without passing any additional arguments.
10
11         os.stat("/etc/planetlab/master.py")
12         sys.path.append("/etc/planetlab")
13         import master
14
15         # Use the values given to us in the /etc/planetlab/master.py file taken from
16         # the master PLC and use them to construct the proper arguments to plcsh so
17         # that we can get a user list from managing, CoPLC
18
19         user=master.PLC_ROOT_USER
20         passwd=master.PLC_ROOT_PASSWORD
21         url = "https://" + master.PLC_API_HOST + ":" \
22                         + master.PLC_API_PORT + master.PLC_API_PATH
23
24         cmd = "plcsh --user=%s --password=%s --url=%s %s" % (user, 
25                         passwd, url, " ".join(sys.argv[1:]))
26 except:
27         cmd = "plcsh %s" % " ".join(sys.argv[1:])
28
29 os.system(cmd)