rename and fix the db_wipe command

* rename db_wipe to db_recreate
* make --repo-path an optional argument for db_wipe and use it
* add command line help strings for db_wipe

Closes-Bug: #1279734

Change-Id: I1a1d3ad56989026fb10f6c57bb479814dc51328e
This commit is contained in:
Ionuț Arțăriși 2014-02-13 11:26:56 +01:00
parent 8f200b7371
commit a5d745dd87
3 changed files with 9 additions and 5 deletions

View File

@ -212,7 +212,7 @@ Prepare database
----------------
* Initialize the database::
# trove-manage --config-file=<PathToTroveConf> db_wipe trove_test.sqlite mysql fake
# trove-manage --config-file=<PathToTroveConf> db_recreate trove_test.sqlite mysql fake
* Setup trove to use the uploaded image. Enter the following in a single line, note quotes (') and backquotes(`)::

View File

@ -10,7 +10,7 @@ function run() {
.tox/py26/bin/python $@
}
run bin/trove-manage \
--config-file=etc/trove/trove.conf.test db_wipe \
--config-file=etc/trove/trove.conf.test db_recreate \
trove_test.sqlite mysql fake
run bin/trove-fake-mode \
--fork --config-file=etc/trove/trove.conf.test \

View File

@ -77,10 +77,10 @@ class Commands(object):
except exception.DatastoreNotFound as e:
print(e)
def db_wipe(self, repo_path):
def db_recreate(self, repo_path):
"""Drops the database and recreates it."""
self.db_api.drop_db(CONF)
self.db_sync()
self.db_sync(repo_path)
def params_of(self, command_name):
if Commands.has(command_name):
@ -113,7 +113,11 @@ def main():
parser.add_argument('packages')
parser.add_argument('active')
parser = subparser.add_parser('db_wipe')
parser = subparser.add_parser(
'db_recreate', description='Drop the database and recreate it')
parser.add_argument(
'--repo_path', help='SQLAlchemy Migrate repository path')
parser = subparser.add_parser('db_recreate')
parser.add_argument('repo_path')
cfg.custom_parser('action', actions)