From 633b360652937c0ade82000e36f34de02bc6c476 Mon Sep 17 00:00:00 2001 From: Jean-Emile DARTOIS Date: Wed, 16 Dec 2015 16:51:59 +0100 Subject: [PATCH] Fix generation of watcher config file Although the refactoring of the applier got merged we have an issue to generate the config. This pathset fix that Change-Id: Iafce7d0136b2ad813102c3e3caeebafa215363c8 Closes-Bug: 1526851 --- etc/watcher/watcher.conf.sample | 131 ++++++++++---------------------- watcher/opts.py | 8 +- watcher/tests/test_list_opts.py | 31 ++++++++ watcher/tests/test_units.py | 19 ----- watcher/tests/test_watcher.py | 28 ------- 5 files changed, 76 insertions(+), 141 deletions(-) create mode 100644 watcher/tests/test_list_opts.py delete mode 100644 watcher/tests/test_units.py delete mode 100644 watcher/tests/test_watcher.py diff --git a/etc/watcher/watcher.conf.sample b/etc/watcher/watcher.conf.sample index 9f89ad5c8..4a1f92b5b 100644 --- a/etc/watcher/watcher.conf.sample +++ b/etc/watcher/watcher.conf.sample @@ -157,13 +157,17 @@ # timeout exception when timeout expired. (integer value) #rpc_poll_timeout = 1 -# Shows whether zmq-messaging uses broker or not. (boolean value) -#zmq_use_broker = true +# Configures zmq-messaging to use broker or not. (boolean value) +#zmq_use_broker = false -# Minimal port number for random ports range. (integer value) +# Minimal port number for random ports range. (port value) +# Minimum value: 1 +# Maximum value: 65535 #rpc_zmq_min_port = 49152 # Maximal port number for random ports range. (integer value) +# Minimum value: 1 +# Maximum value: 65536 #rpc_zmq_max_port = 65536 # Number of retries to find free port number before fail with @@ -173,7 +177,9 @@ # Host to locate redis. (string value) #host = 127.0.0.1 -# Use this port to connect to redis host. (integer value) +# Use this port to connect to redis host. (port value) +# Minimum value: 1 +# Maximum value: 65535 #port = 6379 # Password for Redis server (optional). (string value) @@ -185,16 +191,19 @@ # The Drivers(s) to handle sending notifications. Possible values are # messaging, messagingv2, routing, log, test, noop (multi valued) -#notification_driver = +# Deprecated group/name - [DEFAULT]/notification_driver +#driver = # A URL representing the messaging driver to use for notifications. If # not set, we fall back to the same configuration used for RPC. # (string value) -#notification_transport_url = +# Deprecated group/name - [DEFAULT]/notification_transport_url +#transport_url = # AMQP topic used for OpenStack notifications. (list value) # Deprecated group/name - [rpc_notifier2]/topics -#notification_topics = notifications +# Deprecated group/name - [DEFAULT]/notification_topics +#topics = notifications # Seconds to wait for a response from a call. (integer value) #rpc_response_timeout = 60 @@ -205,7 +214,7 @@ #transport_url = # The messaging driver to use, defaults to rabbit. Other drivers -# include qpid and zmq. (string value) +# include amqp and zmq. (string value) #rpc_backend = rabbit # The default exchange under which topics are scoped. May be @@ -508,6 +517,14 @@ # Service tenant name. (string value) #admin_tenant_name = admin +# Authentication type to load (unknown value) +# Deprecated group/name - [DEFAULT]/auth_plugin +#auth_type = + +# Config Section from which to load plugin specific options (unknown +# value) +#auth_section = + [matchmaker_redis] @@ -518,7 +535,9 @@ # Host to locate redis. (string value) #host = 127.0.0.1 -# Use this port to connect to redis host. (integer value) +# Use this port to connect to redis host. (port value) +# Minimum value: 1 +# Maximum value: 65535 #port = 6379 # Password for Redis server (optional). (string value) @@ -599,82 +618,6 @@ #password = -[oslo_messaging_qpid] - -# -# From oslo.messaging -# - -# Use durable queues in AMQP. (boolean value) -# Deprecated group/name - [DEFAULT]/amqp_durable_queues -# Deprecated group/name - [DEFAULT]/rabbit_durable_queues -#amqp_durable_queues = false - -# Auto-delete queues in AMQP. (boolean value) -# Deprecated group/name - [DEFAULT]/amqp_auto_delete -#amqp_auto_delete = false - -# Send a single AMQP reply to call message. The current behaviour -# since oslo-incubator is to send two AMQP replies - first one with -# the payload, a second one to ensure the other have finish to send -# the payload. We are going to remove it in the N release, but we must -# keep backward compatible at the same time. This option provides such -# compatibility - it defaults to False in Liberty and can be turned on -# for early adopters with a new installations or for testing. Please -# note, that this option will be removed in the Mitaka release. -# (boolean value) -#send_single_reply = false - -# Qpid broker hostname. (string value) -# Deprecated group/name - [DEFAULT]/qpid_hostname -#qpid_hostname = localhost - -# Qpid broker port. (integer value) -# Deprecated group/name - [DEFAULT]/qpid_port -#qpid_port = 5672 - -# Qpid HA cluster host:port pairs. (list value) -# Deprecated group/name - [DEFAULT]/qpid_hosts -#qpid_hosts = $qpid_hostname:$qpid_port - -# Username for Qpid connection. (string value) -# Deprecated group/name - [DEFAULT]/qpid_username -#qpid_username = - -# Password for Qpid connection. (string value) -# Deprecated group/name - [DEFAULT]/qpid_password -#qpid_password = - -# Space separated list of SASL mechanisms to use for auth. (string -# value) -# Deprecated group/name - [DEFAULT]/qpid_sasl_mechanisms -#qpid_sasl_mechanisms = - -# Seconds between connection keepalive heartbeats. (integer value) -# Deprecated group/name - [DEFAULT]/qpid_heartbeat -#qpid_heartbeat = 60 - -# Transport to use, either 'tcp' or 'ssl'. (string value) -# Deprecated group/name - [DEFAULT]/qpid_protocol -#qpid_protocol = tcp - -# Whether to disable the Nagle algorithm. (boolean value) -# Deprecated group/name - [DEFAULT]/qpid_tcp_nodelay -#qpid_tcp_nodelay = true - -# The number of prefetched messages held by receiver. (integer value) -# Deprecated group/name - [DEFAULT]/qpid_receiver_capacity -#qpid_receiver_capacity = 1 - -# The qpid topology version to use. Version 1 is what was originally -# used by impl_qpid. Version 2 includes some backwards-incompatible -# changes that allow broker federation to work. Users should update -# to version 2 when they are able to take everything down, as it -# requires a clean break. (integer value) -# Deprecated group/name - [DEFAULT]/qpid_topology_version -#qpid_topology_version = 1 - - [oslo_messaging_rabbit] # @@ -725,18 +668,26 @@ # Deprecated group/name - [DEFAULT]/kombu_reconnect_delay #kombu_reconnect_delay = 1.0 -# How long to wait before considering a reconnect attempt to have -# failed. This value should not be longer than rpc_response_timeout. +# How long to wait a missing client beforce abandoning to send it its +# replies. This value should not be longer than rpc_response_timeout. # (integer value) -#kombu_reconnect_timeout = 60 +# Deprecated group/name - [DEFAULT]/kombu_reconnect_timeout +#kombu_missing_consumer_retry_timeout = 5 + +# Determines how the next RabbitMQ node is chosen in case the one we +# are currently connected to becomes unavailable. Takes effect only if +# more than one RabbitMQ node is provided in config. (string value) +# Allowed values: round-robin, shuffle +#kombu_failover_strategy = round-robin # The RabbitMQ broker address where a single node is used. (string # value) # Deprecated group/name - [DEFAULT]/rabbit_host #rabbit_host = localhost -# The RabbitMQ broker port where a single node is used. (integer -# value) +# The RabbitMQ broker port where a single node is used. (port value) +# Minimum value: 1 +# Maximum value: 65535 # Deprecated group/name - [DEFAULT]/rabbit_port #rabbit_port = 5672 diff --git a/watcher/opts.py b/watcher/opts.py index 6b2c4b084..a000fc204 100644 --- a/watcher/opts.py +++ b/watcher/opts.py @@ -16,8 +16,8 @@ # limitations under the License. import watcher.api.app -from watcher.applier import manager_applier -from watcher.decision_engine import manager +from watcher.applier import manager as applier_manager +from watcher.decision_engine import manager as decision_engine_manger from watcher.decision_engine.strategy.selection import default \ as strategy_selector @@ -27,7 +27,7 @@ def list_opts(): ('api', watcher.api.app.API_SERVICE_OPTS), ('watcher_goals', strategy_selector.WATCHER_GOALS_OPTS), ('watcher_decision_engine', - manager.WATCHER_DECISION_ENGINE_OPTS), + decision_engine_manger.WATCHER_DECISION_ENGINE_OPTS), ('watcher_applier', - manager_applier.APPLIER_MANAGER_OPTS) + applier_manager.APPLIER_MANAGER_OPTS) ] diff --git a/watcher/tests/test_list_opts.py b/watcher/tests/test_list_opts.py new file mode 100644 index 000000000..d1b22f815 --- /dev/null +++ b/watcher/tests/test_list_opts.py @@ -0,0 +1,31 @@ +# -*- encoding: utf-8 -*- +# Copyright (c) 2015 b<>com +# +# 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. + +from __future__ import absolute_import +from __future__ import unicode_literals + +import watcher.opts as opt + +from watcher.tests.base import BaseTestCase + + +class TestListOpts(BaseTestCase): + def setUp(self): + super(TestListOpts, self).setUp() + + def test_run_list_opts(self): + result = opt.list_opts() + self.assertIsNotNone(result) diff --git a/watcher/tests/test_units.py b/watcher/tests/test_units.py deleted file mode 100644 index 75a76d6a4..000000000 --- a/watcher/tests/test_units.py +++ /dev/null @@ -1,19 +0,0 @@ -# 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. - -import unittest - - -class TestUnits(unittest.TestCase): - - def test_units(self): - assert 5 * 5 == 25 diff --git a/watcher/tests/test_watcher.py b/watcher/tests/test_watcher.py deleted file mode 100644 index 88b544eab..000000000 --- a/watcher/tests/test_watcher.py +++ /dev/null @@ -1,28 +0,0 @@ -# -*- coding: utf-8 -*- - -# 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. - -""" -test_watcher ----------------------------------- - -Tests for `watcher` module. -""" - -from watcher.tests import base - - -class TestWatcher(base.TestCase): - - def test_something(self): - pass