Repository: ansible-collections/community.general

Issue:
community.general.mssql_script TypeError: splitlines() takes no keyword arguments
### Summary

Failure to execute script when trying to query a MSSQL db using the mssql_script module.  Attempting to query results in an error:
TypeError: splitlines() takes no keyword arguments.
This appears to be an error in the run() when processing the script


### Issue Type

Bug Report

### Component Name

mssql_script

### Ansible Version

```console (paste below)
$ ansible --version
ansible 2.9.27
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/jenkins/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /bin/ansible
  python version = 2.7.5 (default, May 30 2023, 03:38:55) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
$ ansible-galaxy --version
ansible-galaxy 2.9.27
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/jenkins/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /bin/ansible-galaxy
  python version = 2.7.5 (default, May 30 2023, 03:38:55) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
```


### Community.general Version

```console (paste below)
$ ansible-galaxy collection list community.general
/root/.ansible/collections/ansible_collections/community/general/plugins/modules
[root@vac10fpcfpp800 modules]# ls
aerospike_migrations.py           ibm_sa_host.py                               nginx_status_info.py                        redis.py
airbrake_deployment.py            ibm_sa_pool.py                               nictagadm.py                                rhevm.py
aix_devices.py                    ibm_sa_vol_map.py                            nmcli.py                                    rhn_channel.py
aix_filesystem.py                 ibm_sa_vol.py                                nomad_job_info.py                           rhn_register.py
aix_inittab.py                    icinga2_feature.py                           nomad_job.py                                rhsm_release.py
aix_lvg.py                        icinga2_host.py                              nomad_token.py                              rhsm_repository.py
aix_lvol.py                       idrac_redfish_command.py                     nosh.py                                     riak.py
alerta_customer.py                idrac_redfish_config.py                      npm.py                                      rocketchat.py
ali_instance_info.py              idrac_redfish_info.py                        nsupdate.py                                 rollbar_deployment.py
ali_instance.py                   ilo_redfish_command.py                       ocapi_command.py                            rpm_ostree_pkg.py
alternatives.py                   ilo_redfish_config.py                        ocapi_info.py                               rundeck_acl_policy.py
ansible_galaxy_install.py         ilo_redfish_info.py                          oci_vcn.py                                  rundeck_job_executions_info.py
apache2_mod_proxy.py              imc_rest.py                                  odbc.py                                     rundeck_job_run.py
apache2_module.py                 imgadm.py                                    office_365_connector_card.py                rundeck_project.py
apk.py                            infinity.py                                  ohai.py                                     runit.py
apt_repo.py                       influxdb_database.py                         omapi_host.py                               say.py
apt_rpm.py                        influxdb_query.py                            oneandone_firewall_policy.py                scaleway_compute_private_network.py
archive.py                        influxdb_retention_policy.py                 oneandone_load_balancer.py                  scaleway_compute.py
atomic_container.py               influxdb_user.py                             oneandone_monitoring_policy.py              scaleway_container_info.py
atomic_host.py                    influxdb_write.py                            oneandone_private_network.py                scaleway_container_namespace_info.py
atomic_image.py                   ini_file.py                                  oneandone_public_ip.py                      scaleway_container_namespace.py
awall.py                          installp.py                                  oneandone_server.py                         scaleway_container.py
beadm.py                          interfaces_file.py                           one_host.py                                 scaleway_container_registry_info.py
bearychat.py                      ipa_config.py                                one_image_info.py                           scaleway_container_registry.py
bigpanda.py                       ipa_dnsrecord.py                             one_image.py                                scaleway_database_backup.py
bitbucket_access_key.py           ipa_dnszone.py                               onepassword_info.py                         scaleway_function_info.py
bitbucket_pipeline_key_pair.py    ipa_group.py                                 one_service.py                              scaleway_function_namespace_info.py
bitbucket_pipeline_known_host.py  ipa_hbacrule.py                              one_template.py                             scaleway_function_namespace.py
bitbucket_pipeline_variable.py    ipa_hostgroup.py                             oneview_datacenter_info.py                  scaleway_function.py
bower.py                          ipa_host.py                                  oneview_enclosure_info.py                   scaleway_image_info.py
btrfs_info.py                     ipa_otpconfig.py                             oneview_ethernet_network_info.py            scaleway_ip_info.py
btrfs_subvolume.py                ipa_otptoken.py                              oneview_ethernet_network.py                 scaleway_ip.py
bundler.py                        ipa_pwpolicy.py                              oneview_fc_network_info.py                  scaleway_lb.py
bzr.py                            ipa_role.py                                  oneview_fc_network.py                       scaleway_organization_info.py
campfire.py                       ipa_service.py                               oneview_fcoe_network_info.py                scaleway_private_network.py
capabilities.py                   ipa_subca.py                                 oneview_fcoe_network.py                     scaleway_security_group_info.py
cargo.py                          ipa_sudocmdgroup.py                          oneview_logical_interconnect_group_info.py  scaleway_security_group.py
catapult.py                       ipa_sudocmd.py                               oneview_logical_interconnect_group.py       scaleway_security_group_rule.py
circonus_annotation.py            ipa_sudorule.py                              oneview_network_set_info.py                 scaleway_server_info.py
cisco_webex.py                    ipa_user.py                                  oneview_network_set.py                      scaleway_snapshot_info.py
clc_aa_policy.py                  ipa_vault.py                                 oneview_san_manager_info.py                 scaleway_sshkey.py
clc_alert_policy.py               ipbase_info.py                               oneview_san_manager.py                      scaleway_user_data.py
clc_blueprint_package.py          ipify_facts.py                               one_vm.py                                   scaleway_volume_info.py
clc_firewall_policy.py            ipinfoio_facts.py                            online_server_info.py                       scaleway_volume.py
clc_group.py                      ipmi_boot.py                                 online_user_info.py                         sefcontext.py
clc_loadbalancer.py               ipmi_power.py                                openbsd_pkg.py                              selinux_permissive.py
clc_modify_server.py              ip_netns.py                                  opendj_backendprop.py                       selogin.py
clc_publicip.py                   iptables_state.py                            open_iscsi.py                               sendgrid.py
clc_server.py                     ipwcli_dns.py                                openwrt_init.py                             sensu_check.py
clc_server_snapshot.py            irc.py                                       opkg.py                                     sensu_client.py
cloudflare_dns.py                 iso_create.py                                osx_defaults.py                             sensu_handler.py
cloud_init_data_facts.py          iso_customize.py                             ovh_ip_failover.py                          sensu_silence.py
cobbler_sync.py                   iso_extract.py                               ovh_ip_loadbalancing_backend.py             sensu_subscription.py
cobbler_system.py                 jabber.py                                    ovh_monthly_billing.py                      seport.py
composer.py                       java_cert.py                                 pacemaker_cluster.py                        serverless.py
consul_acl.py                     java_keystore.py                             packet_device.py                            shutdown.py
consul_kv.py                      jboss.py                                     packet_ip_subnet.py                         simpleinit_msb.py
consul_policy.py                  jenkins_build_info.py                        packet_project.py                           slackpkg.py
consul.py                         jenkins_build.py                             packet_sshkey.py                            slack.py
consul_role.py                    jenkins_job_info.py                          packet_volume_attachment.py                 sl_vm.py
consul_session.py                 jenkins_job.py                               packet_volume.py                            smartos_image_info.py
copr.py                           jenkins_plugin.py                            pacman_key.py                               snap_alias.py
cpanm.py                          jenkins_script.py                            pacman.py                                   snap.py
cronvar.py                        jira.py                                      pagerduty_alert.py                          snmp_facts.py
crypttab.py                       kdeconfig.py                                 pagerduty_change.py                         solaris_zone.py
datadog_downtime.py               kernel_blacklist.py                          pagerduty.py                                sorcery.py
datadog_event.py                  keycloak_authentication.py                   pagerduty_user.py                           spectrum_device.py
datadog_monitor.py                keycloak_authentication_required_actions.py  pamd.py                                     spectrum_model_attrs.py
dconf.py                          keycloak_authz_authorization_scope.py        pam_limits.py                               spotinst_aws_elastigroup.py
deploy_helper.py                  keycloak_authz_custom_policy.py              parted.py                                   ss_3par_cpg.py
dimensiondata_network.py          keycloak_authz_permission_info.py            pear.py                                     ssh_config.py
dimensiondata_vlan.py             keycloak_authz_permission.py                 pids.py                                     stackdriver.py
discord.py                        keycloak_client.py                           pingdom.py                                  stacki_host.py
django_manage.py                  keycloak_client_rolemapping.py               pip_package_info.py                         statsd.py
dnf_config_manager.py             keycloak_clientscope.py                      pipx_info.py                                statusio_maintenance.py
dnf_versionlock.py                keycloak_clientscope_type.py                 pipx.py                                     sudoers.py
dnsimple_info.py                  keycloak_clientsecret_info.py                pkg5_publisher.py                           supervisorctl.py
dnsimple.py                       keycloak_clientsecret_regenerate.py          pkg5.py                                     svc.py
dnsmadeeasy.py                    keycloak_clienttemplate.py                   pkgin.py                                    svr4pkg.py
dpkg_divert.py                    keycloak_component_info.py                   pkgng.py                                    swdepot.py
easy_install.py                   keycloak_group.py                            pkgutil.py                                  swupd.py
ejabberd_user.py                  keycloak_identity_provider.py                pmem.py                                     syslogger.py
elasticsearch_plugin.py           keycloak_realm_info.py                       pnpm.py                                     syspatch.py
emc_vnx_sg_member.py              keycloak_realm_key.py                        portage.py                                  sysrc.py
etcd3.py                          keycloak_realm.py                            portinstall.py                              sysupgrade.py
facter_facts.py                   keycloak_realm_rolemapping.py                pritunl_org_info.py                         taiga_issue.py
facter.py                         keycloak_role.py                             pritunl_org.py                              telegram.py
filesize.py                       keycloak_user_federation.py                  pritunl_user_info.py                        terraform.py
filesystem.py                     keycloak_user.py                             pritunl_user.py                             timezone.py
flatpak.py                        keycloak_user_rolemapping.py                 profitbricks_datacenter.py                  twilio.py
flatpak_remote.py                 keyring_info.py                              profitbricks_nic.py                         typetalk.py
flowdock.py                       keyring.py                                   profitbricks.py                             udm_dns_record.py
gandi_livedns.py                  kibana_plugin.py                             profitbricks_volume_attachments.py          udm_dns_zone.py
gconftool2_info.py                launchd.py                                   profitbricks_volume.py                      udm_group.py
gconftool2.py                     layman.py                                    proxmox_disk.py                             udm_share.py
gem.py                            lbu.py                                       proxmox_domain_info.py                      udm_user.py
gio_mime.py                       ldap_attrs.py                                proxmox_group_info.py                       ufw.py
git_config_info.py                ldap_entry.py                                proxmox_kvm.py                              uptimerobot.py
git_config.py                     ldap_passwd.py                               proxmox_nic.py                              urpmi.py
github_deploy_key.py              ldap_search.py                               proxmox_node_info.py                        utm_aaa_group_info.py
github_issue.py                   librato_annotation.py                        proxmox_pool_member.py                      utm_aaa_group.py
github_key.py                     linode.py                                    proxmox_pool.py                             utm_ca_host_key_cert_info.py
github_release.py                 linode_v4.py                                 proxmox.py                                  utm_ca_host_key_cert.py
github_repo.py                    listen_ports_facts.py                        proxmox_snap.py                             utm_dns_host.py
github_webhook_info.py            lldp.py                                      proxmox_storage_contents_info.py            utm_network_interface_address_info.py
github_webhook.py                 locale_gen.py                                proxmox_storage_info.py                     utm_network_interface_address.py
gitlab_branch.py                  logentries_msg.py                            proxmox_tasks_info.py                       utm_proxy_auth_profile.py
gitlab_deploy_key.py              logentries.py                                proxmox_template.py                         utm_proxy_exception.py
gitlab_group_members.py           logstash_plugin.py                           proxmox_user_info.py                        utm_proxy_frontend_info.py
gitlab_group.py                   lvg.py                                       proxmox_vm_info.py                          utm_proxy_frontend.py
gitlab_group_variable.py          lvg_rename.py                                pubnub_blocks.py                            utm_proxy_location_info.py
gitlab_hook.py                    lvol.py                                      pulp_repo.py                                utm_proxy_location.py
gitlab_instance_variable.py       lxca_cmms.py                                 puppet.py                                   vdo.py
gitlab_issue.py                   lxca_nodes.py                                pushbullet.py                               vertica_configuration.py
gitlab_merge_request.py           lxc_container.py                             pushover.py                                 vertica_info.py
gitlab_project_badge.py           lxd_container.py                             python_requirements_info.py                 vertica_role.py
gitlab_project_members.py         lxd_profile.py                               rax_cbs_attachments.py                      vertica_schema.py
gitlab_project.py                 lxd_project.py                               rax_cbs.py                                  vertica_user.py
gitlab_project_variable.py        macports.py                                  rax_cdb_database.py                         vexata_eg.py
gitlab_protected_branch.py        mail.py                                      rax_cdb.py                                  vexata_volume.py
gitlab_runner.py                  make.py                                      rax_cdb_user.py                             vmadm.py
gitlab_user.py                    manageiq_alert_profiles.py                   rax_clb_nodes.py                            wakeonlan.py
grove.py                          manageiq_alerts.py                           rax_clb.py                                  wdc_redfish_command.py
gunicorn.py                       manageiq_group.py                            rax_clb_ssl.py                              wdc_redfish_info.py
haproxy.py                        manageiq_policies_info.py                    rax_dns.py                                  webfaction_app.py
heroku_collaborator.py            manageiq_policies.py                         rax_dns_record.py                           webfaction_db.py
hg.py                             manageiq_provider.py                         rax_facts.py                                webfaction_domain.py
hipchat.py                        manageiq_tags_info.py                        rax_files_objects.py                        webfaction_mailbox.py
homebrew_cask.py                  manageiq_tags.py                             rax_files.py                                webfaction_site.py
homebrew.py                       manageiq_tenant.py                           rax_identity.py                             xattr.py
homebrew_tap.py                   manageiq_user.py                             rax_keypair.py                              xbps.py
homectl.py                        mas.py                                       rax_meta.py                                 xcc_redfish_command.py
honeybadger_deployment.py         matrix.py                                    rax_mon_alarm.py                            xenserver_facts.py
hpilo_boot.py                     mattermost.py                                rax_mon_check.py                            xenserver_guest_info.py
hpilo_info.py                     maven_artifact.py                            rax_mon_entity.py                           xenserver_guest_powerstate.py
hponcfg.py                        memset_dns_reload.py                         rax_mon_notification_plan.py                xenserver_guest.py
htpasswd.py                       memset_memstore_info.py                      rax_mon_notification.py                     xfconf_info.py
hwc_ecs_instance.py               memset_server_info.py                        rax_network.py                              xfconf.py
hwc_evs_disk.py                   memset_zone_domain.py                        rax.py                                      xfs_quota.py
hwc_network_vpc.py                memset_zone.py                               rax_queue.py                                xml.py
hwc_smn_topic.py                  memset_zone_record.py                        rax_scaling_group.py                        yarn.py
hwc_vpc_eip.py                    mksysb.py                                    rax_scaling_policy.py                       yum_versionlock.py
hwc_vpc_peering_connect.py        modprobe.py                                  read_csv.py                                 zfs_delegate_admin.py
hwc_vpc_port.py                   monit.py                                     redfish_command.py                          zfs_facts.py
hwc_vpc_private_ip.py             mqtt.py                                      redfish_config.py                           zfs.py
hwc_vpc_route.py                  mssql_db.py                                  redfish_info.py                             znode.py
hwc_vpc_security_group.py         mssql_script.py                              redhat_subscription.py                      zpool_facts.py
hwc_vpc_security_group_rule.py    nagios.py                                    redis_data_incr.py                          zypper.py
hwc_vpc_subnet.py                 netcup_dns.py                                redis_data_info.py                          zypper_repository.py
ibm_sa_domain.py                  newrelic_deployment.py                       redis_data.py
ibm_sa_host_ports.py              nexmo.py                                     redis_info.py
```


