diff --git a/changelogs/fragments/0-pipefail.yml b/changelogs/fragments/0-pipefail.yml new file mode 100644 index 0000000..473bd8f --- /dev/null +++ b/changelogs/fragments/0-pipefail.yml @@ -0,0 +1,2 @@ +breaking_changes: +- mysql_db - the ``pipefail`` argument's default value is set to ``true``. If your target machines do not use ``bash`` as a default interpreter, set ``pipefail`` to ``false`` explicitly. However, we strongly recommend setting up ``bash`` as a default and ``pipefail=true`` as it will protect you from getting broken dumps you don't know about (https://github.com/ansible-collections/community.mysql/issues/407). diff --git a/plugins/modules/mysql_db.py b/plugins/modules/mysql_db.py index 4eec625..3d3c816 100644 --- a/plugins/modules/mysql_db.py +++ b/plugins/modules/mysql_db.py @@ -160,10 +160,8 @@ options: description: - Use C(bash) instead of C(sh) and add C(-o pipefail) to catch errors from the mysql_dump command when I(state=dump) and compression is used. - - The default is C(no) to prevent issues on systems without bash as a default interpreter. - - The default will change to C(yes) in community.mysql 4.0.0. type: bool - default: false + default: true version_added: '3.4.0' sql_log_bin: description: @@ -637,7 +635,7 @@ def main(): check_implicit_admin=dict(type='bool', default=False), config_overrides_defaults=dict(type='bool', default=False), chdir=dict(type='path'), - pipefail=dict(type='bool', default=False), + pipefail=dict(type='bool', default=True), sql_log_bin=dict(type='bool', default=True), ) diff --git a/tests/integration/targets/test_mysql_db/tasks/issue_256_mysqldump_errors.yml b/tests/integration/targets/test_mysql_db/tasks/issue_256_mysqldump_errors.yml index ea1768a..5598826 100644 --- a/tests/integration/targets/test_mysql_db/tasks/issue_256_mysqldump_errors.yml +++ b/tests/integration/targets/test_mysql_db/tasks/issue_256_mysqldump_errors.yml @@ -82,6 +82,7 @@ state: dump name: all target: /tmp/full-dump-without-t1.sql.gz + pipefail: false register: full_dump_without_t1_gz_without_fix ignore_errors: true @@ -119,6 +120,7 @@ state: dump name: db2 target: /tmp/dump-db2-without_t1.sql.gz + pipefail: false register: dump_db2_without_t1_gz_without_fix ignore_errors: true