Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mysql_role closes connection twice #329

Closed
betanummeric opened this issue Apr 4, 2022 · 0 comments · Fixed by #330
Closed

mysql_role closes connection twice #329

betanummeric opened this issue Apr 4, 2022 · 0 comments · Fixed by #330

Comments

@betanummeric
Copy link
Member

SUMMARY

The mysql_role module closes the mysql connection too often.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

module community.mysql.mysql_role

VERSIONS
ansible 2.10.8
python 3.9.2
community.mysql 3.1.2
python3-pymysql 0.9.3-2
MariaDB 10.6.4
STEPS TO REPRODUCE

tested with this playbook task:

- name: add testrole
  community.mysql.mysql_role:
    state: present
    login_unix_socket: /tmp/mysql-3306.sock
    append_members: yes
    append_privs: yes
    members: []
    name: testrole1
    priv:
      "test1.*": "SELECT,UPDATE,DELETE,INSERT"
    set_default_role_all: no
EXPECTED RESULTS

Only closing the connection once, without warnings.

ACTUAL RESULTS

Ansible logs a warning because it fails to close an already closed connection.

[WARNING]: Module invocation had junk after the JSON data: Exception ignored in: <bound method mysql_connect.<locals>._conn_patch
of <pymysql.connections.Connection object at 0x7f79e64d9d30>> Traceback (most recent call last):   File "/tmp/ansible_community.my
sql.mysql_role_payload_ajeef4h3/ansible_community.mysql.mysql_role_payload.zip/ansible_collections/community/mysql/plugins/module_
utils/mysql.py", line 112, in _conn_patch   File "/usr/lib/python3/dist-packages/pymysql/connections.py", line 721, in close
raise err.Error("Already closed") pymysql.err.Error: Already closed
betanummeric pushed a commit to betanummeric/community.mysql that referenced this issue Apr 4, 2022
Andersson007 pushed a commit that referenced this issue Apr 5, 2022
* mysql_role: remove redundant connection closing (fixes #329)

* add changelog fragment for pull request #330

Co-authored-by: Felix Hamme <[email protected]>
patchback bot pushed a commit that referenced this issue Apr 5, 2022
* mysql_role: remove redundant connection closing (fixes #329)

* add changelog fragment for pull request #330

Co-authored-by: Felix Hamme <[email protected]>
(cherry picked from commit 641894e)
Andersson007 pushed a commit that referenced this issue Apr 5, 2022
…332)

* mysql_role: remove redundant connection closing (fixes #329)

* add changelog fragment for pull request #330

Co-authored-by: Felix Hamme <[email protected]>
(cherry picked from commit 641894e)

Co-authored-by: betanummeric <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant