sous-chefs / mysql

Development repository for the mysql cookbook

Home Page:https://supermarket.chef.io/cookbooks/mysql

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"No database selected" when calling mysql_database resource

jhou4 opened this issue Β· comments

commented

πŸ—£οΈ Foreword

Thank for taking the time to fill this bug report fully. Without it we may not be able to fix the bug, and the issue may be closed without resolution.

πŸ‘» Brief Description

When calling mysql_database resource to execute a query(query action), resource fails with "No database selected" error.

πŸ₯ž Cookbook version

11.0.3

πŸ‘©β€πŸ³ Chef-Infra Version

cinc-client 16.16.13

🎩 Platform details

Redhat server 7.6

Steps To Reproduce

Steps to reproduce the behavior:

  1. Construct a sql query
  2. Call mysql_database resource to execute the query.
  3. See error

πŸš“ Expected behavior

Query to be executed without error.

βž• Additional context

Problem seems to be with this line:
https://github.com/sous-chefs/mysql/blob/main/resources/mysql_database.rb#L60
where database name is skipped when executing a query action, while the function clearly requires the database name:
https://github.com/sous-chefs/mysql/blob/main/resources/mysql_database.rb#L84