X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=config.py;h=a56fb476f1fc605354366dce207239f4535436bb;hb=e4069fdeaf5f672c866f3c9e5eb489284790c36c;hp=f9c5920cf2bad5257db8a89bc9b477d0b2069ba7;hpb=3224c1906c82596a86ae734181488ed14a0f0976;p=nodemanager.git diff --git a/config.py b/config.py index f9c5920..a56fb47 100644 --- a/config.py +++ b/config.py @@ -1,16 +1,11 @@ #!/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 # Copyright (C) 2006 The Trustees of Princeton University # -# $Id$ -# import os @@ -22,9 +17,9 @@ class Config: def __init__(self, file = "/etc/planetlab/plc_config"): try: - execfile(file, self.__dict__) + exec(compile(open(file).read(), file, 'exec'), self.__dict__) except: - raise Exception, "Could not parse " + file + raise Exception("Could not parse " + file) if int(self.PLC_API_PORT) == 443: uri = "https://" @@ -33,7 +28,7 @@ class Config: elif os.path.exists('/usr/boot/cacert.pem'): self.cacert = '/usr/boot/cacert.pem' else: - raise Exception, "No boot server certificate bundle available" + raise Exception("No boot server certificate bundle available") else: uri = "http://" self.cacert = None @@ -47,4 +42,6 @@ class Config: if __name__ == '__main__': from pprint import pprint - pprint(Config().__dict__.items()) + for (k, v) in Config().__dict__.items(): + if k not in ['__builtins__']: + pprint ( (k, v), )