Merge "Replace notification.conf with monasca-notification.conf"

This commit is contained in:
Zuul 2019-02-13 15:59:23 +00:00 committed by Gerrit Code Review
commit 5f21b325ba
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