Skip to content

Commit

Permalink
Add email notification config (#43)
Browse files Browse the repository at this point in the history
* Add email notification config

* Remove unnecessary comma
  • Loading branch information
samirjorina authored and dirkmueller committed Apr 19, 2017
1 parent 5b60a55 commit a04f4c6
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 4 deletions.
7 changes: 7 additions & 0 deletions chef/cookbooks/monasca/recipes/master.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@
keystone_admin_password: keystone_settings["admin_password"],
database_grafana_password: node[:monasca][:master][:database_grafana_password],

notification_enable_email: node[:monasca][:master][:notification_enable_email],
smtp_host: node[:monasca][:master][:smtp_host],
smtp_port: node[:monasca][:master][:smtp_port],
smtp_user: node[:monasca][:master][:smtp_user],
smtp_password: node[:monasca][:master][:smtp_password],
smtp_from_address: node[:monasca][:master][:smtp_from_address],

memcached_listen_ip: monasca_net_ip,
kafka_host: monasca_net_ip,
kibana_host: pub_net_ip,
Expand Down
8 changes: 7 additions & 1 deletion chef/data_bags/crowbar/template-monasca.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,13 @@
"keystone_cmm_operator_user_password" : "",
"keystone_cmm_agent_password" : "",
"keystone_admin_agent_password" : "",
"database_grafana_password" : ""
"database_grafana_password": "",
"notification_enable_email": true,
"smtp_host": "localhost",
"smtp_port": 25,
"smtp_user": "",
"smtp_password": "",
"smtp_from_address": "monasca@localhost"
},
"db" : {
"database" : "monasca",
Expand Down
10 changes: 8 additions & 2 deletions chef/data_bags/crowbar/template-monasca.schema
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,15 @@
"keystone_cmm_operator_user_password": { "required": true, "type": "str" },
"keystone_cmm_agent_password": { "required": true, "type": "str" },
"keystone_admin_agent_password": { "required": true, "type": "str" },
"database_grafana_password": { "required": true, "type": "str" }
"database_grafana_password": { "required": true, "type": "str" },
"notification_enable_email": { "required": true, "type": "bool" },
"smtp_host": { "required": true, "type": "str" },
"smtp_port": { "required": true, "type": "int" },
"smtp_user": { "required": true, "type": "str" },
"smtp_password": { "required": true, "type": "str" },
"smtp_from_address": { "required": true, "type": "str" }
}
},
},
"db": {
"required": true,
"type": "map",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* Copyright 2017 FUJITSU LIMITED
*
* 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.
*/

$(document).ready(function($) {
$('#master_notification_enable_email').on('change', function() {
var value = $(this).val();

if (value == 'false') {
$('#master_smtp_host').attr('disabled', 'disabled');
$('#master_smtp_port').attr('disabled', 'disabled');
$('#master_smtp_user').attr('disabled', 'disabled');
$('#master_smtp_password').attr('disabled', 'disabled');
$('#master_smtp_from_address').attr('disabled', 'disabled');
}
else
{
$('#master_smtp_host').removeAttr('disabled');
$('#master_smtp_port').removeAttr('disabled');
$('#master_smtp_user').removeAttr('disabled');
$('#master_smtp_password').removeAttr('disabled');
$('#master_smtp_from_address').removeAttr('disabled');
}
}).trigger('change');
});
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,13 @@
= password_field %w(master keystone_admin_agent_password)
= password_field %w(master database_grafana_password)

%fieldset
%legend
= t(".master_notification_header")

= boolean_field %w(master notification_enable_email)
= string_field %w(master smtp_host)
= integer_field %w(master smtp_port)
= string_field %w(master smtp_user)
= string_field %w(master smtp_password)
= string_field %w(master smtp_from_address)
9 changes: 8 additions & 1 deletion crowbar_framework/config/locales/monasca/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ en:
url: 'Monasca URL'
master_header: 'Installation parameters'
master:
cmm_tarball_url: 'URL of the CMM installer tarball'
influxdb_mon_api_password: 'InfluxDB password'
influxdb_mon_persister_password: 'Metrics persister password'
database_notification_password: 'Notification database password'
Expand All @@ -42,6 +41,14 @@ en:
keystone_cmm_agent_password: 'keystone_cmm_agent_password'
keystone_admin_agent_password: 'keystone_admin_agent_password'
database_grafana_password: 'Grafana database password'
master_notification_header: 'Notification configuration'
master:
notification_enable_email: 'Enable email notification'
smtp_host: 'SMTP host'
smtp_port: 'SMTP port'
smtp_user: 'SMTP user'
smtp_password: 'SMTP password'
smtp_from_address: 'SMTP sender (FROM) address'
db_header: 'Database settings'
db:
database: 'Database'
Expand Down

0 comments on commit a04f4c6

Please sign in to comment.