Altered detection logic for the /var/opt/mssql/mssql.conf file as this file is now created by default in SQL Server 2017 CU4 on Linux. Before CU4 this file was created after "/opt/mssql/bin/mssql-conf setup" was executed.

This commit is contained in:
clayton006
2018-02-22 17:27:04 -05:00
parent c42e02daef
commit 98f8b00f13
@@ -74,6 +74,7 @@ RETURN = '''
from ansible.module_utils.basic import AnsibleModule
import os.path
import re
import subprocess
def main():
@@ -115,9 +116,14 @@ def main():
changed = True
if setup_sa_password is not None:
need_to_set_up = True
if os.path.isfile('/var/opt/mssql/mssql.conf'):
changed = False
else:
with open("/var/opt/mssql/mssql.conf", "r") as mssql_conf_file:
mssql_conf_file_data = mssql_conf_file.read()
if re.search(r'\b(accepteula)\b', mssql_conf_file_data, re.I) is not None:
need_to_set_up = False
changed = False
if need_to_set_up:
setup_env = os.environ.copy()
subprocess.check_call(
['/opt/mssql/bin/mssql-conf', '--noprompt', 'setup', 'accept-eula'],