Configure database api in upgrade check

https://review.openstack.org/#/c/631671/ added a new CLI command:

   `placement-status upgrade check`

However, it fails logging that it finds no database connection info.
This patch fixes it calling the placement.db_api.configure() before
connecting the database.

Change-Id: Icf0be55ef9aa8f858eb386a9b69cbb7e2bf81b07
Closes-Bug: #1812829
This commit is contained in:
Tetsuro Nakamura 2019-01-22 09:42:07 +00:00
parent be69734728
commit 271727adaf
1 changed files with 3 additions and 0 deletions

View File

@ -15,6 +15,7 @@ import sys
from oslo_config import cfg
from oslo_upgradecheck import upgradecheck
from placement import conf
from placement import context
from placement.db.sqlalchemy import models
from placement import db_api
@ -57,6 +58,7 @@ class Checks(upgradecheck.UpgradeCommands):
friendly reminder and because the data migration will eventually be
removed from nova along with the rest of the placement code.
"""
db_api.configure(cfg.CONF)
missing_consumer_count = self._count_missing_consumers(self.ctxt)
if missing_consumer_count:
# We found missing consumers for existing allocations so return
@ -83,6 +85,7 @@ class Checks(upgradecheck.UpgradeCommands):
def main():
conf.register_opts(cfg.CONF)
return upgradecheck.main(
cfg.CONF, project='placement', upgrade_command=Checks())