This commit is contained in:
Andrew Klychkov 2020-10-13 10:29:39 +03:00
parent 39a4f32540
commit d3486a16c8
2 changed files with 8 additions and 2 deletions

View file

@ -35,7 +35,7 @@ mysql_driver_fail_msg = 'The PyMySQL (Python 2.7 and Python 3.X) or MySQL-python
def parse_from_mysql_config_file(cnf): def parse_from_mysql_config_file(cnf):
# Default values of comment_prefix is '#' and ';'. # Default values of comment_prefix is '#' and ';'.
# '!' added to prevent a parsing error # '!' added to prevent a parsing error
# when a config file contains !include_dir parameter. # when a config file contains !includedir parameter.
cp = configparser.ConfigParser(comment_prefixes=('#', ';', '!')) cp = configparser.ConfigParser(comment_prefixes=('#', ';', '!'))
cp.read(cnf) cp.read(cnf)
return cp return cp

View file

@ -11,6 +11,9 @@
- name: Add fake port to config file - name: Add fake port to config file
shell: 'echo "port = {{ fake_port }}" >> {{ config_file }}' shell: 'echo "port = {{ fake_port }}" >> {{ config_file }}'
- name: Add blank line
shell: 'echo "" >> {{ config_file }}'
- name: Create include_dir - name: Create include_dir
file: file:
path: '{{ include_dir }}' path: '{{ include_dir }}'
@ -18,7 +21,10 @@
mode: '0777' mode: '0777'
- name: Add include_dir - name: Add include_dir
shell: 'echo "!include_dir {{ include_dir }}" >> {{ config_file }}' lineinfile:
path: '{{ config_file }}'
line: '!includedir {{ include_dir }}'
insertafter: EOF
- name: Create database using fake port to connect to, must fail - name: Create database using fake port to connect to, must fail
mysql_db: mysql_db: