diff --git a/README.rst b/README.rst index 0504e2a0..b57f8e9e 100644 --- a/README.rst +++ b/README.rst @@ -106,6 +106,10 @@ Release notes -v output. * New command ``openstack-jsoncheck`` to check for niceness of JSON files and reformat them. +* ``openstack-autohelp``: Update the default parameters. The tables + are generated in the doc/common/tables/ dir by default, and the git + repository for the project being worked on is looked at in a sources/ + dir by default. 0.13 ---- diff --git a/autogenerate_config_docs/README.md b/autogenerate_config_docs/README.md index ad10dfc6..b834661e 100644 --- a/autogenerate_config_docs/README.md +++ b/autogenerate_config_docs/README.md @@ -140,9 +140,11 @@ start. This can be done by sourcing the `venv/bin/activate` file. Now, download and install the projects. Installation is necessary to satisfy dependencies between projects. This will also install required dependencies. + $ mkdir -p sources && cd sources $ PROJECTS="ceilometer cinder glance heat neutron nova trove" $ for p in $PROJECTS; do git clone git://git.openstack.org/openstack/$p.git; done $ for p in $PROJECTS; do cd $p && python setup.py install && cd ..; done + $ cd .. Install some missing requirements: @@ -156,7 +158,7 @@ discovered. Update the flag names: $ for p in $PROJECTS; do - > ../../../openstack-doc-tools/autogenerate_config_docs/autohelp.py -vvv update $project -i $project + > ../../../openstack-doc-tools/autogenerate_config_docs/autohelp.py -vvv update $project > done At this point, search through the `*.flagmappings.new` files for anything @@ -165,7 +167,7 @@ files and run `autohelp.py` with the `docbook` subcommand: $ for p in $PROJECTS; do > mv $p.flagmappings.new $p.flagmappings - > ../../../openstack-doc-tools/autogenerate_config_docs/autohelp.py -vvv docbook $project -i $project + > ../../../openstack-doc-tools/autogenerate_config_docs/autohelp.py -vvv docbook $project > done to generate the XML files and move those into the appropriate part of diff --git a/autogenerate_config_docs/autohelp.py b/autogenerate_config_docs/autohelp.py index 11bd9f0e..781408e5 100755 --- a/autogenerate_config_docs/autohelp.py +++ b/autogenerate_config_docs/autohelp.py @@ -47,8 +47,8 @@ def git_check(repo_path): package_name = os.path.basename(repo.remotes.origin.url) package_name = package_name.replace('.git', '') except Exception: - print("\nThere is a problem verifying that the directory passed in") - print("is a valid git repository. Please try again.\n") + print("\n%s doesn't seem to be a valid git repository." % repo_path) + print("Use the -i flag to specify the repository path.\n") sys.exit(1) return package_name @@ -462,10 +462,10 @@ def main(): description='Manage flag files, to aid in updating documentation.', usage='%(prog)s [options]') parser.add_argument('subcommand', - help='action (create, update, verify) [REQUIRED]', + help='Action (create, update, verify).', choices=['create', 'update', 'docbook']) parser.add_argument('package', - help='name of the top-level package') + help='Name of the top-level package.') parser.add_argument('-v', '--verbose', action='count', default=0, @@ -473,17 +473,20 @@ def main(): required=False,) parser.add_argument('-i', '--input', dest='repo', - help='path to valid git repository [REQUIRED]', - required=True, + help='Path to a valid git repository.', + required=False, type=str,) parser.add_argument('-o', '--output', dest='target', - help='directory in which xml files are generated', + help='Directory in which xml files are generated.', required=False, - default='./', + default='../../doc/common/tables/', type=str,) args = parser.parse_args() + if args.repo is None: + args.repo = './sources/%s' % args.package + package_name = git_check(args.repo) sys.path.insert(0, args.repo) @@ -504,19 +507,16 @@ def main(): if args.subcommand == 'create': create_flagmappings(package_name, options, verbose=args.verbose) - return - if args.subcommand == 'update': + elif args.subcommand == 'update': update_flagmappings(package_name, options, verbose=args.verbose) - return - if args.subcommand == 'docbook': + elif args.subcommand == 'docbook': write_docbook(package_name, options, verbose=args.verbose, target=args.target) write_docbook_rootwrap(package_name, args.repo, verbose=args.verbose, target=args.target) - return if __name__ == "__main__":