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

check_hostname not evaluated as boolean in mysql_connect #685

Open
tchernomax opened this issue Oct 21, 2024 · 3 comments
Open

check_hostname not evaluated as boolean in mysql_connect #685

tchernomax opened this issue Oct 21, 2024 · 3 comments
Labels
help wanted Extra attention is needed

Comments

@tchernomax
Copy link

SUMMARY
    - community.mysql.mysql_replication:
        login_host: …
        login_user: …
        login_password: …
        check_hostname: false
        mode: getprimary

→ FAILED! => {"changed": false, "msg": "unable to connect to database, check login_user and login_password are correct or /root/.my.cnf has the credentials. Exception message: (1043, 'Bad handshake')"}

Same problem with

    - community.mysql.mysql_replication:
        login_host: …
        login_user: …
        login_password: …
        check_hostname: true
        mode: getprimary

But

    - community.mysql.mysql_replication:
        login_host: …
        login_user: …
        login_password: …
        mode: getprimary

→ OK

In fact

def mysql_connect(module, login_user=None, login_password=None, config_file='', ssl_cert=None,
only test if check_hostname is None. So check_hostname=True or check_hostname=False produce exactly the same behavior.

ISSUE TYPE
  • Bug Report
COMPONENT NAME
  • module_utils/mysql.py , mysql_connect
  • all module using check_hostname parameters.
ANSIBLE VERSION
ansible [core 2.17.5]
  config file = /home/max/.ansible.cfg
  configured module search path = ['/home/max/.ansible/modules']
  ansible python module location = /usr/lib/python3.12/site-packages/ansible
  ansible collection location = /home/max/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.12.7 (main, Oct  1 2024, 11:15:50) [GCC 14.2.1 20240910] (/usr/bin/python)
  jinja version = 3.1.4
  libyaml = True
COLLECTION VERSION
# /usr/lib/python3.12/site-packages/ansible_collections
Collection        Version
----------------- -------
community.general 9.5.0
CONFIGURATION
CONFIG_FILE() = /home/max/.ansible.cfg
DEFAULT_FORCE_HANDLERS(/home/max/.ansible.cfg) = True
DEFAULT_HOST_LIST(/home/max/.ansible.cfg) = ['/home/max/.ansible/oxalide-full-hosts']
DEFAULT_JINJA2_EXTENSIONS(/home/max/.ansible.cfg) = jinja2.ext.do
DEFAULT_MODULE_PATH(/home/max/.ansible.cfg) = ['/home/max/.ansible/modules']
DEFAULT_MODULE_UTILS_PATH(/home/max/.ansible.cfg) = ['/home/max/.ansible/module_utils']
DIFF_ALWAYS(/home/max/.ansible.cfg) = True
EDITOR(env: EDITOR) = nvim
INTERPRETER_PYTHON(/home/max/.ansible.cfg) = auto_silent
RETRY_FILES_ENABLED(/home/max/.ansible.cfg) = False
OS / ENVIRONMENT
  • Archlinux
  • target: Debian 11, percona 5.7
STEPS TO REPRODUCE
    - community.mysql.mysql_replication:
        login_host: 
        login_user: 
        login_password: 
        check_hostname: false
        mode: getprimary
EXPECTED RESULTS

OK, no change.

ACTUAL RESULTS
FAILED! => {"changed": false, "msg": "unable to connect to database, check login_user and login_password are correct or /root/.my.cnf has the credentials. Exception message: (1043, 'Bad handshake')"}
@Andersson007
Copy link
Collaborator

@tchernomax hi, thanks for reporting the issue!
Would you like to investigate and possible fix it yourself or we can put the help_wanted label?
There's the Quick start dev guide that can help.

@laurent-indermuehle
Copy link
Collaborator

This is crazy: version_added: '1.1.0' this has been there for a long time.

@Andersson007 Andersson007 added the help wanted Extra attention is needed label Oct 30, 2024
@Andersson007
Copy link
Collaborator

i've put the help wanted label, any help is welcome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants