Commit 046c54f6 authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼

Update Release Candidate

parents 497f3ac1 0e4c73a9
......@@ -39,7 +39,7 @@ from slapos.testing.testcase import installSoftwareUrlList
from slapos.testing.testcase import SlapOSNodeCommandError
from slapos.grid.utils import md5digest
old_software_release_url = 'https://lab.nexedi.com/nexedi/slapos/raw/1.0.167.3/software/erp5/software.cfg'
old_software_release_url = 'https://lab.nexedi.com/nexedi/slapos/raw/1.0.167.4/software/erp5/software.cfg'
new_software_release_url = os.path.abspath(
os.path.join(os.path.dirname(__file__), '..', 'software.cfg'))
......
......@@ -27,7 +27,7 @@ md5sum = a1a9c22c2a7829c66a49fc2504604d21
[grafana-config-file]
filename = grafana-config-file.cfg.in
md5sum = 8244d430905b968795c7946049bed9e3
md5sum = e255dcca466f5de51698d24cbd114577
[grafana-provisioning-config-file]
filename = grafana-provisioning-config-file.cfg.in
......
......@@ -346,7 +346,7 @@ password = {{ slapparameter_dict.get('smtp-password', '') and '"""%s"""' % slapp
cert_file =
key_file =
#skip_verify = false
skip_verify = {{ slapparameter_dict.get('smtp-verify-ssl', True) and 'false' or 'true' }}
skip_verify = {{ slapparameter_dict.get('smtp-verify-ssl', 'true').lower() == 'true' and 'false' or 'true' }}
#from_address = admin@grafana.localhost
from_address = {{ slapparameter_dict.get('email-from-address', '') }}
#from_name = Grafana
......
......@@ -17,8 +17,11 @@
},
"smtp-verify-ssl": {
"description": "Verify SSL certificate of SMTP server",
"type": "boolean",
"default": true
"type": "string",
"enum": [
"true",
"false"
]
},
"email-from-address": {
"description": "Email address used in From: header of emails",
......
{
"name": "Grafana",
"description": "Grafana, Telegraf and Influxdb",
"serialisation": "json-in-xml",
"serialisation": "xml",
"software-type": {
"default": {
"title": "Default",
......
......@@ -45,6 +45,7 @@ setup(
'slapos.libnetworkcache',
'erp5.util',
'requests',
'six',
'supervisor',
'psutil',
],
......
......@@ -25,6 +25,8 @@
#
##############################################################################
from __future__ import unicode_literals
import io
import logging
import os
import tempfile
......@@ -33,6 +35,7 @@ import time
import psutil
import requests
from six.moves import configparser
from slapos.testing.testcase import makeModuleSetUpAndTestCaseClass
......@@ -93,6 +96,52 @@ class TestGrafana(GrafanaTestCase):
sorted(['influxdb', 'loki']),
sorted([ds['type'] for ds in resp.json()]))
def test_email_disabled(self):
config = configparser.ConfigParser()
# grafana config file is like an ini file with an implicit default section
with open(
os.path.join(self.computer_partition_root_path, 'etc',
'grafana-config-file.cfg')) as f:
config.readfp(io.StringIO('[default]\n' + f.read()))
self.assertEqual(config.get('smtp', 'enabled'), 'false')
class TestGrafanaEmailEnabled(GrafanaTestCase):
__partition_reference__ = 'mail'
smtp_verify_ssl = "true"
smtp_skip_verify = "false"
@classmethod
def getInstanceParameterDict(cls):
return {
"smtp-server": "smtp.example.com:25",
"smtp-username": "smtp_username",
"smtp-password": "smtp_password",
'smtp-verify-ssl': cls.smtp_verify_ssl,
"email-from-address": "grafana@example.com",
"email-from-name": "Grafana From Name",
}
def test_email_enabled(self):
config = configparser.ConfigParser()
with open(
os.path.join(self.computer_partition_root_path, 'etc',
'grafana-config-file.cfg')) as f:
config.readfp(io.StringIO('[default]\n' + f.read()))
self.assertEqual(config.get('smtp', 'enabled'), 'true')
self.assertEqual(config.get('smtp', 'host'), 'smtp.example.com:25')
self.assertEqual(config.get('smtp', 'user'), 'smtp_username')
self.assertEqual(config.get('smtp', 'password'), '"""smtp_password"""')
self.assertEqual(config.get('smtp', 'skip_verify'), self.smtp_skip_verify)
self.assertEqual(config.get('smtp', 'from_address'), 'grafana@example.com')
self.assertEqual(config.get('smtp', 'from_name'), 'Grafana From Name')
class TestGrafanaEmailEnabledSkipVerify(TestGrafanaEmailEnabled):
smtp_verify_ssl = "false"
smtp_skip_verify = "true"
class TestInfluxDb(GrafanaTestCase):
def setUp(self):
......
......@@ -190,7 +190,7 @@ setuptools-dso = 1.7
rubygemsrecipe = 0.3.0
six = 1.12.0
slapos.cookbook = 1.0.197
slapos.core = 1.6.13
slapos.core = 1.6.14
slapos.extension.strip = 0.4
slapos.extension.shared = 1.0
slapos.libnetworkcache = 0.20
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment