From 967a8c09e6f794559fcd9dcc10bca26cc9f19974 Mon Sep 17 00:00:00 2001 From: Renat Akhmerov Date: Fri, 1 Jul 2016 17:11:50 +0700 Subject: [PATCH] Remove obsolete config option "use_mistral_rpc" * "use_mistral_rpc" is not used anymore * Style changes Change-Id: I1f0f5a9306cd2ec7f5d4f2e0304cb4465a10afed --- mistral/cmd/launch.py | 15 +--- mistral/config.py | 173 +++++++++++++++++++++++++----------------- 2 files changed, 106 insertions(+), 82 deletions(-) diff --git a/mistral/cmd/launch.py b/mistral/cmd/launch.py index a041b2a3f..cd1efa5ac 100644 --- a/mistral/cmd/launch.py +++ b/mistral/cmd/launch.py @@ -78,9 +78,7 @@ def launch_executor(transport): endpoints = [rpc.ExecutorServer(executor_v2)] - get_rpc_server = get_rpc_server_function() - - server = get_rpc_server( + server = messaging.get_rpc_server( transport, target, endpoints, @@ -121,9 +119,7 @@ def launch_engine(transport): # Setup expiration policy expiration_policy.setup() - get_rpc_server = get_rpc_server_function() - - server = get_rpc_server( + server = messaging.get_rpc_server( transport, target, endpoints, @@ -149,13 +145,6 @@ class ThreadingWSGIServer(socketserver.ThreadingMixIn, WSGIServer): pass -def get_rpc_server_function(): - if CONF.use_mistral_rpc: - return rpc.get_rpc_server - else: - return messaging.get_rpc_server - - def launch_api(transport): host = cfg.CONF.api.host port = cfg.CONF.api.port diff --git a/mistral/config.py b/mistral/config.py index 1e4909c3b..d9125054e 100644 --- a/mistral/config.py +++ b/mistral/config.py @@ -38,23 +38,36 @@ launch_opt = cfg.ListOpt( api_opts = [ cfg.StrOpt('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( + 'allow_action_execution_deletion', + default=False, + help='Enables the ability to delete action_execution which ' + 'has no relationship with workflows.' + ) ] 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.') + 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.' + ) ] use_debugger = cfg.BoolOpt( @@ -67,53 +80,64 @@ use_debugger = cfg.BoolOpt( ) engine_opts = [ - cfg.StrOpt('engine', default='default', - help='Mistral engine plugin'), - cfg.StrOpt('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.StrOpt('engine', default='default', help='Mistral engine plugin'), + cfg.StrOpt( + '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.' + ) ] executor_opts = [ - cfg.StrOpt('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.') + cfg.StrOpt( + '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.' + ) ] -rpc_option = cfg.BoolOpt( - 'use_mistral_rpc', - default=False, - help='Specifies whether Mistral uses modified oslo.messaging (if True)' - ' or original oslo.messaging. Modified oslo.messaging is done for' - ' acknowledgement a message after processing.' -) - 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).'), - - 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. ' - 'Note that only final state execution will remove ' - '( SUCCESS / ERROR ).') + 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).' + ), + 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. ' + 'Note that only final state execution will remove ' + '( SUCCESS / ERROR ).' + ) ] wf_trace_log_name_opt = cfg.StrOpt( @@ -124,11 +148,15 @@ wf_trace_log_name_opt = cfg.StrOpt( ) 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.') + 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] @@ -140,6 +168,7 @@ profiler_opts.append( ) ) + CONF = cfg.CONF API_GROUP = 'api' @@ -157,10 +186,10 @@ CONF.register_opts(executor_opts, group=EXECUTOR_GROUP) CONF.register_opts(execution_expiration_policy_opts, group=EXECUTION_EXPIRATION_POLICY_GROUP) CONF.register_opt(wf_trace_log_name_opt) -CONF.register_opt(rpc_option) CONF.register_opts(coordination_opts, group=COORDINATION_GROUP) CONF.register_opts(profiler_opts, group=PROFILER_GROUP) + CLI_OPTS = [ use_debugger, launch_opt @@ -195,7 +224,6 @@ def list_opts(): CLI_OPTS, [ wf_trace_log_name_opt, - rpc_option ] )) ] @@ -203,7 +231,9 @@ def list_opts(): def parse_args(args=None, usage=None, default_config_files=None): log.set_defaults(default_log_levels=_DEFAULT_LOG_LEVELS) + log.register_options(CONF) + CONF( args=args, project='mistral', @@ -224,11 +254,16 @@ def set_cors_middleware_defaults(): # TODO(krotscheck): Update with https://review.openstack.org/#/c/285368/ cfg.set_defaults( cors.CORS_OPTS, - 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'] + 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' + ] )