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_user' module is not idempotent on Python 3.7 #60567

Closed
drybjed opened this issue Aug 14, 2019 · 3 comments · Fixed by #64059
Closed

'mysql_user' module is not idempotent on Python 3.7 #60567

drybjed opened this issue Aug 14, 2019 · 3 comments · Fixed by #64059
Labels
affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. database Database category has_pr This issue has an associated PR. module This issue/PR relates to a module. mysql python3 support:community This issue/PR relates to code supported by the Ansible community.

Comments

@drybjed
Copy link
Contributor

drybjed commented Aug 14, 2019

SUMMARY

The mysql_user module always reports the "changed" state on hosts with Python 3.7 set as the inrerpreter. The changed message points to 9c52750 commit as the possible culprit; the changed state shows up on Ansible 2.8.0+, but not on Ansible 2.7.0+. The actual functionality (creation of the MySQL user account, setting password, etc.) seems to work fine.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

mysql_user

ANSIBLE VERSION
ansible 2.8.3
  config file = None
  configured module search path = ['/home/drybjed/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/drybjed/.local/lib/python3.7/site-packages/ansible
  executable location = /home/drybjed/.local/bin/ansible
  python version = 3.7.3 (default, Apr  3 2019, 05:39:12) [GCC 8.3.0]
CONFIGURATION
No changes
OS / ENVIRONMENT

The Ansible Controller is a Debian Buster (10) host, the working remote host is a Debian Stretch (9) host with Python 2.7 and 3.5 used as the interpreters (no changes). The faulty remote host is a Debian Buster (10) host with Python 3.7 as the interpreter.

STEPS TO REPRODUCE
---

- hosts: all
  become: True
  tasks:

    - name: Manage MySQL account
      mysql_user:
        name: 'test-user'
        host: 'localhost'
        password: 'test-password'
        state: 'present'

    - name: Manage MySQL account
      mysql_user:
        name: 'test-user'
        host: 'localhost'
        password: 'test-password'
        state: 'present'
      register: output

    - debug: var=output
EXPECTED RESULTS
PLAY [all] ******************************************************************************************************************************************

TASK [Gathering Facts] ******************************************************************************************************************************
ok: [remote]

TASK [Manage MySQL account] *************************************************************************************************************************
ok: [remote]

TASK [Manage MySQL account] *************************************************************************************************************************
ok: [remote]

TASK [debug] ****************************************************************************************************************************************
ok: [remote] => {
    "output": {
        "changed": false,
        "failed": false,
        "msg": "User unchanged",
        "user": "test-user"
    }
}
ACTUAL RESULTS
PLAY [all] ******************************************************************************************************************************************

TASK [Gathering Facts] ******************************************************************************************************************************
ok: [remote]

TASK [Manage MySQL account] *************************************************************************************************************************
changed: [remote]

TASK [Manage MySQL account] *************************************************************************************************************************
changed: [remote]

TASK [debug] ****************************************************************************************************************************************
ok: [remote] => {
    "output": {
        "changed": true,
        "failed": false,
        "msg": "Password updated (new style)",
        "user": "test-user"
    }
}
@ansibot
Copy link
Contributor

ansibot commented Aug 14, 2019

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot ansibot added affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. database Database category module This issue/PR relates to a module. mysql needs_triage Needs a first human triage before being processed. python3 support:community This issue/PR relates to code supported by the Ansible community. labels Aug 14, 2019
drybjed added a commit to drybjed/debops that referenced this issue Aug 14, 2019
The 'mysql_user' Ansible module has in Ansible 2.8.x has idempotency
issues with Python 3.x environment.

Ref: ansible/ansible#60567
@ansibot
Copy link
Contributor

ansibot commented Dec 20, 2019

@ansibot ansibot added the has_pr This issue has an associated PR. label Dec 20, 2019
@sivel sivel removed the needs_triage Needs a first human triage before being processed. label Jan 24, 2020
@ansible ansible locked and limited conversation to collaborators Feb 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.8 This issue/PR affects Ansible v2.8 bug This issue/PR relates to a bug. database Database category has_pr This issue has an associated PR. module This issue/PR relates to a module. mysql python3 support:community This issue/PR relates to code supported by the Ansible community.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants