summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2013-12-15 04:59:30 +0100
committerGuilhem Moulin <guilhem@fripost.org>2015-06-07 02:51:24 +0200
commit8dfcb7e08442b4af8f285bdd7732750938b25b9f (patch)
treedde0f58223a49ff729efd96014b0bf5b57681617 /lib
parent3d2f023cb27126e879ac3522169cf813507b58ba (diff)
Use postmulti to run postconf per instance.
Diffstat (limited to 'lib')
-rw-r--r--lib/postmap13
-rw-r--r--lib/postmulti14
2 files changed, 19 insertions, 8 deletions
diff --git a/lib/postmap b/lib/postmap
index 5691c48..7080b25 100644
--- a/lib/postmap
+++ b/lib/postmap
@@ -27,11 +27,16 @@ except ImportError:
# pick the default_detabase_type of the given instance instead.
def file_suffix(instance, db):
if not db:
- cmd = [ os.path.join(os.sep, 'usr', 'sbin', 'postconf') ]
if instance:
- config = os.path.join(os.sep, 'etc', 'postfix-%s' % instance)
- cmd.extend([ '-c', config ])
- cmd.extend([ '-h', 'default_database_type' ])
+ cmd = [ os.path.join(os.sep, 'usr', 'sbin', 'postmulti')
+ , '-x'
+ , '-i', instance
+ , '--'
+ ]
+ else:
+ cmd = []
+ cmd.extend([ os.path.join(os.sep, 'usr', 'sbin', 'postconf')
+ , '-h', 'default_database_type' ])
null = open (os.devnull, 'wb')
db = subprocess.check_output(cmd, stderr=null).rstrip()
null.closed
diff --git a/lib/postmulti b/lib/postmulti
index 6aed553..cad01f8 100644
--- a/lib/postmulti
+++ b/lib/postmulti
@@ -19,11 +19,17 @@
# Look up postfix configuration variable
def postconf(k, instance=None):
- cmd = [ os.path.join(os.sep, 'usr', 'sbin', 'postconf') ]
if instance:
- config = os.path.join(os.sep, 'etc', 'postfix-%s' % instance)
- cmd.extend([ '-c', config ])
- cmd.extend([ '-h', k ])
+ cmd = [ os.path.join(os.sep, 'usr', 'sbin', 'postmulti')
+ , '-x'
+ , '-i', instance
+ , '--'
+ ]
+ else:
+ cmd = []
+
+ cmd.extend([ os.path.join(os.sep, 'usr', 'sbin', 'postconf')
+ , '-h', k ])
return subprocess.check_output(cmd, stderr=subprocess.STDOUT).rstrip()