From d22199f82e9b831a46af09a009bfd0bbe7e0d0ca Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Thu, 18 Jan 2024 07:33:49 +0100 Subject: [PATCH] [PR #7821/92f8bf7b backport][stable-8] mssql_script: make module Python 2 compatible (#7866) mssql_script: make module Python 2 compatible (#7821) Make module Python 2 compatible. (cherry picked from commit 92f8bf7b6f4e4f7fdb2d9fca58dd83f653146913) Co-authored-by: Felix Fontein --- changelogs/fragments/7821-mssql_script-py2.yml | 2 ++ plugins/modules/mssql_script.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/7821-mssql_script-py2.yml diff --git a/changelogs/fragments/7821-mssql_script-py2.yml b/changelogs/fragments/7821-mssql_script-py2.yml new file mode 100644 index 0000000000..79de688628 --- /dev/null +++ b/changelogs/fragments/7821-mssql_script-py2.yml @@ -0,0 +1,2 @@ +bugfixes: + - "mssql_script - make the module work with Python 2 (https://github.com/ansible-collections/community.general/issues/7818, https://github.com/ansible-collections/community.general/pull/7821)." diff --git a/plugins/modules/mssql_script.py b/plugins/modules/mssql_script.py index 13c52c9bfe..00b92e7312 100644 --- a/plugins/modules/mssql_script.py +++ b/plugins/modules/mssql_script.py @@ -283,7 +283,7 @@ def run_module(): # Process the script into batches queries = [] current_batch = [] - for statement in script.splitlines(keepends=True): + for statement in script.splitlines(True): # Ignore the Byte Order Mark, if found if statement.strip() == '\uFEFF': continue