-"""Global parameters and configuration."""
-
-try:
- from bwlimit import bwmin, bwmax
-
- DEFAULT_RSPEC = {'nm_cpu_share': 32, 'nm_cpu_guaranteed_share': 0,
- 'nm_disk_quota': 5000000,
- 'nm_enabled': 1,
- 'nm_net_min_rate': bwmin, 'nm_net_max_rate': bwmax,
- 'nm_net_exempt_min_rate': bwmin,
- 'nm_net_exempt_max_rate': bwmax,
- 'nm_net_share': 1}
-except ImportError: pass
-
-API_SERVER_PORT = 812
-
-DB_FILE = '/root/pl_node_mgr_db.pickle'
-
-KEY_FILE = '/home/deisenst/nm/key.pem'
-
-LOANABLE_RESOURCES = set(['nm_cpu_share', 'nm_cpu_guaranteed_share',
- 'nm_net_max_rate', 'nm_net_exempt_max_rate',
- 'nm_net_share'])
-
-LOG_FILE = '/var/log/pl_node_mgr.log'
-
-PID_FILE = '/var/run/pl_node_mgr.pid'
-
-SA_HOSTNAME = 'plc-a.demo.vmware'
-
-START_DELAY_SECS = 10
-
-TICKET_SERVER_PORT = 1813
+#!/usr/bin/python
+#
+# Parses the PLC configuration file /etc/planetlab/plc_config, which
+# is bootstrapped by Boot Manager, but managed by us.
+#
+# Mark Huang <mlhuang@cs.princeton.edu>
+# Copyright (C) 2006 The Trustees of Princeton University
+#
+# $Id$
+#
+
+import os
+
+class Config:
+ """
+ Parses Python configuration files; all variables in the file are
+ assigned to class attributes.
+ """
+
+ def __init__(self, file = "/etc/planetlab/plc_config"):
+ try:
+ execfile(file, self.__dict__)
+ except:
+ raise Exception, "Could not parse " + file
+
+ if int(self.PLC_API_PORT) == 443:
+ uri = "https://"
+ if hasattr(self, 'PLC_API_CA_SSL_CRT'):
+ self.cacert = self.PLC_API_CA_SSL_CRT
+ elif os.path.exists('/usr/boot/cacert.pem'):
+ self.cacert = '/usr/boot/cacert.pem'
+ else:
+ raise Exception, "No boot server certificate bundle available"
+ else:
+ uri = "http://"
+ self.cacert = None
+
+ uri += self.PLC_API_HOST + \
+ ":" + str(self.PLC_API_PORT) + \
+ "/" + self.PLC_API_PATH + "/"
+
+ self.plc_api_uri = uri
+
+
+if __name__ == '__main__':
+ from pprint import pprint
+ pprint(Config().__dict__.items())