[CLI] Introduce rally db <command>
Having 2 entrypoint seems redudant and complicated for end users, so instead of rally-manage db <commands> let's use rally db <commands> This reduces amount of code and commands needed to know to work with Rally which is actually good. This patch doesn't remove rally-manage just deprecates it Change-Id: Ib35db2d22174cd3d3eee0d87358ad07a91dce0d9
This commit is contained in:
parent
e63f221952
commit
07e0f94043
@ -20,7 +20,6 @@ from docutils.parsers import rst
|
|||||||
|
|
||||||
from rally.cli import cliutils
|
from rally.cli import cliutils
|
||||||
from rally.cli import main
|
from rally.cli import main
|
||||||
from rally.cli import manage
|
|
||||||
import utils
|
import utils
|
||||||
|
|
||||||
|
|
||||||
@ -153,10 +152,7 @@ def get_defaults(func):
|
|||||||
|
|
||||||
|
|
||||||
def make_command_section(category_name, name, parser):
|
def make_command_section(category_name, name, parser):
|
||||||
# NOTE(andreykurilin): there is only one category in rally-manage, so
|
section = utils.subcategory("rally %s %s" % (category_name, name))
|
||||||
# let's just hardcode it.
|
|
||||||
cmd = "rally-manage" if category_name == "db" else "rally"
|
|
||||||
section = utils.subcategory("%s %s %s" % (cmd, category_name, name))
|
|
||||||
section.extend(utils.parse_text(parser["description"]))
|
section.extend(utils.parse_text(parser["description"]))
|
||||||
if parser["parser"].arguments:
|
if parser["parser"].arguments:
|
||||||
defaults = get_defaults(parser["parser"].defaults["action_fn"])
|
defaults = get_defaults(parser["parser"].defaults["action_fn"])
|
||||||
@ -196,7 +192,6 @@ class CLIReferenceDirective(rst.Directive):
|
|||||||
def run(self):
|
def run(self):
|
||||||
parser = Parser()
|
parser = Parser()
|
||||||
categories = copy.copy(main.categories)
|
categories = copy.copy(main.categories)
|
||||||
categories["db"] = manage.DBCommands
|
|
||||||
if "group" in self.options:
|
if "group" in self.options:
|
||||||
categories = {k: v for k, v in categories.items()
|
categories = {k: v for k, v in categories.items()
|
||||||
if k == self.options["group"]}
|
if k == self.options["group"]}
|
||||||
|
@ -18,6 +18,11 @@ _rally()
|
|||||||
declare -A SUBCOMMANDS
|
declare -A SUBCOMMANDS
|
||||||
declare -A OPTS
|
declare -A OPTS
|
||||||
|
|
||||||
|
OPTS["db_create"]=""
|
||||||
|
OPTS["db_recreate"]=""
|
||||||
|
OPTS["db_revision"]=""
|
||||||
|
OPTS["db_show"]=""
|
||||||
|
OPTS["db_upgrade"]=""
|
||||||
OPTS["deployment_check"]="--deployment"
|
OPTS["deployment_check"]="--deployment"
|
||||||
OPTS["deployment_config"]="--deployment"
|
OPTS["deployment_config"]="--deployment"
|
||||||
OPTS["deployment_create"]="--name --fromenv --filename --no-use"
|
OPTS["deployment_create"]="--name --fromenv --filename --no-use"
|
||||||
@ -91,4 +96,4 @@ _rally()
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
complete -o filenames -F _rally rally
|
complete -o filenames -F _rally rally
|
@ -558,7 +558,7 @@ def check_db_imports_in_cli(logical_line, physical_line, filename):
|
|||||||
N360
|
N360
|
||||||
"""
|
"""
|
||||||
if (not filename.startswith("./rally/cli")
|
if (not filename.startswith("./rally/cli")
|
||||||
or filename == "./rally/cli/manage.py"):
|
or filename == "./rally/cli/commands/db.py"):
|
||||||
return
|
return
|
||||||
if re_db_import.search(logical_line):
|
if re_db_import.search(logical_line):
|
||||||
yield (0, "N360 CLI modules do not allow to work with "
|
yield (0, "N360 CLI modules do not allow to work with "
|
||||||
|
Loading…
x
Reference in New Issue
Block a user