ansible-collections/community.mysql

when db name in backticks it is not dropped when 'absent'

yosefy opened this issue · 1 comments

Summary

when running module and database name is in backticks like db.test.001

and state is absent schema will not be dropped

without backticks works good

if we have dots in name so we have to use backticks otherwise we get error:

FAILED! => {"changed": false, "msg": "error creating database: MySQL does not support database with more than 1 dots"}

Issue Type

Bug Report

Component Name

mysql_db

Ansible Version

$ ansible --version
ansible [core 2.11.12]

Configuration

# if using a version older than ansible-core 2.12 you should omit the '-t all'
$ ansible-config dump --only-changed -t all

OS / Environment

RHEL

Steps to Reproduce

- name: db task
  community.mysql.mysql_db:
    login_user: root
    login_password: "{{ WP_DB_PASS }}"
    login_host: "mysql.local"
    name: "`abc`"
    state: absent

Expected Results

changed: [localhost] => {"changed": true, "db": "abc", "db_list": ["abc"], "executed_commands": ["DROP DATABASE abc"]}

Actual Results

ok:      [localhost] => {"changed": false, "db": "`abc`", "db_list": ["`abc`"], "executed_commands": []}

Code of Conduct

  • I agree to follow the Ansible Code of Conduct

@yosefy hello, thanks for reporting the issue! Once someone has time, they'll take a closer look. I'll put the help_wanted label