mysql_db: add possibility to make dump with --no-create-db option (#67767)

* mysql_db: add possibility to make dump with --no-create-db option

* add changelog fragment

* fix
pull/67856/head
Andrew Klychkov 6 years ago committed by GitHub
parent ed306c7991
commit a81ab5fe40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- mysql_db - fix bug in the ``db_import`` function introduced by https://github.com/ansible/ansible/pull/56721 (https://github.com/ansible/ansible/issues/65351).

@ -325,10 +325,14 @@ def db_dump(module, host, user, password, db_name, target, all_databases, port,
cmd += " --socket=%s" % shlex_quote(socket)
else:
cmd += " --host=%s --port=%i" % (shlex_quote(host), port)
if all_databases:
cmd += " --all-databases"
else:
elif len(db_name) > 1:
cmd += " --databases {0}".format(' '.join(db_name))
else:
cmd += " %s" % shlex_quote(' '.join(db_name))
if skip_lock_tables:
cmd += " --skip-lock-tables"
if (encoding is not None) and (encoding != ""):

@ -74,7 +74,7 @@
assert:
that:
- result is changed
- result.executed_commands[0] is search("mysqldump --force --socket={{ mysql_socket }} --databases {{ db_name }} --skip-lock-tables --quick --ignore-table={{ db_name }}.department --master-data=1 --skip-triggers")
- result.executed_commands[0] is search("mysqldump --force --socket={{ mysql_socket }} {{ db_name }} --skip-lock-tables --quick --ignore-table={{ db_name }}.department --master-data=1 --skip-triggers")
- name: state dump/import - file name should exist
file: name={{ db_file_name }} state=file

Loading…
Cancel
Save