12345678910111213141516171819202122232425 |
- def databases_to_archive(self):
- """
- Return a list of databases that are eligibles to archiving. If no
- database are provided or the * character is used the method basically
- do a SHOW DATABASE to get available databases
- The method exclude the databases that are explicitly excluded
- """
- if self._databases_to_archive:
- return self._databases_to_archive
- if self.databases is None or self.databases == '*':
- self._databases_to_archive = self.get_os_databases()
- else:
- self._databases_to_archive = [
- d for d in re.split(',|;|\n', self.databases.replace(' ', ''))
- ]
- excluded_databases_regex = \
- "^(" + "|".join(self.excluded_databases) + ")$"
- self._databases_to_archive = [
- d for d in self._databases_to_archive
- if not re.match(excluded_databases_regex, d)
- ]
- return self._databases_to_archive
|