From c811219e8a8390f5cdf1cf1a933c40ec87e14e3d Mon Sep 17 00:00:00 2001 From: romeroalx Date: Tue, 8 Oct 2024 11:46:04 +0200 Subject: [PATCH] archlinux and all: skip ssl cert validation for mysql tests --- .../tests/backend-mysql/test_backend_mysql.py | 2 +- tasks/database-mysql.yml | 22 ++++++++----------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/molecule/resources/tests/backend-mysql/test_backend_mysql.py b/molecule/resources/tests/backend-mysql/test_backend_mysql.py index 2dcb9ee..d733232 100644 --- a/molecule/resources/tests/backend-mysql/test_backend_mysql.py +++ b/molecule/resources/tests/backend-mysql/test_backend_mysql.py @@ -32,7 +32,7 @@ def test_database_tables(host): dbname = host.check_output('hostname -s').replace('.', '_') cmd = host.run("mysql --user=\"pdns\" --password=\"pdns\" --host=\"mysql\" " + - "--batch --skip-column-names " + + "--batch --skip-column-names --skip-ssl-verify-server-cert " + "--execute=\"SELECT DISTINCT table_name FROM information_schema.columns WHERE table_schema = '%s'\"" % dbname) for table in [ 'domains', 'records', 'supermasters', 'comments', diff --git a/tasks/database-mysql.yml b/tasks/database-mysql.yml index 087a2de..32cd1f8 100644 --- a/tasks/database-mysql.yml +++ b/tasks/database-mysql.yml @@ -35,14 +35,14 @@ - skip_missing: yes - name: Check if the MySQL databases are empty - command: > - mysql --user="{{ item['value']['user'] }}" --password="{{ item['value']['password'] }}" - --host="{{ item['value']['host'] }}" --port "{{ item['value']['port'] | default('3306') }}" --batch --skip-column-names - --execute="SELECT COUNT(DISTINCT table_name) FROM information_schema.columns WHERE table_schema = '{{ item['value']['dbname'] }}'" + shell: |- + mysql --user="{{ item['value']['user'] }}" --password="{{ item['value']['password'] }}" --skip-ssl-verify-server-cert \ + --host="{{ item['value']['host'] }}" --port "{{ item['value']['port'] | default('3306') }}" --batch --skip-column-names \ + --execute="SELECT COUNT(DISTINCT table_name) FROM information_schema.columns WHERE table_schema = '{{ item['value']['dbname'] }}'" when: item.key.split(':')[0] == 'gmysql' with_dict: "{{ pdns_backends }}" register: _pdns_check_mysql_db - no_log: True + # no_log: True changed_when: False - name: Determine location of the SQL file @@ -64,15 +64,11 @@ set_fact: pdns_mysql_schema_file_to_use: "{% if pdns_mysql_schema_file | length == 0 %}{{ pdns_mysql_schema_file_detected.stdout }}{% else %}{{ pdns_mysql_schema_file }}{% endif %}" + - name: Import the PowerDNS MySQL schema - mysql_db: - login_user: "{{ item['item']['value']['user'] }}" - login_password: "{{ item['item']['value']['password'] }}" - login_host: "{{ item['item']['value']['host'] }}" - login_port: "{{ item['item']['port'] | default('3306') }}" - name: "{{ item.item['value']['dbname'] }}" - state: import - target: "{{ pdns_mysql_schema_file_to_use }}" + shell: |- + mysql --user="{{ item['item']['value']['user'] }}" --password="{{ item['item']['value']['password'] }}" --host="{{ item['item']['value']['host'] }}" \ + --port="{{ item['item']['port'] | default('3306') }}" "{{ item.item['value']['dbname'] }}" --skip-ssl-verify-server-cert < "{{ pdns_mysql_schema_file_to_use }}" no_log: True when: "item['item']['key'].split(':')[0] == 'gmysql' and item['stdout'] == '0'" with_items: "{{ _pdns_check_mysql_db['results'] }}"