remove dead setup argument
[nodemanager.git] / config.py
index 14ee71d..9efdecc 100644 (file)
--- a/config.py
+++ b/config.py
@@ -1,14 +1,19 @@
 #!/usr/bin/python
 #
+# $Id$
+# $URL$
+#
 # 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: config.py,v 1.3 2006/10/31 23:15:12 mlhuang Exp $
+# $Id$
 #
 
+import os
+
 class Config:
     """
     Parses Python configuration files; all variables in the file are
@@ -23,8 +28,15 @@ class Config:
 
         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) + \
@@ -32,6 +44,9 @@ class Config:
 
         self.plc_api_uri = uri
 
+
 if __name__ == '__main__':
     from pprint import pprint
-    pprint(Config().__dict__.items())
+    for (k,v) in Config().__dict__.iteritems():
+        if k not in ['__builtins__']:
+            pprint ( (k,v), )