Add oslo.config entry point for Freezer-scheduler

Allows freezer-scheduler to generate sample config files for the
ease of use. To generate a config file use the following command:
oslo-config-generator --config-file config-generator/scheduler.conf
it will generate a sample config file in freezer/etc

Change-Id: Ib24454708b19a1a2ea3e374cbb3b374b1c66e685
Closes-Bug: #1548346
This commit is contained in:
Saad Zaher 2016-02-22 15:24:08 +00:00
parent f3efecefe5
commit 5a0c2e9c07
4 changed files with 153 additions and 1 deletions

View File

@ -0,0 +1,6 @@
[DEFAULT]
output_file = etc/scheduler.conf.sample
wrap_width = 79
namespace = scheduler
namespace = oslo.log

138
etc/scheduler.conf.sample Normal file
View File

@ -0,0 +1,138 @@
[DEFAULT]
#
# From oslo.log
#
# If set to true, the logging level will be set to DEBUG instead of the default
# INFO level. (boolean value)
#debug = false
# If set to false, the logging level will be set to WARNING instead of the
# default INFO level. (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 all logging configuration is defined 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 = <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. This option is ignored if log_config_append is set. (string value)
#log_format = <None>
# Defines the 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 send logging output to. If no default is set,
# logging will go to stderr as defined by use_stderr. This option is ignored if
# log_config_append is set. (string value)
# Deprecated group/name - [DEFAULT]/logfile
#log_file = <None>
# (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 = <None>
# 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
# Enables or disables syslog rfc5424 format for logging. If enabled, prefixes
# the MSG part of the syslog message with APP-NAME (RFC5424). 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.
# Reason: The format without the APP-NAME is deprecated in Kilo, and will be
# removed in Mitaka, along with this option.
#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 when context is undefined. (string
# value)
#logging_default_format_string = %(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s
# Additional data to append to log message when logging level for the message
# 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
# Defines the format string for %(user_identity)s that is used in
# logging_context_format_string. (string value)
#logging_user_identity_format = %(user)s %(tenant)s %(domain)s %(user_domain)s %(project_domain)s
# List of package logging levels in 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,keystoneauth=WARN,oslo.cache=INFO,dogpile.core.dogpile=INFO
# 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
#
# From scheduler
#
# Specifies the client_id used when contacting the service.
# If not specified it will be automatically created
# using the tenant-id and the machine hostname. (string value)
#client_id = <None>
# Prevents the scheduler from using the api service (boolean value)
#no_api = false
# Used to store/retrieve files on local storage, including those exchanged with
# the api service.Default value is /etc/freezer/scheduler/conf.d (Env:
# FREEZER_SCHEDULER_CONF_D) (string value)
#jobs_dir = /etc/freezer/scheduler/conf.d
# Specifies the api-polling interval in seconds. Defaults to 60 seconds
# (integer value)
#interval = 60
# Prevents the scheduler from running in daemon mode (boolean value)
#no_daemon = false
# Initialize freezer scheduler with insecure mode (boolean value)
#insecure = false

View File

@ -100,7 +100,7 @@ def getCommonOpts():
def parse_args(choices): def parse_args(choices):
default_conf = cfg.find_config_files('freezer', 'freezer-scheduler', default_conf = cfg.find_config_files('freezer', 'scheduler',
'.conf') '.conf')
CONF.register_cli_opts(api_client.build_os_options()) CONF.register_cli_opts(api_client.build_os_options())
CONF.register_cli_opts(getCommonOpts()) CONF.register_cli_opts(getCommonOpts())
@ -135,3 +135,10 @@ def setup_logging():
'%(message)s') '%(message)s')
log.set_defaults(_DEFAULT_LOGGING_CONTEXT_FORMAT, _DEFAULT_LOG_LEVELS) log.set_defaults(_DEFAULT_LOGGING_CONTEXT_FORMAT, _DEFAULT_LOG_LEVELS)
log.setup(CONF, 'freezer-scheduler', version=FREEZER_VERSION) log.setup(CONF, 'freezer-scheduler', version=FREEZER_VERSION)
def list_opts():
_opt = {
None: getCommonOpts()
}
return _opt.items()

View File

@ -55,6 +55,7 @@ data_files =
[entry_points] [entry_points]
oslo.config.opts = oslo.config.opts =
freezer = freezer.common.config:list_opts freezer = freezer.common.config:list_opts
scheduler = freezer.scheduler.arguments:list_opts
console_scripts = console_scripts =
freezer-scheduler = freezer.scheduler.freezer_scheduler:main freezer-scheduler = freezer.scheduler.freezer_scheduler:main
freezerc = freezer.main:main freezerc = freezer.main:main