Generate docs for console tools

Change-Id: I6eab9ba7068f4194b94ff1a109672959ce81f901
This commit is contained in:
Ilya Shakhat 2015-03-16 00:07:59 +03:00
parent bfa290680c
commit db2076bed2
12 changed files with 516 additions and 5 deletions

View File

@ -1,5 +1,4 @@
<h3>Useful Links</h3>
<ul>
<li><a href="https://wiki.openstack.org/wiki/Stackalytics">Stackalytics @ OpenStack Wiki</a></li>
<li><a href="https://launchpad.net/stackalytics">Stackalytics @ Launchpad</a></li>
<li><a href="https://launchpad.net/shaker">Shaker @ Launchpad</a></li>
</ul>

View File

@ -199,7 +199,7 @@ latex_elements = {
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'stackalyticsdoc.tex', u'Stackalytics',
('index', 'shakerdoc.tex', u'Shaker',
u'Mirantis Inc.', 'manual'),
]

View File

@ -1,4 +1,6 @@
Welcome to Shaker!
==================
Shake VMs with our sheer-class tests!
Shake VMs with our sheer-class tests!
.. include:: tools.rst

28
doc/source/tools.rst Normal file
View File

@ -0,0 +1,28 @@
shaker
------
The tool runs specified scenario
.. literalinclude:: tools/shaker.txt
shaker-agent
------------
.. literalinclude:: tools/shaker-agent.txt
shaker-report
-------------
.. literalinclude:: tools/shaker-report.txt
shaker-image-builder
--------------------
The tool that creates master image in OpenStack cloud.
.. literalinclude:: tools/shaker-image-builder.txt
shaker-cleanup
--------------
.. literalinclude:: tools/shaker-cleanup.txt

View File

@ -0,0 +1,67 @@
usage: shaker-agent [-h] [--agent-id AGENT_ID] [--config-dir DIR]
[--config-file PATH] [--debug] [--log-config-append PATH]
[--log-date-format DATE_FORMAT] [--log-dir LOG_DIR]
[--log-file PATH] [--log-format FORMAT] [--nodebug]
[--nouse-syslog] [--nouse-syslog-rfc-format] [--noverbose]
[--polling-interval POLLING_INTERVAL]
[--syslog-log-facility SYSLOG_LOG_FACILITY] [--use-syslog]
[--use-syslog-rfc-format] [--verbose] [--version]
[--server-endpoint SERVER_ENDPOINT]
optional arguments:
-h, --help show this help message and exit
--agent-id AGENT_ID Agent unique id, defaults to env[SHAKER_AGENT_ID].
--config-dir DIR Path to a config directory to pull *.conf files from.
This file set is sorted, so as to provide a
predictable parse order if individual options are
over-ridden. The set is parsed after the file(s)
specified via previous --config-file, arguments hence
over-ridden options in the directory take precedence.
--config-file PATH Path to a config file to use. Multiple config files
can be specified, with values in later files taking
precedence. The default files used are: None.
--debug, -d Print debugging output (set logging level to DEBUG
instead of default WARNING level).
--log-config-append PATH, --log_config PATH
The name of a logging configuration file. This file is
appended to any existing logging configuration files.
For details about logging configuration files, see the
Python logging module documentation.
--log-date-format DATE_FORMAT
Format string for %(asctime)s in log records. Default:
None .
--log-dir LOG_DIR, --logdir LOG_DIR
(Optional) The base directory used for relative --log-
file paths.
--log-file PATH, --logfile PATH
(Optional) Name of log file to output to. If no
default is set, logging will go to stdout.
--log-format FORMAT DEPRECATED. A logging.Formatter log message format
string which may use any of the available
logging.LogRecord attributes. This option is
deprecated. Please use logging_context_format_string
and logging_default_format_string instead.
--nodebug The inverse of --debug
--nouse-syslog The inverse of --use-syslog
--nouse-syslog-rfc-format
The inverse of --use-syslog-rfc-format
--noverbose The inverse of --verbose
--polling-interval POLLING_INTERVAL
How frequently the agent polls server, in seconds
--syslog-log-facility SYSLOG_LOG_FACILITY
Syslog facility to receive log lines.
--use-syslog Use syslog for logging. Existing syslog format is
DEPRECATED during I, and will change in J to honor
RFC5424.
--use-syslog-rfc-format
(Optional) Enables or disables syslog rfc5424 format
for logging. If enabled, prefixes the MSG part of the
syslog message with APP-NAME (RFC5424). The format
without the APP-NAME is deprecated in I, and will be
removed in J.
--verbose, -v Print more verbose output (set logging level to INFO
instead of default WARNING level).
--version show program's version number and exit
--server-endpoint SERVER_ENDPOINT
Address for server connections (host:port), defaults
to env[SHAKER_SERVER_ENDPOINT].

