# $Id$
#
+import os
+
class Config:
"""
Parses Python configuration files; all variables in the file are
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())