From 5c8342cff5b5b98aedceb33df15487d367456d3d Mon Sep 17 00:00:00 2001 From: Ilya Shakhat Date: Mon, 9 Nov 2015 12:15:49 +0300 Subject: [PATCH] Generate default conf automatically Run tox -egenconfig to generate default conf Change-Id: Id91d1604ec097127bac805fe7fec424c18e1bc97 --- config-generator.conf | 5 ++ driverlog/processor/config.py | 6 ++ etc/driverlog.conf | 139 ++++++++++++++++++++++++++++++---- setup.cfg | 4 + tox.ini | 4 + 5 files changed, 142 insertions(+), 16 deletions(-) create mode 100644 config-generator.conf diff --git a/config-generator.conf b/config-generator.conf new file mode 100644 index 0000000..9a74089 --- /dev/null +++ b/config-generator.conf @@ -0,0 +1,5 @@ +[DEFAULT] +output_file = etc/driverlog.conf +wrap_width = 79 +namespace = driverlog.processor.config +namespace = oslo_log diff --git a/driverlog/processor/config.py b/driverlog/processor/config.py index 6a280aa..0009a5b 100644 --- a/driverlog/processor/config.py +++ b/driverlog/processor/config.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +import copy + from oslo_config import cfg @@ -34,3 +36,7 @@ OPTS = [ cfg.BoolOpt('force-update', default=False, help='Forcibly read default data and update records'), ] + + +def list_opts(): + yield (None, copy.deepcopy(OPTS)) diff --git a/etc/driverlog.conf b/etc/driverlog.conf index f40d7e0..1da943c 100644 --- a/etc/driverlog.conf +++ b/etc/driverlog.conf @@ -1,25 +1,132 @@ [DEFAULT] -# Default data -# default_data_uri = +# +# From driverlog.processor.config +# -# Hostname where dashboard listens on -# listen_host = 127.0.0.1 +# URI for default data (string value) +#default_data_uri = -# Port where dashboard listens on -# listen_port = 8080 +# The address dashboard listens on (string value) +#listen_host = 127.0.0.1 -# Runtime storage URI -# runtime_storage_uri = memcached://127.0.0.1:11211 +# The port dashboard listens on (integer value) +#listen_port = 8080 -# URI of review system -# review_uri = gerrit://review.openstack.org +# Storage URI (string value) +#runtime_storage_uri = memcached://127.0.0.1:11211 -# SSH key for gerrit review system access -# ssh_key_filename = /home/user/.ssh/id_rsa +# URI of review system (string value) +#review_uri = gerrit://review.openstack.org -# SSH username for gerrit review system access -# ssh_username = user +# SSH key for gerrit review system access (string value) +#ssh_key_filename = /home/user/.ssh/id_rsa -# Forcibly read default data and update records -# force_update = False +# SSH username for gerrit review system access (string value) +#ssh_username = user + +# Forcibly read default data and update records (boolean value) +#force_update = false + +# +# From oslo_log +# + +# Print debugging output (set logging level to DEBUG instead of default INFO +# level). (boolean value) +#debug = false + +# If set to false, will disable INFO logging level, making WARNING the default. +# (boolean value) +# This option is deprecated for removal. +# Its value may be silently ignored in the future. +#verbose = true + +# 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. Note that when logging +# configuration files are used then all logging configuration is set in the +# configuration file and other logging configuration options are ignored (for +# example, log_format). (string value) +# Deprecated group/name - [DEFAULT]/log_config +#log_config_append = + +# 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. This option is ignored if log_config_append is set. (string value) +#log_format = + +# Format string for %%(asctime)s in log records. Default: %(default)s . This +# option is ignored if log_config_append is set. (string value) +#log_date_format = %Y-%m-%d %H:%M:%S + +# (Optional) Name of log file to output to. If no default is set, logging will +# go to stdout. This option is ignored if log_config_append is set. (string +# value) +# Deprecated group/name - [DEFAULT]/logfile +#log_file = + +# (Optional) The base directory used for relative --log-file paths. This option +# is ignored if log_config_append is set. (string value) +# Deprecated group/name - [DEFAULT]/logdir +#log_dir = + +# (Optional) Uses logging handler designed to watch file system. When log file +# is moved or removed this handler will open a new log file with specified path +# instantaneously. It makes sense only if log-file option is specified and +# Linux platform is used. This option is ignored if log_config_append is set. +# (boolean value) +#watch_log_file = false + +# Use syslog for logging. Existing syslog format is DEPRECATED and will be +# changed later to honor RFC5424. This option is ignored if log_config_append +# is set. (boolean value) +#use_syslog = false + +# (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 Kilo, and will be removed in +# Mitaka, along with this option. This option is ignored if log_config_append +# is set. (boolean value) +# This option is deprecated for removal. +# Its value may be silently ignored in the future. +#use_syslog_rfc_format = true + +# Syslog facility to receive log lines. This option is ignored if +# log_config_append is set. (string value) +#syslog_log_facility = LOG_USER + +# Log output to standard error. This option is ignored if log_config_append is +# set. (boolean value) +#use_stderr = true + +# Format string to use for log messages with context. (string value) +#logging_context_format_string = %(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user_identity)s] %(instance)s%(message)s + +# Format string to use for log messages without context. (string value) +#logging_default_format_string = %(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s + +# Data to append to log format when level is DEBUG. (string value) +#logging_debug_format_suffix = %(funcName)s %(pathname)s:%(lineno)d + +# Prefix each line of exception output with this format. (string value) +#logging_exception_prefix = %(asctime)s.%(msecs)03d %(process)d ERROR %(name)s %(instance)s + +# List of logger=LEVEL pairs. This option is ignored if log_config_append is +# set. (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,requests.packages.urllib3.util.retry=WARN,urllib3.util.retry=WARN,keystonemiddleware=WARN,routes.middleware=WARN,stevedore=WARN,taskflow=WARN + +# Enables or disables publication of error events. (boolean value) +#publish_errors = false + +# The format for an instance that is passed with the log message. (string +# value) +#instance_format = "[instance: %(uuid)s] " + +# The format for an instance UUID that is passed with the log message. (string +# value) +#instance_uuid_format = "[instance: %(uuid)s] " + +# Enables or disables fatal status of deprecations. (boolean value) +#fatal_deprecations = false diff --git a/setup.cfg b/setup.cfg index 9c07eec..c110166 100644 --- a/setup.cfg +++ b/setup.cfg @@ -28,3 +28,7 @@ setup-hooks = console_scripts = driverlog-dashboard = driverlog.dashboard.web:main driverlog-processor = driverlog.processor.main:main + +oslo.config.opts = + oslo_log = oslo_log._options:list_opts + driverlog.processor.config = driverlog.processor.config:list_opts diff --git a/tox.ini b/tox.ini index b7b1130..893a00e 100644 --- a/tox.ini +++ b/tox.ini @@ -25,6 +25,10 @@ commands = {posargs} [testenv:cover] commands = python setup.py testr --coverage --testr-args='{posargs}' +[testenv:genconfig] +commands = + oslo-config-generator --config-file=config-generator.conf + [tox:jenkins] downloadcache = ~/cache/pip