View File

@ -0,0 +1,91 @@
usage: shaker-cleanup [-h] [--config-dir DIR] [--config-file PATH] [--debug]
[--external-net EXTERNAL_NET]
[--flavor-name FLAVOR_NAME]
[--image-builder-template IMAGE_BUILDER_TEMPLATE]
[--image-name IMAGE_NAME] [--log-config-append PATH]
[--log-date-format DATE_FORMAT] [--log-dir LOG_DIR]
[--log-file PATH] [--log-format FORMAT] [--nodebug]
[--nouse-syslog] [--nouse-syslog-rfc-format]
[--noverbose] [--os-password <auth-password>]
[--os-region-name <auth-region-name>]
[--os-tenant-name <auth-tenant-name>]
[--os-username <auth-username>]
[--syslog-log-facility SYSLOG_LOG_FACILITY]
[--use-syslog] [--use-syslog-rfc-format] [--verbose]
[--version] [--os-auth-url <auth-url>]
optional arguments:
-h, --help show this help message and exit
--config-dir DIR Path to a config directory to pull *.conf files from.
This file set is sorted, so as to provide a
predictable parse order if individual options are
over-ridden. The set is parsed after the file(s)
specified via previous --config-file, arguments hence
over-ridden options in the directory take precedence.
--config-file PATH Path to a config file to use. Multiple config files
can be specified, with values in later files taking
precedence. The default files used are: None.
--debug, -d Print debugging output (set logging level to DEBUG
instead of default WARNING level).
--external-net EXTERNAL_NET
Name or ID of external network, defaults to
env[SHAKER_EXTERNAL_NET]. If no value provided then
Shaker picks any of available external networks.
--flavor-name FLAVOR_NAME
Name of image flavor. The default is created by
shaker-image-builder.
--image-builder-template IMAGE_BUILDER_TEMPLATE
Heat template for the image builder.
--image-name IMAGE_NAME
Name of image to use. The default is created by
shaker-image-builder.
--log-config-append PATH, --log_config PATH
The name of a logging configuration file. This file is
appended to any existing logging configuration files.
For details about logging configuration files, see the
Python logging module documentation.
--log-date-format DATE_FORMAT
Format string for %(asctime)s in log records. Default:
None .
--log-dir LOG_DIR, --logdir LOG_DIR
(Optional) The base directory used for relative --log-
file paths.
--log-file PATH, --logfile PATH
(Optional) Name of log file to output to. If no
default is set, logging will go to stdout.
--log-format FORMAT DEPRECATED. A logging.Formatter log message format
string which may use any of the available
logging.LogRecord attributes. This option is
deprecated. Please use logging_context_format_string
and logging_default_format_string instead.
--nodebug The inverse of --debug
--nouse-syslog The inverse of --use-syslog
--nouse-syslog-rfc-format
The inverse of --use-syslog-rfc-format
--noverbose The inverse of --verbose
--os-password <auth-password>
Authentication password, defaults to env[OS_PASSWORD].
--os-region-name <auth-region-name>
Authentication region name, defaults to
env[OS_REGION_NAME].
--os-tenant-name <auth-tenant-name>
Authentication tenant name, defaults to
env[OS_TENANT_NAME].
--os-username <auth-username>
Authentication username, defaults to env[OS_USERNAME].
--syslog-log-facility SYSLOG_LOG_FACILITY
Syslog facility to receive log lines.
--use-syslog Use syslog for logging. Existing syslog format is
DEPRECATED during I, and will change in J to honor
RFC5424.
--use-syslog-rfc-format
(Optional) Enables or disables syslog rfc5424 format
for logging. If enabled, prefixes the MSG part of the
syslog message with APP-NAME (RFC5424). The format
without the APP-NAME is deprecated in I, and will be
removed in J.
--verbose, -v Print more verbose output (set logging level to INFO
instead of default WARNING level).
--version show program's version number and exit
--os-auth-url <auth-url>
Authentication URL, defaults to env[OS_AUTH_URL].

View File

