[PKG-Openstack-devel] Bug#827317: nova-api: You have an error in your SQL syntax

Turbo Fredriksson turbo at bayour.com
Tue Jun 14 22:09:05 UTC 2016


Package: nova-api
Version: 2:13.0.0-3
Severity: normal

I've now reproduced this problem several times. For some reason I get
"You have an error in your SQL syntax" when installing nova-api.

I have tracked this down to the dash in the "nova-api" user- and
database names. Removing this and calling both "novaapi" works.

----- s n i p -----
Setting up nova-api (2:13.0.0-3) ...
PKG-Openstack now calling: dbc_go nova-api configure
Registering service and endpoints for nova with type compute at http://10.0.4.1:8774/v2/%(tenant_id)s
[.. ..]
dbconfig-common: writing config to /etc/dbconfig-common/nova-api.conf
granting access to database nova-api for nova-api at bladeA01b.domain.tld: success.
verifying access for nova-api at bladeA01b.domain.tld: success.
creating database nova-api: success.
verifying database nova-api exists: success.
ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-api CHARACTER SET utf8 COLLATE utf8_unicode_ci' at line 1
dpkg: error processing package nova-api (--configure):
 subprocess installed post-installation script returned error exit status 1
 ----- s n i p -----

In a few tests I did, if I put the "${dbc_dbname}" in citation marks,
it works as well:

----- s n i p -----
--- /var/lib/dpkg/info/nova-api.postinst~	2016-05-18 10:34:50.000000000 +0100
+++ /var/lib/dpkg/info/nova-api.postinst	2016-06-14 22:56:37.066799149 +0100
@@ -427,7 +427,7 @@
 					fi
 					SQL_CONNECTION="mysql+pymysql://$dbc_dbuser:$dbc_dbpass@${dbc_dbserver:-localhost}$dbport/$dbc_dbname"
 					# Set the DB as UTF8
-					Q="ALTER DATABASE ${dbc_dbname} CHARACTER SET utf8 COLLATE utf8_unicode_ci"
+					Q="ALTER DATABASE \`${dbc_dbname}\` CHARACTER SET utf8 COLLATE utf8_unicode_ci"
 					pkgos_mysql_query ${dbc_dbuser} ${dbc_dbpass} ${dbc_dbserver:-localhost} "${dbport}" ${dbc_dbname} "${Q}"
 					;;
 				postgresql*|pgsql)
----- s n i p -----

This have to be triple checked though. And it needs to be done in the
.config file as well.

I'm running mysql-server-5.6, version 5.6.30-1 (latest Sid) which was
installed a few minutes earlier. However, in my install scripts I
write to the database, so I know it's working correctly.

I'm unsure of the exact cause of the problem, because part of the
SQL seed file I'm using was using "nova-api" in it and I didn't
get any problem there..

I'm assuming the usual "unprotected variable usage" here though.

-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.6.0-1-amd64 (SMP w/16 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages nova-api depends on:
ii  adduser                                 3.114
ii  dbconfig-common                         2.0.4
ii  debconf [debconf-2.0]                   1.5.59
ii  init-system-helpers                     1.34
ii  iptables                                1.6.0-2
ii  lsb-base                                9.20160601
ii  nova-common                             2:13.0.0-3
ii  python-openstackclient                  2.3.0-2
ii  python-q-text-as-data [q-text-as-data]  1.4.0-1
pn  python:any                              <none>

Versions of packages nova-api recommends:
ii  python-keystone  2:9.0.0-2

nova-api suggests no packages.

-- debconf information:
* nova/keystone-auth-token: (password omitted)
* nova-api/mysql/admin-pass: (password omitted)
* nova-api/mysql/app-pass: (password omitted)
  nova-api/pgsql/admin-pass: (password omitted)
  nova-api/pgsql/app-pass: (password omitted)
* nova-api/app-password-confirm: (password omitted)
* nova/keystone-admin-password: (password omitted)
* nova-api/password-confirm: (password omitted)
* nova-api/remote/newhost: openstack.bayour.com
* nova-api/database-type: mysql
  nova-api/pgsql/no-empty-passwords:
* nova-api/db/basepath: /var/lib/openstack/nova-api
* nova-api/dbconfig-upgrade: true
* nova-api/purge: true
* nova-api/remove-error: abort
* nova-api/mysql/admin-user: root
* nova-api/internal/reconfiguring: false
* nova-api/remote/host: control.domain.tld
  nova-api/passwords-do-not-match:
* nova-api/mysql/method: TCP/IP
* nova-api/dbconfig-remove: true
* nova-api/db/dbname: nova-api
  nova-api/pgsql/method: TCP/IP
  nova-api/pgsql/authmethod-user: password
* nova/keystone-project-name: admin
* nova-api/dbconfig-install: true
* nova/keystone-admin-name: admin
* nova/region-name: europe-london
* nova-api/db/app-user: nova-api
* nova/keystone-ip: 10.0.4.1
* nova-api/install-error: abort
* nova-api/missing-db-package-error: abort
  nova-api/pgsql/changeconf: false
* nova/endpoint-ip: 10.0.4.1
* nova/register-endpoint: true
  nova-api/pgsql/admin-user: postgres
* novaapi/configure_db: true
  nova-api/pgsql/manualconf:
* nova-api/dbconfig-reinstall: true
* nova-api/remote/port:
* nova-api/internal/skip-preseed: true
  nova-api/pgsql/authmethod-admin: ident
* nova-api/upgrade-backup: true
* nova-api/upgrade-error: abort



More information about the Openstack-devel mailing list