/usr/lib/python2.7/dist-packages/mistral/config.py is in python-mistral 6.0.0-0ubuntu1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 | # Copyright 2013 - Mirantis, Inc.
# Copyright 2016 - Brocade Communications Systems, 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.
"""
Configuration options registration and useful routines.
"""
import itertools
import os
from oslo_config import cfg
from oslo_log import log
from oslo_middleware import cors
from osprofiler import opts as profiler
from mistral import version
from mistral._i18n import _
# Options under default group.
launch_opt = cfg.ListOpt(
'server',
default=['all'],
help=_('Specifies which mistral server to start by the launch script. '
'Valid options are all or any combination of '
'api, engine, and executor.')
)
wf_trace_log_name_opt = cfg.StrOpt(
'workflow_trace_log_name',
default='workflow_trace',
help=_('Logger name for pretty workflow trace output.')
)
use_debugger_opt = cfg.BoolOpt(
'use-debugger',
default=False,
help=_('Enables debugger. Note that using this option changes how the '
'eventlet library is used to support async IO. This could result '
'in failures that do not occur under normal operation. '
'Use at your own risk.')
)
auth_type_opt = cfg.StrOpt(
'auth_type',
default='keystone',
help=_('Authentication type (valid options: keystone, keycloak-oidc)')
)
api_opts = [
cfg.HostAddressOpt(
'host',
default='0.0.0.0',
help='Mistral API server host'
),
cfg.PortOpt('port', default=8989, help='Mistral API server port'),
cfg.BoolOpt(
'allow_action_execution_deletion',
default=False,
help=_('Enables the ability to delete action_execution which '
'has no relationship with workflows.')
),
cfg.BoolOpt(
'enable_ssl_api',
default=False,
help=_('Enable the integrated stand-alone API to service requests'
'via HTTPS instead of HTTP.')
),
cfg.IntOpt(
'api_workers',
help=_('Number of workers for Mistral API service '
'default is equal to the number of CPUs available if that can '
'be determined, else a default worker count of 1 is returned.')
)
]
js_impl_opt = cfg.StrOpt(
'js_implementation',
default='pyv8',
choices=['pyv8', 'v8eval'],
help=_('The JavaScript implementation to be used by the std.javascript '
'action to evaluate scripts.')
)
rpc_impl_opt = cfg.StrOpt(
'rpc_implementation',
default='oslo',
choices=['oslo', 'kombu'],
help=_('Specifies RPC implementation for RPC client and server. '
'Support of kombu driver is experimental.')
)
# TODO(ddeja): This config option is a part of oslo RPCClient
# It would be the best to not register it twice, rather use RPCClient somehow
rpc_response_timeout_opt = cfg.IntOpt(
'rpc_response_timeout',
default=60,
help=_('Seconds to wait for a response from a call.')
)
expiration_token_duration = cfg.IntOpt(
'expiration_token_duration',
default=30,
help=_('Window of seconds to determine whether the given token is about'
' to expire.')
)
pecan_opts = [
cfg.StrOpt(
'root',
default='mistral.api.controllers.root.RootController',
help=_('Pecan root controller')
),
cfg.ListOpt(
'modules',
default=["mistral.api"],
help=_('A list of modules where pecan will search for applications.')
),
cfg.BoolOpt(
'debug',
default=False,
help=_('Enables the ability to display tracebacks in the browser and'
' interactively debug during development.')
),
cfg.BoolOpt(
'auth_enable',
default=True,
help=_('Enables user authentication in pecan.')
)
]
engine_opts = [
cfg.StrOpt('engine', default='default', help='Mistral engine plugin'),
cfg.HostAddressOpt(
'host',
default='0.0.0.0',
help=_('Name of the engine node. This can be an opaque '
'identifier. It is not necessarily a hostname, '
'FQDN, or IP address.')
),
cfg.StrOpt(
'topic',
default='mistral_engine',
help=_('The message topic that the engine listens on.')
),
cfg.StrOpt('version', default='1.0', help='The version of the engine.'),
cfg.IntOpt(
'execution_field_size_limit_kb',
default=1024,
help=_('The default maximum size in KB of large text fields '
'of runtime execution objects. Use -1 for no limit.')
),
cfg.IntOpt(
'execution_integrity_check_delay',
default=20,
help=_('A number of seconds since the last update of a task'
' execution in RUNNING state after which Mistral will'
' start checking its integrity, meaning that if all'
' associated actions/workflows are finished its state'
' will be restored automatically. If this property is'
' set to a negative value Mistral will never be doing '
' this check.')
)
]
executor_opts = [
cfg.StrOpt(
'type',
choices=['local', 'remote'],
default='remote',
help=(
'Type of executor. Use local to run the executor within the '
'engine server. Use remote if the executor is launched as '
'a separate server to run action executions.'
)
),
cfg.HostAddressOpt(
'host',
default='0.0.0.0',
help=_('Name of the executor node. This can be an opaque '
'identifier. It is not necessarily a hostname, '
'FQDN, or IP address.')
),
cfg.StrOpt(
'topic',
default='mistral_executor',
help=_('The message topic that the executor listens on.')
),
cfg.StrOpt(
'version',
default='1.0',
help=_('The version of the executor.')
)
]
scheduler_opts = [
cfg.FloatOpt(
'fixed_delay',
default=1,
min=0.1,
help=(
'Fixed part of the delay between scheduler iterations, '
'in seconds. '
'Full delay is defined as a sum of "fixed_delay" and a random '
'delay limited by "random_delay".'
)
),
cfg.FloatOpt(
'random_delay',
default=0,
min=0,
help=(
'Max value of the random part of the delay between scheduler '
'iterations, in seconds. '
'Full delay is defined as a sum of "fixed_delay" and a random '
'delay limited by this property.'
)
),
cfg.IntOpt(
'batch_size',
default=None,
min=1,
help=(
'The max number of delayed calls will be selected during '
'a scheduler iteration. '
'If this property equals None then there is no '
'restriction on selection.'
)
)
]
cron_trigger_opts = [
cfg.BoolOpt(
'enabled',
default=True,
help=(
'If this value is set to False then the subsystem of cron triggers'
' is disabled. Disabling cron triggers increases system'
' performance.'
)
),
cfg.IntOpt(
'execution_interval',
default=1,
min=1,
help=(
'This setting defines how frequently Mistral checks for cron ',
'triggers that need execution. By default this is every second ',
'which can lead to high system load. Increasing the number will ',
'reduce the load but also limit the minimum freqency. For ',
'example, a cron trigger can be configured to run every second ',
'but if the execution_interval is set to 60, it will only run ',
'once per minute.'
)
)
]
event_engine_opts = [
cfg.HostAddressOpt(
'host',
default='0.0.0.0',
help=_('Name of the event engine node. This can be an opaque '
'identifier. It is not necessarily a hostname, '
'FQDN, or IP address.')
),
cfg.HostAddressOpt(
'listener_pool_name',
default='events',
help=_('Name of the event engine\'s listener pool. This can be an'
' opaque identifier. It is used for identifying the group'
' of event engine listeners in oslo.messaging.')
),
cfg.StrOpt(
'topic',
default='mistral_event_engine',
help=_('The message topic that the event engine listens on.')
),
cfg.StrOpt(
'event_definitions_cfg_file',
default='/etc/mistral/event_definitions.yaml',
help=_('Configuration file for event definitions.')
),
]
execution_expiration_policy_opts = [
cfg.IntOpt(
'evaluation_interval',
help=_('How often will the executions be evaluated '
'(in minutes). For example for value 120 the interval '
'will be 2 hours (every 2 hours).'
'Note that only final state executions will be removed: '
'( SUCCESS / ERROR / CANCELLED ).')
),
cfg.IntOpt(
'older_than',
help=_('Evaluate from which time remove executions in minutes. '
'For example when older_than = 60, remove all executions '
'that finished a 60 minutes ago or more. '
'Minimum value is 1.')
),
cfg.IntOpt(
'max_finished_executions',
default=0,
help=_('The maximum number of finished workflow executions'
'to be stored. For example when max_finished_executions = 100,'
'only the 100 latest finished executions will be preserved.'
'This means that even unexpired executions are eligible'
'for deletion, to decrease the number of executions in the'
'database. The default value is 0. If it is set to 0,'
'this constraint won\'t be applied.')
),
cfg.IntOpt(
'batch_size',
default=0,
help=_('Size of batch of expired executions to be deleted.'
'The default value is 0. If it is set to 0, '
'size of batch is total number of expired executions'
'that is going to be deleted.')
)
]
coordination_opts = [
cfg.StrOpt(
'backend_url',
help=_('The backend URL to be used for coordination')
),
cfg.FloatOpt(
'heartbeat_interval',
default=5.0,
help=_('Number of seconds between heartbeats for coordination.')
)
]
profiler_opts = profiler.list_opts()[0][1]
profiler_opts.append(
cfg.StrOpt(
'profiler_log_name',
default='profiler_trace',
help=_('Logger name for the osprofiler trace output.')
)
)
keycloak_oidc_opts = [
cfg.StrOpt(
'auth_url',
help=_('Keycloak base url (e.g. https://my.keycloak:8443/auth)')
),
cfg.StrOpt(
'certfile',
help=_('Required if identity server requires client certificate')
),
cfg.StrOpt(
'keyfile',
help=_('Required if identity server requires client certificate')
),
cfg.StrOpt(
'cafile',
help=_('A PEM encoded Certificate Authority to use when verifying '
'HTTPs connections. Defaults to system CAs.')
),
cfg.BoolOpt(
'insecure',
default=False,
help=_('If True, SSL/TLS certificate verification is disabled')
)
]
openstack_actions_opts = [
cfg.StrOpt(
'os-actions-endpoint-type',
default=os.environ.get('OS_ACTIONS_ENDPOINT_TYPE', 'public'),
choices=['public', 'admin', 'internal'],
deprecated_group='DEFAULT',
help=_('Type of endpoint in identity service catalog to use for'
' communication with OpenStack services.')
),
cfg.ListOpt(
'modules-support-region',
default=['nova', 'glance', 'heat', 'neutron', 'cinder',
'trove', 'ironic', 'designate', 'murano', 'tacker', 'senlin',
'aodh', 'gnocchi'],
help=_('List of module names that support region in actions.')
),
cfg.StrOpt(
'default_region',
help=_('Default region name for openstack actions supporting region.')
),
]
# note: this command line option is used only from sync_db and
# mistral-db-manage
os_actions_mapping_path = cfg.StrOpt(
'openstack_actions_mapping_path',
short='m',
metavar='MAPPING_PATH',
default='actions/openstack/mapping.json',
help='Path to openstack action mapping json file.'
'It could be relative to mistral package '
'directory or absolute.'
)
CONF = cfg.CONF
API_GROUP = 'api'
ENGINE_GROUP = 'engine'
EXECUTOR_GROUP = 'executor'
SCHEDULER_GROUP = 'scheduler'
CRON_TRIGGER_GROUP = 'cron_trigger'
EVENT_ENGINE_GROUP = 'event_engine'
PECAN_GROUP = 'pecan'
COORDINATION_GROUP = 'coordination'
EXECUTION_EXPIRATION_POLICY_GROUP = 'execution_expiration_policy'
PROFILER_GROUP = profiler.list_opts()[0][0]
KEYCLOAK_OIDC_GROUP = "keycloak_oidc"
OPENSTACK_ACTIONS_GROUP = 'openstack_actions'
CONF.register_opt(wf_trace_log_name_opt)
CONF.register_opt(auth_type_opt)
CONF.register_opt(js_impl_opt)
CONF.register_opt(rpc_impl_opt)
CONF.register_opt(rpc_response_timeout_opt)
CONF.register_opt(expiration_token_duration)
CONF.register_opts(api_opts, group=API_GROUP)
CONF.register_opts(engine_opts, group=ENGINE_GROUP)
CONF.register_opts(executor_opts, group=EXECUTOR_GROUP)
CONF.register_opts(scheduler_opts, group=SCHEDULER_GROUP)
CONF.register_opts(cron_trigger_opts, group=CRON_TRIGGER_GROUP)
CONF.register_opts(
execution_expiration_policy_opts,
group=EXECUTION_EXPIRATION_POLICY_GROUP
)
CONF.register_opts(event_engine_opts, group=EVENT_ENGINE_GROUP)
CONF.register_opts(pecan_opts, group=PECAN_GROUP)
CONF.register_opts(coordination_opts, group=COORDINATION_GROUP)
CONF.register_opts(profiler_opts, group=PROFILER_GROUP)
CONF.register_opts(keycloak_oidc_opts, group=KEYCLOAK_OIDC_GROUP)
CONF.register_opts(openstack_actions_opts, group=OPENSTACK_ACTIONS_GROUP)
CLI_OPTS = [
use_debugger_opt,
launch_opt
]
default_group_opts = itertools.chain(
CLI_OPTS,
[
wf_trace_log_name_opt,
auth_type_opt,
js_impl_opt,
rpc_impl_opt,
rpc_response_timeout_opt,
expiration_token_duration
]
)
CONF.register_cli_opts(CLI_OPTS)
_DEFAULT_LOG_LEVELS = [
'eventlet.wsgi.server=WARN',
'oslo_service.periodic_task=INFO',
'oslo_service.loopingcall=INFO',
'mistral.services.periodic=INFO',
'kazoo.client=WARN',
'oslo_db=WARN'
]
def list_opts():
return [
(API_GROUP, api_opts),
(ENGINE_GROUP, engine_opts),
(EXECUTOR_GROUP, executor_opts),
(EVENT_ENGINE_GROUP, event_engine_opts),
(SCHEDULER_GROUP, scheduler_opts),
(CRON_TRIGGER_GROUP, cron_trigger_opts),
(PECAN_GROUP, pecan_opts),
(COORDINATION_GROUP, coordination_opts),
(EXECUTION_EXPIRATION_POLICY_GROUP, execution_expiration_policy_opts),
(PROFILER_GROUP, profiler_opts),
(KEYCLOAK_OIDC_GROUP, keycloak_oidc_opts),
(OPENSTACK_ACTIONS_GROUP, openstack_actions_opts),
(None, default_group_opts)
]
def parse_args(args=None, usage=None, default_config_files=None):
default_log_levels = log.get_default_log_levels()
default_log_levels.extend(_DEFAULT_LOG_LEVELS)
log.set_defaults(default_log_levels=default_log_levels)
log.register_options(CONF)
CONF(
args=args,
project='mistral',
version=version.version_string,
usage=usage,
default_config_files=default_config_files
)
def set_config_defaults():
"""This method updates all configuration default values."""
set_cors_middleware_defaults()
def set_cors_middleware_defaults():
"""Update default configuration options for oslo.middleware."""
cors.set_defaults(
allow_headers=['X-Auth-Token',
'X-Identity-Status',
'X-Roles',
'X-Service-Catalog',
'X-User-Id',
'X-Tenant-Id',
'X-Project-Id',
'X-User-Name',
'X-Project-Name'],
allow_methods=['GET',
'PUT',
'POST',
'DELETE',
'PATCH'],
expose_headers=['X-Auth-Token',
'X-Subject-Token',
'X-Service-Token',
'X-Project-Id',
'X-User-Name',
'X-Project-Name']
)
|