3 # Parses the PLC configuration file /etc/planetlab/plc_config, which
4 # is bootstrapped by Boot Manager, but managed by us.
6 # Mark Huang <mlhuang@cs.princeton.edu>
7 # Copyright (C) 2006 The Trustees of Princeton University
9 # $Id: config.py,v 1.3 2006/10/31 23:15:12 mlhuang Exp $
14 Parses Python configuration files; all variables in the file are
15 assigned to class attributes.
18 def __init__(self, file = "/etc/planetlab/plc_config"):
20 execfile(file, self.__dict__)
22 raise Exception, "Could not parse " + file
24 if int(self.PLC_API_PORT) == 443:
29 uri += self.PLC_API_HOST + \
30 ":" + str(self.PLC_API_PORT) + \
31 "/" + self.PLC_API_PATH + "/"
33 self.plc_api_uri = uri
35 if __name__ == '__main__':
36 from pprint import pprint
37 pprint(Config().__dict__.items())