@ -0,0 +1,93 @@
usage: shaker-image-builder [-h] [--config-dir DIR] [--config-file PATH]
[--debug] [--external-net EXTERNAL_NET]
[--flavor-name FLAVOR_NAME]
[--image-builder-template IMAGE_BUILDER_TEMPLATE]
[--image-name IMAGE_NAME]
[--log-config-append PATH]
[--log-date-format DATE_FORMAT]
[--log-dir LOG_DIR] [--log-file PATH]
[--log-format FORMAT] [--nodebug] [--nouse-syslog]
[--nouse-syslog-rfc-format] [--noverbose]
[--os-password <auth-password>]
[--os-region-name <auth-region-name>]
[--os-tenant-name <auth-tenant-name>]
[--os-username <auth-username>]
[--syslog-log-facility SYSLOG_LOG_FACILITY]
[--use-syslog] [--use-syslog-rfc-format]
[--verbose] [--version] [--os-auth-url <auth-url>]
optional arguments:
-h, --help show this help message and exit
--config-dir DIR Path to a config directory to pull *.conf files from.
This file set is sorted, so as to provide a
predictable parse order if individual options are
over-ridden. The set is parsed after the file(s)
specified via previous --config-file, arguments hence
over-ridden options in the directory take precedence.
--config-file PATH Path to a config file to use. Multiple config files
can be specified, with values in later files taking
precedence. The default files used are: None.
--debug, -d Print debugging output (set logging level to DEBUG
instead of default WARNING level).
--external-net EXTERNAL_NET
Name or ID of external network, defaults to
env[SHAKER_EXTERNAL_NET]. If no value provided then
Shaker picks any of available external networks.
--flavor-name FLAVOR_NAME
Name of image flavor. The default is created by
shaker-image-builder.
--image-builder-template IMAGE_BUILDER_TEMPLATE
Heat template for the image builder.
--image-name IMAGE_NAME
Name of image to use. The default is created by
shaker-image-builder.
--log-config-append PATH, --log_config PATH
The name of a logging configuration file. This file is
appended to any existing logging configuration files.
For details about logging configuration files, see the
Python logging module documentation.
--log-date-format DATE_FORMAT
Format string for %(asctime)s in log records. Default:
None .
--log-dir LOG_DIR, --logdir LOG_DIR
(Optional) The base directory used for relative --log-
file paths.
--log-file PATH, --logfile PATH
(Optional) Name of log file to output to. If no
default is set, logging will go to stdout.
--log-format FORMAT DEPRECATED. A logging.Formatter log message format
string which may use any of the available
logging.LogRecord attributes. This option is
deprecated. Please use logging_context_format_string
and logging_default_format_string instead.
--nodebug The inverse of --debug
--nouse-syslog The inverse of --use-syslog
--nouse-syslog-rfc-format
The inverse of --use-syslog-rfc-format
--noverbose The inverse of --verbose
--os-password <auth-password>
Authentication password, defaults to env[OS_PASSWORD].
--os-region-name <auth-region-name>
Authentication region name, defaults to
env[OS_REGION_NAME].
--os-tenant-name <auth-tenant-name>
Authentication tenant name, defaults to
env[OS_TENANT_NAME].
--os-username <auth-username>
Authentication username, defaults to env[OS_USERNAME].
--syslog-log-facility SYSLOG_LOG_FACILITY
Syslog facility to receive log lines.
--use-syslog Use syslog for logging. Existing syslog format is
DEPRECATED during I, and will change in J to honor
RFC5424.
--use-syslog-rfc-format
(Optional) Enables or disables syslog rfc5424 format
for logging. If enabled, prefixes the MSG part of the
syslog message with APP-NAME (RFC5424). The format
without the APP-NAME is deprecated in I, and will be
removed in J.
--verbose, -v Print more verbose output (set logging level to INFO
instead of default WARNING level).
--version show program's version number and exit
--os-auth-url <auth-url>
Authentication URL, defaults to env[OS_AUTH_URL].

View File

