Bug 1656855

Summary: bad SQL database name for ironic-inspector
Product: Red Hat OpenStack Reporter: Cyril Lopez <cylopez>
Component: puppet-ironicAssignee: Cyril Lopez <cylopez>
Status: CLOSED WONTFIX QA Contact: Alexander Chuzhoy <sasha>
Severity: medium Docs Contact:
Priority: medium    
Version: 13.0 (Queens)CC: bfournie, dtantsur, imelofer, jjoyce, jschluet, slinaber, tvignaud
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-12-06 15:10:05 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Cyril Lopez 2018-12-06 13:40:25 UTC
Description of problem:
Ironic-inspector DBname is ironic-inspector. Following best practice in Mysql, "-" is not allowed. It create some issue like we cannot drop the database from mysql cli.
https://dev.mysql.com/doc/refman/8.0/en/identifiers.html

Version-Release number of selected component (if applicable):
puppet-ironic-12.4.0-3.el7ost.noarch

Actual results:
 [root@director13 ~]# mysql                                                                                                                                                                   
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 1420
Server version: 10.1.20-MariaDB MariaDB Server

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| glance             |
| heat               |
| information_schema |
| ironic             |
| ironic-inspector   |
| keystone           |
| mistral            |
| mysql              |
| neutron            |
| nova               |
| nova_api           |
| nova_cell0         |
| nova_placement     |
| performance_schema |
| zaqar              |
+--------------------+
15 rows in set (0.00 sec)

MariaDB [(none)]> drop database ironic-inspector;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '-inspector' at line 1

Comment 1 Dmitry Tantsur 2018-12-06 15:10:05 UTC
Ouch. Yeah, good point. But judging by https://serverfault.com/questions/195221/how-to-rename-a-mysql-database database rename is not quite possible in MySQL (or at least dangerous), so I don't think we can fix it now :(

I'm pretty sure you can escape the dash somehow.