Add sample conf file and generator tox target

This commit is contained in:
Ilya Shakhat 2015-02-09 17:44:50 +03:00
parent 6547f5972f
commit 46ab81b8b4
7 changed files with 163 additions and 10 deletions

5
config-generator.conf Normal file
View File

@ -0,0 +1,5 @@
[DEFAULT]
output_file = etc/shaker.conf
wrap_width = 79
namespace = shaker.engine.config
namespace = shaker.openstack.common.log

129
etc/shaker.conf Normal file
View File

@ -0,0 +1,129 @@
[DEFAULT]
#
# From shaker.engine.config
#
# Address for server connections (host:port) (string value)
#server_endpoint = <None>
#
# From shaker.engine.config
#
# Authentication URL, defaults to env[OS_AUTH_URL]. (string value)
#os_auth_url = http://172.18.161.230:5000/v2.0
# Authentication tenant name, defaults to env[OS_TENANT_NAME]. (string value)
#os_tenant_name = admin
# Authentication username, defaults to env[OS_USERNAME]. (string value)
#os_username = admin
# Authentication password, defaults to env[OS_PASSWORD]. (string value)
#os_password = admin
# Scenario file name (string value)
#scenario = <None>
#
# From shaker.engine.config
#
# The id of instance where agent is running (string value)
#instance_id = <None>
#
# From shaker.openstack.common.log
#
# Print debugging output (set logging level to DEBUG instead of default WARNING
# level). (boolean value)
#debug = false
# Print more verbose output (set logging level to INFO instead of default
# WARNING level). (boolean value)
#verbose = false
#
# From shaker.openstack.common.log
#
# 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. (string value)
# Deprecated group/name - [DEFAULT]/log_config
#log_config_append = <None>
# 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. (string value)
#log_format = <None>
# Format string for %%(asctime)s in log records. Default: %(default)s . (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. (string value)
# Deprecated group/name - [DEFAULT]/logfile
#log_file = <None>
# (Optional) The base directory used for relative --log-file paths. (string
# value)
# Deprecated group/name - [DEFAULT]/logdir
#log_dir = <None>
# Use syslog for logging. Existing syslog format is DEPRECATED during I, and
# will change in J to honor RFC5424. (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 I, and will be removed in J.
# (boolean value)
#use_syslog_rfc_format = false
# Syslog facility to receive log lines. (string value)
#syslog_log_facility = LOG_USER
#
# From shaker.openstack.common.log
#
# Log output to standard error. (boolean value)
#use_stderr = true
#
# From shaker.openstack.common.log
#
# 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 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
# Enables or disables publication of error events. (boolean value)
#publish_errors = false
# Enables or disables fatal status of deprecations. (boolean value)
#fatal_deprecations = 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] "

View File

@ -26,3 +26,7 @@ packages =
console_scripts =
shaker = shaker.engine.server:main
shaker-agent = shaker.agent.agent:main
oslo.config.opts =
shaker.openstack.common.log = shaker.openstack.common.log:list_opts
shaker.engine.config = shaker.engine.config:list_opts

View File

@ -64,7 +64,9 @@ def send_reply(socket, instance_id, result):
def main():
# init conf and logging
conf = cfg.CONF
conf.register_cli_opts(config.COMMON_OPTS)
conf.register_cli_opts(config.AGENT_OPTS)
conf.register_opts(config.COMMON_OPTS)
conf.register_opts(config.AGENT_OPTS)
try:

View File

@ -13,11 +13,19 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import copy
from oslo.config import cfg
from shaker.engine import utils
OPTS = [
COMMON_OPTS = [
cfg.StrOpt('server-endpoint',
required=True,
help='Address for server connections (host:port)'),
]
SERVER_OPTS = [
cfg.StrOpt('os-auth-url', metavar='<auth-url>',
default=utils.env('OS_AUTH_URL'),
help='Authentication URL, defaults to env[OS_AUTH_URL].'),
@ -35,16 +43,15 @@ OPTS = [
cfg.StrOpt('scenario',
required=True,
help='Scenario file name'),
cfg.StrOpt('server-endpoint',
required=True,
help='Address for server connections (host:port)'),
]
AGENT_OPTS = [
cfg.StrOpt('server-endpoint',
required=True,
help='Address for server connections (host:port)'),
cfg.StrOpt('instance-id',
help='The id of instance where agent is running'),
]
def list_opts():
yield (None, copy.deepcopy(COMMON_OPTS))
yield (None, copy.deepcopy(SERVER_OPTS))
yield (None, copy.deepcopy(AGENT_OPTS))

View File

@ -183,8 +183,10 @@ def execute(execution, brigades):
def main():
# init conf and logging
conf = cfg.CONF
conf.register_cli_opts(config.OPTS)
conf.register_opts(config.OPTS)
conf.register_cli_opts(config.COMMON_OPTS)
conf.register_cli_opts(config.SERVER_OPTS)
conf.register_opts(config.COMMON_OPTS)
conf.register_opts(config.SERVER_OPTS)
try:
conf(project='shaker')

View File

@ -30,6 +30,10 @@ commands = bash -c "find {toxinidir} -type f -not -wholename \*.tox/\* -and \( -
[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