@ -0,0 +1,67 @@
usage: shaker-report [-h] [--config-dir DIR] [--config-file PATH] [--debug]
[--input INPUT] [--log-config-append PATH]
[--log-date-format DATE_FORMAT] [--log-dir LOG_DIR]
[--log-file PATH] [--log-format FORMAT] [--nodebug]
[--nouse-syslog] [--nouse-syslog-rfc-format]
[--noverbose] [--report REPORT]
[--syslog-log-facility SYSLOG_LOG_FACILITY]
[--use-syslog] [--use-syslog-rfc-format] [--verbose]
[--version] [--report-template REPORT_TEMPLATE]
optional arguments:
-h, --help show this help message and exit
--config-dir DIR Path to a config directory to pull *.conf files from.
This file set is sorted, so as to provide a
predictable parse order if individual options are
over-ridden. The set is parsed after the file(s)
specified via previous --config-file, arguments hence
over-ridden options in the directory take precedence.
--config-file PATH Path to a config file to use. Multiple config files
can be specified, with values in later files taking
precedence. The default files used are: None.
--debug, -d Print debugging output (set logging level to DEBUG
instead of default WARNING level).
--input INPUT File to read test results from, defaults to
env[SHAKER_INPUT].
--log-config-append PATH, --log_config PATH
The name of a logging configuration file. This file is
appended to any existing logging configuration files.
For details about logging configuration files, see the
Python logging module documentation.
--log-date-format DATE_FORMAT
Format string for %(asctime)s in log records. Default:
None .
--log-dir LOG_DIR, --logdir LOG_DIR
(Optional) The base directory used for relative --log-
file paths.
--log-file PATH, --logfile PATH
(Optional) Name of log file to output to. If no
default is set, logging will go to stdout.
--log-format FORMAT DEPRECATED. A logging.Formatter log message format
string which may use any of the available
logging.LogRecord attributes. This option is
deprecated. Please use logging_context_format_string
and logging_default_format_string instead.
--nodebug The inverse of --debug
--nouse-syslog The inverse of --use-syslog
--nouse-syslog-rfc-format
The inverse of --use-syslog-rfc-format
--noverbose The inverse of --verbose
--report REPORT Report file name, defaults to env[SHAKER_REPORT]. If
no value provided the report is printed to stdout.
--syslog-log-facility SYSLOG_LOG_FACILITY
Syslog facility to receive log lines.
--use-syslog Use syslog for logging. Existing syslog format is
DEPRECATED during I, and will change in J to honor
RFC5424.
--use-syslog-rfc-format
(Optional) Enables or disables syslog rfc5424 format
for logging. If enabled, prefixes the MSG part of the
syslog message with APP-NAME (RFC5424). The format
without the APP-NAME is deprecated in I, and will be
removed in J.
--verbose, -v Print more verbose output (set logging level to INFO
instead of default WARNING level).
--version show program's version number and exit
--report-template REPORT_TEMPLATE
Report template in Jinja format

101
doc/source/tools/shaker.txt Normal file
View File

@ -0,0 +1,101 @@
usage: shaker [-h] [--config-dir DIR] [--config-file PATH] [--debug]
[--external-net EXTERNAL_NET] [--flavor-name FLAVOR_NAME]
[--image-name IMAGE_NAME] [--log-config-append PATH]
[--log-date-format DATE_FORMAT] [--log-dir LOG_DIR]
[--log-file PATH] [--log-format FORMAT] [--nodebug]
[--nouse-syslog] [--nouse-syslog-rfc-format] [--noverbose]
[--os-auth-url <auth-url>] [--os-password <auth-password>]
[--os-region-name <auth-region-name>]
[--os-tenant-name <auth-tenant-name>]
[--os-username <auth-username>] [--output OUTPUT]
[--polling-interval POLLING_INTERVAL] [--report REPORT]
[--report-template REPORT_TEMPLATE] [--scenario SCENARIO]
[--syslog-log-facility SYSLOG_LOG_FACILITY] [--use-syslog]
[--use-syslog-rfc-format] [--verbose] [--version]
[--server-endpoint SERVER_ENDPOINT]
optional arguments:
-h, --help show this help message and exit
--config-dir DIR Path to a config directory to pull *.conf files from.
This file set is sorted, so as to provide a
predictable parse order if individual options are
over-ridden. The set is parsed after the file(s)
specified via previous --config-file, arguments hence
over-ridden options in the directory take precedence.
--config-file PATH Path to a config file to use. Multiple config files
can be specified, with values in later files taking
precedence. The default files used are: None.
--debug, -d Print debugging output (set logging level to DEBUG
instead of default WARNING level).
--external-net EXTERNAL_NET
Name or ID of external network, defaults to
env[SHAKER_EXTERNAL_NET]. If no value provided then
Shaker picks any of available external networks.
--flavor-name FLAVOR_NAME
Name of image flavor. The default is created by
shaker-image-builder.
--image-name IMAGE_NAME
Name of image to use. The default is created by
shaker-image-builder.
--log-config-append PATH, --log_config PATH
The name of a logging configuration file. This file is
appended to any existing logging configuration files.
For details about logging configuration files, see the
Python logging module documentation.
--log-date-format DATE_FORMAT
Format string for %(asctime)s in log records. Default:
None .
--log-dir LOG_DIR, --logdir LOG_DIR
(Optional) The base directory used for relative --log-
file paths.
--log-file PATH, --logfile PATH
(Optional) Name of log file to output to. If no
default is set, logging will go to stdout.
--log-format FORMAT DEPRECATED. A logging.Formatter log message format
string which may use any of the available
logging.LogRecord attributes. This option is
deprecated. Please use logging_context_format_string
and logging_default_format_string instead.
--nodebug The inverse of --debug
--nouse-syslog The inverse of --use-syslog
--nouse-syslog-rfc-format
The inverse of --use-syslog-rfc-format
--noverbose The inverse of --verbose
--os-auth-url <auth-url>
Authentication URL, defaults to env[OS_AUTH_URL].
--os-password <auth-password>
Authentication password, defaults to env[OS_PASSWORD].
--os-region-name <auth-region-name>
Authentication region name, defaults to
env[OS_REGION_NAME].
--os-tenant-name <auth-tenant-name>
Authentication tenant name, defaults to
env[OS_TENANT_NAME].
--os-username <auth-username>
Authentication username, defaults to env[OS_USERNAME].
--output OUTPUT File for output in JSON format, defaults to
env[SHAKER_OUTPUT].
--polling-interval POLLING_INTERVAL
How frequently the agent polls server, in seconds
--report REPORT Report file name, defaults to env[SHAKER_REPORT]. If
no value provided the report is printed to stdout.
--report-template REPORT_TEMPLATE
Report template in Jinja format
--scenario SCENARIO Scenario file name, defaults to env[SHAKER_SCENARIO].
--syslog-log-facility SYSLOG_LOG_FACILITY
Syslog facility to receive log lines.
--use-syslog Use syslog for logging. Existing syslog format is
DEPRECATED during I, and will change in J to honor
RFC5424.
--use-syslog-rfc-format
(Optional) Enables or disables syslog rfc5424 format
for logging. If enabled, prefixes the MSG part of the
syslog message with APP-NAME (RFC5424). The format
without the APP-NAME is deprecated in I, and will be
removed in J.
--verbose, -v Print more verbose output (set logging level to INFO
instead of default WARNING level).
--version show program's version number and exit
--server-endpoint SERVER_ENDPOINT
Address for server connections (host:port), defaults
to env[SHAKER_SERVER_ENDPOINT].

