Example #1
0
    def get_mapfile_drs(self):

        try:
            _cfg = SectionParser(section='config:{}'.format(self.project), directory=self.config_dir)
            mapfile_drs = _cfg.get('mapfile_drs')
            _cfg.reset()
        except (NoConfigOption, NoConfigSection):
            mapfile_drs = None
        return mapfile_drs
Example #2
0
    def get_checksum_type(self):
        """
        Gets the checksum type to use.
        Be careful to Exception constants by reading two different sections.

        :returns: The checksum type
        :rtype: *str*

        """
        if hasattr(self, 'no_checksum') and self.no_checksum:
            return None
        _cfg = SectionParser(section='DEFAULT', directory=self.config_dir)
        if _cfg.has_option('checksum'):
            checksum_type = _cfg.get_options_from_table('checksum')[0][1].lower()
        else:  # Use SHA256 as default because esg.ini not mandatory in configuration directory
            checksum_type = 'sha256'
        if checksum_type not in checksum_types:
            raise InvalidChecksumType(checksum_type)
        _cfg.reset()
        return checksum_type