summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bechtold <tbechtold@suse.com>2019-01-25 09:52:46 +0100
committerWitold Bedyk <witold.bedyk@suse.com>2019-02-01 10:13:25 +0000
commit47b807eeb85ab3648075a8d84444fc4edb2b95c3 (patch)
treee3c67ef87a7463db2ede9581e4d9f3db6ba27d56
parent0f316afc8742a890d03344e2c8b62f277c3b888e (diff)
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
Notes
Notes (review): Code-Review+2: Joseph Davis <joseph.davis@suse.com> Code-Review+1: Stefano Canepa (sc) <sc@linux.it> Code-Review+2: Witold Bedyk <witold.bedyk@suse.com> Workflow+1: Witold Bedyk <witold.bedyk@suse.com> Workflow+1: Joseph Davis <joseph.davis@suse.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Wed, 13 Feb 2019 15:59:23 +0000 Reviewed-on: https://review.openstack.org/633163 Project: openstack/monasca-notification Branch: refs/heads/master
-rw-r--r--monasca_notification/config.py24
-rw-r--r--releasenotes/notes/use-standard-config-file-path-f3da49d0d655377c.yaml7
2 files changed, 30 insertions, 1 deletions
diff --git a/monasca_notification/config.py b/monasca_notification/config.py
index 2654544..2d7d5df 100644
--- a/monasca_notification/config.py
+++ b/monasca_notification/config.py
@@ -12,7 +12,9 @@
12# License for the specific language governing permissions and limitations 12# License for the specific language governing permissions and limitations
13# under the License. 13# under the License.
14 14
15from oslo_config import cfg
15from oslo_log import log 16from oslo_log import log
17import sys
16import yaml 18import yaml
17 19
18from monasca_notification import conf 20from monasca_notification import conf
@@ -39,8 +41,9 @@ def parse_args(argv, no_yaml=False):
39 41
40 CONF(args=argv, 42 CONF(args=argv,
41 project='monasca', 43 project='monasca',
42 prog='notification', 44 prog=sys.argv[1:],
43 version=version.version_string, 45 version=version.version_string,
46 default_config_files=_get_config_files(),
44 description=''' 47 description='''
45 monasca-notification is an engine responsible for 48 monasca-notification is an engine responsible for
46 transforming alarm transitions into proper notifications 49 transforming alarm transitions into proper notifications
@@ -60,6 +63,25 @@ def parse_args(argv, no_yaml=False):
60 _CONF_LOADED = True 63 _CONF_LOADED = True
61 64
62 65
66def _get_config_files():
67 """Get the possible configuration files accepted by oslo.config
68
69 This also includes the deprecated ones
70 """
71 # default files
72 conf_files = cfg.find_config_files(project='monasca',
73 prog='monasca-notification')
74 # deprecated config files (only used if standard config files are not there)
75 if len(conf_files) == 0:
76 old_conf_files = cfg.find_config_files(project='monasca',
77 prog='notification')
78 if len(old_conf_files) > 0:
79 LOG.warning('Found deprecated old location "{}" '
80 'of main configuration file'.format(old_conf_files))
81 conf_files += old_conf_files
82 return conf_files
83
84
63def set_from_yaml(): 85def set_from_yaml():
64 if CONF.yaml_config: 86 if CONF.yaml_config:
65 LOG.info('Detected usage of deprecated YAML configuration') 87 LOG.info('Detected usage of deprecated YAML configuration')
diff --git a/releasenotes/notes/use-standard-config-file-path-f3da49d0d655377c.yaml b/releasenotes/notes/use-standard-config-file-path-f3da49d0d655377c.yaml
new file mode 100644
index 0000000..ed92de8
--- /dev/null
+++ b/releasenotes/notes/use-standard-config-file-path-f3da49d0d655377c.yaml
@@ -0,0 +1,7 @@
1---
2deprecations:
3 - |
4 Configuration file path /etc/monasca/notification.conf is deprecated.
5 Use the standard path /etc/monasca/monasca-notification.conf or the
6 configuration dir (supported via oslo.config)
7 /etc/monasca/monasca-notification.conf.d/any_config_name.conf