From 774bad20902edb0aaa4c0b52a6c630ae43600174 Mon Sep 17 00:00:00 2001 From: Valentin Deniaud Date: Mon, 2 Nov 2020 15:31:31 +0100 Subject: [PATCH] hobo: digest emails parameters sent by hobo (#46779) --- tests/test_hobo.py | 4 ++++ wcs/ctl/check_hobos.py | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/tests/test_hobo.py b/tests/test_hobo.py index 3ea558a7..c0a14b62 100644 --- a/tests/test_hobo.py +++ b/tests/test_hobo.py @@ -200,6 +200,8 @@ HOBO_JSON = { 'email_signature': 'Hello world.', 'default_from_email': 'noreply@example.net', 'theme': 'clapotis-les-canards', + 'sms_url': 'http://passerelle.example.net', + 'sms_sender': 'EO', }, 'users': [ { @@ -251,6 +253,8 @@ def test_update_configuration(): assert pub.cfg['misc']['sitename'] == 'Test wcs' assert pub.cfg['emails']['footer'] == 'Hello world.' assert pub.cfg['emails']['from'] == 'noreply@example.net' + assert pub.cfg['sms']['passerelle_url'] == 'http://passerelle.example.net' + assert pub.cfg['sms']['sender'] == 'EO' def test_update_themes(): diff --git a/wcs/ctl/check_hobos.py b/wcs/ctl/check_hobos.py index 5cc57e86..41fb68a7 100644 --- a/wcs/ctl/check_hobos.py +++ b/wcs/ctl/check_hobos.py @@ -161,6 +161,8 @@ class CmdCheckHobos(Command): if not pub.cfg.get('emails'): pub.cfg['emails'] = {} + if not pub.cfg.get('sms'): + pub.cfg['sms'] = {} variables = self.all_services.get('variables') or {} variables.update(service.get('variables') or {}) @@ -214,6 +216,11 @@ class CmdCheckHobos(Command): if variables.get('email_signature') is not None: pub.cfg['emails']['footer'] = force_str(variables.get('email_signature')) + if variables.get('sms_url'): + pub.cfg['sms']['passerelle_url'] = force_str(variables.get('sms_url')) + if variables.get('sms_sender'): + pub.cfg['sms']['sender'] = force_str(variables.get('sms_sender')) + pub.write_cfg() def update_profile(self, profile, pub): -- 2.20.1