[cli] Add command to display db connection str

There are several places in which rally looking for config file. Also,
there is a feature to transpit a config path while executing rally from
cli directly. This means that one installation of rally can load
different configuration files and use different database backends.

An ability to show exact database connection string which is used is
very useful for several cases:

1) before executing `rally-manage db recreate` to ensure that the
   correct database will be recreated.
2) before executing `rally-manage db upgrade` to ensure that the correct
   database is migrating
3) for debugging purpose to ensure that the proper configudation is
   loaded and the proper database is used.

Change-Id: Ib55e34946b7959bbcc85ab1c3c7baac5c4711906
This commit is contained in:
Andrey Kurilin 2017-08-02 19:08:12 +03:00
parent 03103e6d27
commit 386fba9a2b

View File

@ -20,6 +20,8 @@ from __future__ import print_function
import contextlib
import sys
from oslo_config import cfg
from rally.cli import cliutils
from rally.cli import envutils
from rally.common import db
@ -66,6 +68,10 @@ class DBCommands(object):
"""Print current Rally database revision UUID."""
print(db.schema_revision())
def show(self, api):
"""Show the connection string."""
print(cfg.CONF.database.connection)
def main():
categories = {"db": DBCommands}