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_db module should use option --defaults-file instead of --defaults-extra-file #34488

Closed
iredmail opened this issue Jan 5, 2018 · 10 comments · Fixed by ansible-collections/community.general#468
Labels
affects_2.4 This issue/PR affects Ansible v2.4 bug This issue/PR relates to a bug. collection:community.general collection Related to Ansible Collections work database Database category has_pr This issue has an associated PR. module This issue/PR relates to a module. mysql needs_collection_redirect https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md support:community This issue/PR relates to code supported by the Ansible community. test This PR relates to tests.

Comments

@iredmail
Copy link

iredmail commented Jan 5, 2018

ISSUE TYPE
  • Bug Report
COMPONENT NAME
  • module: mysql_db
ANSIBLE VERSION
ansible 2.4.1.0
  config file = None
  configured module search path = [u'/Users/zhb/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /Library/Python/2.7/site-packages/ansible-2.4.1.0-py2.7.egg/ansible
  executable location = /usr/local/bin/ansible
  python version = 2.7.10 (default, Jul 15 2017, 17:16:57) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.31)]
CONFIGURATION

None.

OS / ENVIRONMENT

macOS 10.13.2

SUMMARY

mysql_db module uses mysql command line option --defaults-extra-file= instead of --defaults-file, if file ~/.my.cnf exists, but we use another .my.cnf file in mysql_db module with state=import, sql connection will fail.

STEPS TO REPRODUCE
  • ~/.my.cnf:
[client]
user=root
password="xxxx"
host=xxxx.rds.amazonaws.com
port=3306
  • ~/.my.cnf-myuser
[client]
user="myuser"
password="yyyy"
host="xxxx.rds.amazonaws.com"
port=3306

Task:

    - name: "test"
      mysql_db:
          state: import
          name: mydb
          target: /tmp/check_sql_db.sql
          login_host: xxxx.rds.amazonaws.com
          login_port: 3306
          login_user: myuser
          config_file: /root/.my.cnf-myuser

Error message:

    "msg": "ERROR 1045 (28000): Access denied for user 'root'@'172.31.2.83' (using password: YES)\n"
EXPECTED RESULTS

Expect Ansible to use /root/.my.cnf-myuser and do not load any other .my.cnf file.

I replaced --defaults-extra-file= by --defaults-file= in mysql_db module source file, run same task, it works fine.

@ansibot
Copy link
Contributor

ansibot commented Jan 5, 2018

@iredmail Greetings! Thanks for taking the time to open this issue. In order for the community to handle your issue effectively, we need a bit more information.

Here are the items we could not find in your description:

  • component name

Please set the description of this issue with this template:
https://raw.githubusercontent.com/ansible/ansible/devel/.github/ISSUE_TEMPLATE.md

click here for bot help

@ansibot ansibot added affects_2.4 This issue/PR affects Ansible v2.4 bug_report needs_info This issue requires further information. Please answer any outstanding questions. needs_template This issue/PR has an incomplete description. Please fill in the proposed template correctly. needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. module This issue/PR relates to a module. support:community This issue/PR relates to code supported by the Ansible community. and removed needs_info This issue requires further information. Please answer any outstanding questions. needs_template This issue/PR has an incomplete description. Please fill in the proposed template correctly. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Jan 5, 2018
@Akasurde Akasurde removed the needs_triage Needs a first human triage before being processed. label Jan 6, 2018
@ansibot ansibot added bug This issue/PR relates to a bug. and removed bug_report labels Mar 1, 2018
@ansibot ansibot added support:core This issue/PR relates to code supported by the Ansible Engineering Team. and removed support:community This issue/PR relates to code supported by the Ansible community. labels Sep 18, 2018
@ansibot ansibot added needs_maintainer Ansibot is unable to identify maintainers for this PR. (Check `author` in docs or BOTMETA.yml) support:community This issue/PR relates to code supported by the Ansible community. and removed support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Oct 4, 2018
@ansibot ansibot removed the needs_maintainer Ansibot is unable to identify maintainers for this PR. (Check `author` in docs or BOTMETA.yml) label Nov 10, 2018
@ansibot ansibot added the test This PR relates to tests. label Feb 3, 2019
@ansibot
Copy link
Contributor

ansibot commented Feb 19, 2019

@ansibot ansibot added the database Database category label Feb 19, 2019
@ansibot
Copy link
Contributor

ansibot commented Feb 27, 2019

@ansibot
Copy link
Contributor

ansibot commented Jun 3, 2019

@ansibot
Copy link
Contributor

ansibot commented Jun 19, 2019

@ansibot ansibot added the has_pr This issue has an associated PR. label Jul 30, 2019
@ansibot
Copy link
Contributor

ansibot commented Aug 8, 2019

@ansibot ansibot added collection Related to Ansible Collections work collection:community.general needs_collection_redirect https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md labels Apr 29, 2020
@Andersson007
Copy link
Contributor

resolved_by ansible-collections/community.general#468

@Andersson007
Copy link
Contributor

@iredmail thanks for reporting!
if you're still interested in solving this, look at ansible-collections/community.general#468

@Andersson007
Copy link
Contributor

close_me

@Andersson007
Copy link
Contributor

@ansibot ansibot closed this as completed Jun 9, 2020
@ansible ansible locked and limited conversation to collaborators Jul 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.4 This issue/PR affects Ansible v2.4 bug This issue/PR relates to a bug. collection:community.general collection Related to Ansible Collections work database Database category has_pr This issue has an associated PR. module This issue/PR relates to a module. mysql needs_collection_redirect https://github.com/ansible/ansibullbot/blob/master/docs/collection_migration.md support:community This issue/PR relates to code supported by the Ansible community. test This PR relates to tests.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants