Package: nova-common Version: 2:18.1.0-6 Severity: normal Tags: patch Dear Maintainer,
mysql is called with -p and empty password causing password question to be asked on console rather unnotisble for the cell0 database. Should be seen in accordance with bug 930992 for openstack-deploy Patch attached Regards Svein-Erik Skjelbred. -- System Information: Debian Release: 10.0 APT prefers testing APT policy: (500, 'testing') Architecture: amd64 (x86_64) Kernel: Linux 4.19.0-5-amd64 (SMP w/4 CPU cores) Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE=en_GB:en (charmap=UTF-8) Shell: /bin/sh linked to /usr/bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled Versions of packages nova-common depends on: ii adduser 3.118 pn bridge-utils <none> pn dbconfig-common <none> ii debconf [debconf-2.0] 1.5.71 ii iproute2 4.20.0-2 ii python3 3.7.3-1 pn python3-amqplib <none> pn python3-configobj <none> pn python3-iso8601 <none> pn python3-nova <none> pn python3-openstackclient <none> pn q-text-as-data <none> pn sqlite3 <none> nova-common recommends no packages. Versions of packages nova-common suggests: pn python3-pysqlite2 | python3-mysqldb | python3-pygresql <none>
diff --git a/debian/changelog b/debian/changelog index a9326bfe30..84c5817048 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +nova (2:18.1.0-6.1) UNRELEASED; urgency=medium + + * Non-maintainer upload. + * Local changes to remedy errors/weknesses in nova-common.postinst.in + and nova-common.prerm + + -- Svein-Erik Skjelbred <svein-e...@skjelbred.com> Sun, 16 Jun 2019 22:34:38 +0200 + nova (2:18.1.0-6) unstable; urgency=medium * Add upstream patch to fix broken request_spec, which in certain cases lead diff --git a/debian/nova-common.postinst.in b/debian/nova-common.postinst.in index 3d07febdd6..258e507e63 100755 --- a/debian/nova-common.postinst.in +++ b/debian/nova-common.postinst.in @@ -151,9 +151,22 @@ create_cell0_database (){ if [ "${dbc_dbtype}" = "mysql" ]; then # Create nova_cell0 database echo "===> nova-common: Creating ${dbc_dbname}_cell0 database:" - echo "CREATE DATABASE IF NOT EXISTS ${dbc_dbname}_cell0 CHARACTER SET utf8 COLLATE utf8_unicode_ci;" | mysql -h ${dbc_dbserver} -u ${dbc_dbadmin} -p${dbc_dbadmpass} + echo "dbc_dbname=${dbc_dbname} mysql -h \"${dbc_dbserver}\" -u ${dbc_dbadmin} -p$\"{dbc_dbadmpass}\"" + + # A small sanity check + if [ "${dbc_dbserver}" = "" ];then + dbc_dbserver="localhost"; + fi + # Assume empty password is OK. If so then -p must be absent from mysql call + if [ "${dbc_dbadmpass}" = "" ];then + l_dbc_dbadmpass="" + else + l_dbc_dbadmpass="-p${dbc_dbadmpass}" + fi + + echo "CREATE DATABASE IF NOT EXISTS ${dbc_dbname}_cell0 CHARACTER SET utf8 COLLATE utf8_unicode_ci;" | mysql -h ${dbc_dbserver} -u ${dbc_dbadmin} ${l_dbc_dbadmpass} echo "===> nova-common: Granting permissions on ${dbc_dbname}_cell0.* to '${dbc_dbuser}'@'${dbc_dballow}'" - echo "GRANT ALL PRIVILEGES ON ${dbc_dbname}_cell0.* TO '${dbc_dbuser}'@'${dbc_dballow}';" | mysql -h ${dbc_dbserver} -u ${dbc_dbadmin} -p${dbc_dbadmpass} + echo "GRANT ALL PRIVILEGES ON ${dbc_dbname}_cell0.* TO '${dbc_dbuser}'@'${dbc_dballow}';" | mysql -h ${dbc_dbserver} -u ${dbc_dbadmin} ${l_dbc_dbadmpass} elif [ "$RET" = "sqlite3" ]; then echo "===> nova-common: Creation of database $sqlite3_db_name in sqlite3 is not currently supported. Please create database manually." else diff --git a/debian/nova-common.prerm b/debian/nova-common.prerm index fa946271c0..96c3f3819e 100755 --- a/debian/nova-common.prerm +++ b/debian/nova-common.prerm @@ -7,11 +7,18 @@ remove_cell0_database (){ if [ "${dbc_dbtype}" = "mysql" ]; then # Drop nova_cell0 database echo "===> nova-common: Dumping ${dbc_dbname}_cell0 database to /var/tmp/nova-common.${dbc_dbname}_cell0.${dump_timestamp}.mysql" - mysqldump -h ${dbc_dbserver} -u ${dbc_dbadmin} -p${dbc_dbadmpass} ${dbc_dbname}_cell0 > /var/tmp/nova-common.${dbc_dbname}_cell0.${dump_timestamp}.mysql + # Assume empty password is OK. + # If so then -p must be absent from mysql call + if [ "${dbc_dbadmpass}" = "" ];then + l_dbc_dbadmpass="" + else + l_dbc_dbadmpass="-p${dbc_dbadmpass}" + fi + mysqldump -h ${dbc_dbserver} -u ${dbc_dbadmin} ${l_dbc_dbadmpass} ${dbc_dbname}_cell0 > /var/tmp/nova-common.${dbc_dbname}_cell0.${dump_timestamp}.mysql echo "===> nova-common: Revoking all privileges from '${dbc_dbuser}'@'${dbc_dballow}' for ${dbc_dbname}_cell0" - echo "REVOKE ALL PRIVILEGES ON ${dbc_dbname}_cell0.* FROM '${dbc_dbuser}'@'${dbc_dballow}';" | mysql -h ${dbc_dbserver} -u ${dbc_dbadmin} -p${dbc_dbadmpass} + echo "REVOKE ALL PRIVILEGES ON ${dbc_dbname}_cell0.* FROM '${dbc_dbuser}'@'${dbc_dballow}';" | mysql -h ${dbc_dbserver} -u ${dbc_dbadmin} ${l_dbc_dbadmpass} echo "===> nova-common: Droping database ${dbc_dbname}_cell0" - echo "DROP DATABASE ${dbc_dbname}_cell0" | mysql -h ${dbc_dbserver} -u ${dbc_dbadmin} -p${dbc_dbadmpass} + echo "DROP DATABASE ${dbc_dbname}_cell0" | mysql -h ${dbc_dbserver} -u ${dbc_dbadmin} ${l_dbc_dbadmpass} elif [ "$nova_database_type" = "sqlite3" ]; then echo "===> nova-common: Creation of database in sqlite3 is not currently supported. If you've created manually, delete also manually." else