[BUG] postfix.set_master breaks on line continuation
HG00 opened this issue · comments
Description
When reading a postfix master.cf that has continued lines, set_master gets a line that doesn't match its expectations (ie 8 fields). Lines beginning with '#' are correctly ignored, but lines starting with whitespace should be ignored here as well. As per postfix docs at https://www.postfix.org/master.5.html:
SYNTAX
The general format of the [master.cf](https://www.postfix.org/master.5.html) file is as follows:
o Empty lines and whitespace-only lines are ignored, as are lines
whose first non-whitespace character is a `#'.
o A logical line starts with non-whitespace text. A line that
starts with whitespace continues a logical line.
o Each logical line defines a single Postfix service. Each ser-
vice is identified by its name and type as described below.
When multiple lines specify the same service name and type, only
the last one is remembered. Otherwise, the order of [master.cf](https://www.postfix.org/master.5.html)
service definitions does not matter.
Each logical line consists of eight fields separated by whitespace.
These are described below in the order as they appear in the [master.cf](https://www.postfix.org/master.5.html)
file.
Where applicable a field of "-" requests that the built-in default
value be used. For boolean fields specify "y" or "n" to override the
default value.
Setup
Install postfix on ubuntu 20.04, try to use postfix.set_master. The file contains continuation lines which dont contain 8 "columns" eg:
...
smtp unix - - - - - smtp
relay unix - - - - - smtp
-o syslog_name=postfix/$service_name
# -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq unix n - - - - showq
...
Steps to Reproduce the behavior
salt-call postfix.set_master smtps inet n y n n 100 smtpd
# index out of range error
Expected behavior
postfix master config is updated
Versions Report
Salt Version:
Salt: 3004.1
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 2.7.3
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 2.10.1
libgit2: Not Installed
M2Crypto: 0.31.0
Mako: Not Installed
msgpack: 0.6.2
msgpack-pure: Not Installed
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: Not Installed
pycryptodome: 3.6.1
pygit2: Not Installed
Python: 3.8.10 (default, Mar 15 2022, 12:22:08)
python-gnupg: 0.4.5
PyYAML: 5.3.1
PyZMQ: 18.1.1
smmap: Not Installed
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.3.2
System Versions:
dist: ubuntu 20.04 focal
locale: utf-8
machine: x86_64
release: 5.4.0-120-generic
system: Linux
version: Ubuntu 20.04 focal