Coverage for .tox/coverage/lib/python3.11/site-packages/wuttamess/postfix.py: 100%
12 statements
« prev ^ index » next coverage.py v7.6.1, created at 2024-09-11 07:00 -0500
« prev ^ index » next coverage.py v7.6.1, created at 2024-09-11 07:00 -0500
1# -*- coding: utf-8; -*-
2################################################################################
3#
4# WuttaMess -- Fabric Automation Helpers
5# Copyright © 2024 Lance Edgar
6#
7# This file is part of Wutta Framework.
8#
9# Wutta Framework is free software: you can redistribute it and/or modify it
10# under the terms of the GNU General Public License as published by the Free
11# Software Foundation, either version 3 of the License, or (at your option) any
12# later version.
13#
14# Wutta Framework is distributed in the hope that it will be useful, but
15# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17# more details.
18#
19# You should have received a copy of the GNU General Public License along with
20# Wutta Framework. If not, see <http://www.gnu.org/licenses/>.
21#
22################################################################################
23"""
24Postfix mail service
25"""
28def set_config(c, setting, value):
29 """
30 Configure the given setting with the given value.
31 """
32 c.run(f"postconf -e '{setting}={value}'")
35def set_myhostname(c, hostname):
36 """
37 Configure the ``myhostname`` setting with the given string.
38 """
39 set_config(c, 'myhostname', hostname)
42def set_myorigin(c, origin):
43 """
44 Configure the ``myorigin`` setting with the given string.
45 """
46 set_config(c, 'myorigin', origin)
49def set_mydestination(c, *destinations):
50 """
51 Configure the ``mydestinations`` setting with the given strings.
52 """
53 set_config(c, 'mydestination', ', '.join(destinations))
56def set_mynetworks(c, *networks):
57 """
58 Configure the ``mynetworks`` setting with the given strings.
59 """
60 set_config(c, 'mynetworks', ' '.join(networks))
63def set_relayhost(c, relayhost):
64 """
65 Configure the ``relayhost`` setting with the given string
66 """
67 set_config(c, 'relayhost', relayhost)