def _find_value_by_key()

in src/cloudwatch/modules/configuration/readerutils.py [0:0]


    def _find_value_by_key(self, key):
        config_list = self._load_config_as_list(self.path)
        for entry in config_list: 
            if not entry or entry[0] == self._COMMENT_CHARACTER or self._AWS_PROFILE_PATTERN.match(entry):
                continue  # skip empty and commented lines
            try: 
                entry_key, entry_value = entry.split('=', 1)
                entry_key = entry_key.strip()
                if entry_key == key:
                    return self._strip_quotes(entry_value.strip()).strip()
            except:
                self._LOGGER.error("Cannot read configuration entry: " + str(entry))
                raise ValueError("Invalid syntax for entry '" + entry + "'.")
        return ""