### Configuration

```console (paste below)
$ ansible-config dump --only-changed
```


### OS / Environment

RHEL 7

### Steps to Reproduce

<!--- Paste example playbooks or commands between quotes below -->
```yaml (paste below)
    - name:  Check DB connection
      community.general.mssql_script:
        login_user: "{{ mssql_deployment_user | quote }}"
        login_password: "{{ mssql_deployment_password }}"
        login_host: "{{ mssql_host | quote}}"
        login_port: "{{ mssql_port }}"
        db: master
        script: "SELECT 1"
```


### Expected Results

Expected return of successful db connection, as this was taken direct from the examples.

### Actual Results

```console (paste below)
Traceback (most recent call last):
  File "/home/jenkins/.ansible/tmp/ansible-tmp-1704495952.3167772-883-229891219562792/AnsiballZ_mssql_script.py", line 107, in <module>
    _ansiballz_main()
  File "/home/jenkins/.ansible/tmp/ansible-tmp-1704495952.3167772-883-229891219562792/AnsiballZ_mssql_script.py", line 99, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/home/jenkins/.ansible/tmp/ansible-tmp-1704495952.3167772-883-229891219562792/AnsiballZ_mssql_script.py", line 48, in invoke_module
    run_name='__main__', alter_sys=True)
  File "/usr/lib64/python2.7/runpy.py", line 176, in run_module
    fname, loader, pkg_name)
  File "/usr/lib64/python2.7/runpy.py", line 82, in _run_module_code
    mod_name, mod_fname, mod_loader, pkg_name)
  File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/tmp/ansible_community.general.mssql_script_payload_n7TKt4/ansible_community.general.mssql_script_payload.zip/ansible_collections/community/general/plugins/modules/mssql_script.py", line 340, in <module>
  File "/tmp/ansible_community.general.mssql_script_payload_n7TKt4/ansible_community.general.mssql_script_payload.zip/ansible_collections/community/general/plugins/modules/mssql_script.py", line 336, in main
  File "/tmp/ansible_community.general.mssql_script_payload_n7TKt4/ansible_community.general.mssql_script_payload.zip/ansible_collections/community/general/plugins/modules/mssql_script.py", line 286, in run_module
TypeError: splitlines() takes no keyword arguments

```


### Code of Conduct

- [X] I agree to follow the Ansible Code of Conduct


Discussion:
Files identified in the description:
* [`plugins/modules/mssql_script.py`](https://github.com/ansible-collections/community.general/blob/main/plugins/modules/mssql_script.py)

If these files are incorrect, please update the `component name` section of the description or use the `!component` bot command.

[click here for bot help](https://github.com/ansible/ansibullbot/blob/devel/ISSUE_HELP.md)
<!--- boilerplate: components_banner --->
cc @kbudde
[click here for bot help](https://github.com/ansible/ansibullbot/blob/devel/ISSUE_HELP.md)
<!--- boilerplate: notify --->

Resolving patch:
diff --git a/plugins/modules/mssql_script.py b/plugins/modules/mssql_script.py
--- 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


Test patch: