Replace notification.conf with monasca-notification.conf

notification.conf is the deprecated path for the configuration file.
The new path is /etc/monasca/monasca-notification.conf .

Note: devstack is still using the deprecated configuration file. This
will be change in another changeset (against openstack/monasca-api).

Change-Id: I9ef1d7149308893544ad4d6fef4f3281da676171
Story: 2004862
Task: 29103
This commit is contained in:
Thomas Bechtold 2019-01-25 09:52:46 +01:00 committed by Witold Bedyk
parent 0f316afc87
commit 47b807eeb8
2 changed files with 30 additions and 1 deletions

View File

@ -12,7 +12,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from oslo_config import cfg
from oslo_log import log
import sys
import yaml
from monasca_notification import conf
@ -39,8 +41,9 @@ def parse_args(argv, no_yaml=False):
CONF(args=argv,
project='monasca',
prog='notification',
prog=sys.argv[1:],
version=version.version_string,
default_config_files=_get_config_files(),
description='''
monasca-notification is an engine responsible for
transforming alarm transitions into proper notifications
@ -60,6 +63,25 @@ def parse_args(argv, no_yaml=False):
_CONF_LOADED = True
def _get_config_files():
"""Get the possible configuration files accepted by oslo.config
This also includes the deprecated ones
"""
# default files
conf_files = cfg.find_config_files(project='monasca',
prog='monasca-notification')
# deprecated config files (only used if standard config files are not there)
if len(conf_files) == 0:
old_conf_files = cfg.find_config_files(project='monasca',
prog='notification')
if len(old_conf_files) > 0:
LOG.warning('Found deprecated old location "{}" '
'of main configuration file'.format(old_conf_files))
conf_files += old_conf_files
return conf_files
def set_from_yaml():
if CONF.yaml_config:
LOG.info('Detected usage of deprecated YAML configuration')

View File

@ -0,0 +1,7 @@
---
deprecations:
- |
Configuration file path /etc/monasca/notification.conf is deprecated.
Use the standard path /etc/monasca/monasca-notification.conf or the
configuration dir (supported via oslo.config)
/etc/monasca/monasca-notification.conf.d/any_config_name.conf