-
- class PMAConfigGenerator():
- def __init__(self, instname=''):
- self.log = logging.getLogger('sflog')
- if not instname:
- raise ValueError('instname cannot be empty')
-
- if not os.path.isfile('pma-' + instname + '.ini'):
- raise FileNotFoundError('Could not find instance configuration file')
- else:
- self.instname = 'pma-' + instname
- self.cfgfile = self.instname + '.ini'
-
- self.log.debug('PMAConfigGenerator instance for %s initiated' % self.instname)
-
- try:
- self.cfg = ConfigParser()
- self.cfg.read(self.cfgfile)
- except Exception, e:
- self.log.critical('Unable to parse config file %s (%s)' % (self.cfgfile, e))
- sys.exit(0)
-
- def __str__(self):
- return u'PMAConfigGenerator instance for %s' % self.instname
-
- def __repr__(self):
- return u'PMAConfigGenerator instance for %s' % self.instname
-