Browse Source

move mysqldump options to the beginning of the command due to MySQL bug 30994.

nebulon42 3 năm trước cách đây
mục cha
commit
c3e76585fc
2 tập tin đã thay đổi với 2 bổ sung2 xóa
  1. 1 1
      borgmatic/hooks/mysql.py
  2. 1 1
      tests/unit/hooks/test_mysql.py

+ 1 - 1
borgmatic/hooks/mysql.py

@@ -82,12 +82,12 @@ def dump_databases(databases, log_prefix, location_config, dry_run):
 
         dump_command = (
             ('mysqldump',)
+            + (tuple(database['options'].split(' ')) if 'options' in database else ())
             + ('--add-drop-database',)
             + (('--host', database['hostname']) if 'hostname' in database else ())
             + (('--port', str(database['port'])) if 'port' in database else ())
             + (('--protocol', 'tcp') if 'hostname' in database or 'port' in database else ())
             + (('--user', database['username']) if 'username' in database else ())
-            + (tuple(database['options'].split(' ')) if 'options' in database else ())
             + ('--databases',)
             + dump_database_names
             # Use shell redirection rather than execute_command(output_file=open(...)) to prevent

+ 1 - 1
tests/unit/hooks/test_mysql.py

@@ -155,8 +155,8 @@ def test_dump_databases_runs_mysqldump_with_options():
     flexmock(module).should_receive('execute_command').with_args(
         (
             'mysqldump',
-            '--add-drop-database',
             '--stuff=such',
+            '--add-drop-database',
             '--databases',
             'foo',
             '>',