summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2019-02-13 15:59:23 +0000
committerGerrit Code Review <review@openstack.org>2019-02-13 15:59:23 +0000
commit5f21b325ba3b740a74f4b27f2251a465c110c57b (patch)
treef0a37829d8e63dff5d904f56d532e08af0abfb5f
parent8fb62bf11f4de221a121d7ba6a702e3e9b15f4ac (diff)
parent47b807eeb85ab3648075a8d84444fc4edb2b95c3 (diff)
Merge "Replace notification.conf with monasca-notification.conf"
-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