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

This commit is contained in:
nebulon42 2021-11-26 17:16:03 +01:00
parent 240547102f
commit c3e76585fc
Signed by untrusted user: nebulon42
GPG Key ID: C6050DE136427F8B
2 changed files with 2 additions and 2 deletions

View File

@ -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

View File

@ -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',
'>',