diff --git a/etc/storyboard.conf.sample b/etc/storyboard.conf.sample index ba751738..d9cd3a12 100644 --- a/etc/storyboard.conf.sample +++ b/etc/storyboard.conf.sample @@ -150,4 +150,41 @@ lock_path = $state_path/lock [plugin_token_cleaner] # Enable/Disable the token cleaning cron plugin. This requires cron # management to be enabled. -# enable = True \ No newline at end of file +# enable = True + +[plugin_email] +# Enable, or disable, the notification email plugin. +# enable = True + +# The email address from which storyboard will send its messages. +# sender = StoryBoard (Do Not Reply) + +# The email address of the Reply-To header (optional). +# reply_to = + +# The SMTP server to use. +# smtp_host = localhost + +# The SMTP Server Port to connect to (default 25). +# smtp_port = 25 + +# The SMTP socket timeout, in seconds +# smtp_timeout = 10 + +# The FQDN of the sending host when identifying itself to the SMTP server +# (optional). +# smtp_local_hostname = + +# Path to the SSL Keyfile, when using ESMTP. Please make sure the storyboard +# client can read this file. +# smtp_ssl_keyfile = + +# Path to the SSL Certificate, when using ESMTP. Please make sure the +# storyboard client can read this file. +# smtp_ssl_certfile = + +# Username/login for the SMTP server. +# smtp_user = + +# Password for the SMTP server. +# smtp_password = diff --git a/storyboard/plugin/email/__init__.py b/storyboard/plugin/email/__init__.py index e69de29b..94fbeaa6 100644 --- a/storyboard/plugin/email/__init__.py +++ b/storyboard/plugin/email/__init__.py @@ -0,0 +1,64 @@ +# Copyright (c) 2015 Hewlett-Packard Development Company, L.P. +# +# 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 oslo.config import cfg +from oslo_log import log + +CONF = cfg.CONF +LOG = log.getLogger(__name__) + +PLUGIN_OPTS = [ + cfg.BoolOpt("enable", + default=False, + help="Enable, or disable, the notification email plugin."), + cfg.StrOpt("sender", + default='StoryBoard (Do Not Reply)' + '', + help="The email address from which storyboard will send its " + "messages."), + cfg.StrOpt("reply_to", + default=None, + help="The email address of the Reply-To header (optional)."), + cfg.StrOpt("smtp_host", + default='localhost', + help="The SMTP server to use."), + cfg.IntOpt("smtp_port", + default=25, + help="The SMTP Server Port to connect to (default 25)."), + cfg.IntOpt("smtp_timeout", + default=10, + help="Timeout, in seconds, to wait for the SMTP connection to " + "fail"), + cfg.StrOpt("smtp_local_hostname", + default=None, + help="The FQDN of the sending host when identifying itself " + "to the SMTP server (optional)."), + cfg.StrOpt("smtp_ssl_keyfile", + default=None, + help="Path to the SSL Keyfile, when using ESMTP. Please make " + "sure the storyboard client can read this file."), + cfg.StrOpt("smtp_ssl_certfile", + default=None, + help="Path to the SSL Certificate, when using ESMTP " + "(optional). Please make sure the storyboard client can " + "read this file."), + cfg.StrOpt("smtp_user", + default=None, + help="Username/login for the SMTP server."), + cfg.StrOpt("smtp_password", + default=None, + help="Password for the SMTP server.") +] + +CONF.register_opts(PLUGIN_OPTS, "plugin_email") diff --git a/storyboard/tests/plugin/email/test_init.py b/storyboard/tests/plugin/email/test_init.py new file mode 100644 index 00000000..db3e6139 --- /dev/null +++ b/storyboard/tests/plugin/email/test_init.py @@ -0,0 +1,36 @@ +# Copyright (c) 2015 Hewlett-Packard Development Company, L.P. +# +# 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 oslo.config import cfg + +from storyboard.tests import base + + +CONF = cfg.CONF + + +class TestConfiguration(base.TestCase): + def test_configuration_defaults(self): + self.assertIsNotNone(CONF.plugin_email) + + conf = CONF.plugin_email + + self.assertEqual('localhost', conf.smtp_host) + self.assertEqual(25, conf.smtp_port) + self.assertEqual(10, conf.smtp_timeout) + self.assertEqual(None, conf.smtp_local_hostname) + self.assertEqual(None, conf.smtp_ssl_keyfile) + self.assertEqual(None, conf.smtp_ssl_certfile) + self.assertEqual(None, conf.smtp_user) + self.assertEqual(None, conf.smtp_password)