View File

@ -67,7 +67,7 @@
#logging_exception_prefix = %(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s
# List of logger=LEVEL pairs. (list value)
#default_log_levels = amqp=WARN,amqplib=WARN,boto=WARN,qpid=WARN,sqlalchemy=WARN,suds=INFO,oslo.messaging=INFO,iso8601=WARN,requests.packages.urllib3.connectionpool=WARN,urllib3.connectionpool=WARN,websocket=WARN,keystonemiddleware=WARN,routes.middleware=WARN,stevedore=WARN
#default_log_levels = amqp=WARN,amqplib=WARN,boto=WARN,qpid=WARN,sqlalchemy=WARN,suds=INFO,oslo.messaging=INFO,iso8601=WARN,requests.packages.urllib3.connectionpool=WARN,urllib3.connectionpool=WARN,websocket=WARN,requests.packages.urllib3.util.retry=WARN,urllib3.util.retry=WARN,keystonemiddleware=WARN,routes.middleware=WARN,stevedore=WARN
# Enables or disables publication of error events. (boolean value)
#publish_errors = false

62
tools/cli_auto_doc.py Normal file
View File

@ -0,0 +1,62 @@
# Copyright (c) 2015 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import sys
try:
import ConfigParser as configparser
except ImportError:
import configparser
def split_multiline(value):
value = [element for element in
(line.strip() for line in value.split('\n'))
if element]
return value
def get_entry_points(config):
if 'entry_points' not in config:
return {}
return dict((option, split_multiline(value))
for option, value in config['entry_points'].items())
def make(cfg, dest):
parser = configparser.RawConfigParser()
parser.read(cfg)
config = {}
for section in parser.sections():
config[section] = dict(parser.items(section))
entry_points = get_entry_points(config)
console_scripts = entry_points.get('console_scripts')
if console_scripts:
for item in console_scripts:
tool = item.split('=')[0].strip()
print('Running %s' % tool)
os.system('%(tool)s --help > %(dest)s/%(tool)s.txt' %
dict(tool=tool, dest=dest))
if len(sys.argv) < 2:
print('Usage: cli_auto_doc <dest folder>')
sys.exit(1)
print('Generating docs from help to console tools')
make(cfg='setup.cfg', dest=sys.argv[1])

View File

@ -33,6 +33,7 @@ commands = python setup.py testr --coverage --testr-args='{posargs}'
[testenv:genconfig]
commands =
oslo-config-generator --config-file=config-generator.conf
python tools/cli_auto_doc.py doc/source/tools
[tox:jenkins]
downloadcache = ~/cache/pip