Changeset 56735e5 in rattail


Ignore:
Timestamp:
07/05/18 16:51:26 (2 years ago)
Author:
Lance Edgar <lance@…>
Branches:
master
Children:
d40015c
Parents:
b9b66f6
Message:

Skip mysql db dumps if no mysql binary

File:
1 edited

Legend:

Unmodified
Added
Removed
  • rattail/commands/backup.py

    rb9b66f6 r56735e5  
    3131import subprocess
    3232import logging
     33
     34import six
    3335
    3436from rattail.commands.core import Subcommand
     
    231233
    232234    def get_mysql_names(self, include=None, exclude=None, exclude_builtin=True):
    233         output = subprocess.check_output([
    234             'mysql', '--execute', "show databases;",
    235             '--batch', '--skip-column-names',
    236         ])
     235        try:
     236            output = subprocess.check_output([
     237                'mysql', '--execute', "show databases;",
     238                '--batch', '--skip-column-names',
     239            ])
     240        except Exception as error:
     241            if six.PY3 and isinstance(error, FileNotFoundError):
     242                # assuming there is no mysql binary
     243                return []
     244            raise
    237245        output = output.decode('ascii') # TODO: how to detect this etc.?
    238246
Note: See TracChangeset for help on using the changeset viewer.