diff options
author | Guilhem Moulin <guilhem@fripost.org> | 2018-12-03 03:18:56 +0100 |
---|---|---|
committer | Guilhem Moulin <guilhem@fripost.org> | 2018-12-03 03:43:41 +0100 |
commit | dcdb8cd6b1b525fc8eacd509586da3396c068251 (patch) | |
tree | 0ea6c49af37faf4b8b33b366506aedbf374a5968 /lib/modules/postmap | |
parent | 78a300a2430cb2652c7839cd35400cc22122c798 (diff) |
Postfix: replace cdb & btree tables with lmdb ones.
Cf. lmdb_table(5).
Diffstat (limited to 'lib/modules/postmap')
-rw-r--r-- | lib/modules/postmap | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/modules/postmap b/lib/modules/postmap index 7080b25..8c9d54c 100644 --- a/lib/modules/postmap +++ b/lib/modules/postmap @@ -25,63 +25,63 @@ except ImportError: # Look up for the file suffix corresponding to 'db'. If 'db' is unset, # pick the default_detabase_type of the given instance instead. def file_suffix(instance, db): if not db: if instance: 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 # See postmap(1) and postalias(1) - suffixes = { 'btree': 'db', 'cdb': 'cdb', 'hash': 'db' } + suffixes = { 'btree': 'db', 'cdb': 'cdb', 'hash': 'db', 'lmdb': 'lmdb' } return suffixes[db] # Compile the given (alias/lookup) table def compile(cmd, instance, db, src): cmd = [ os.path.join(os.sep, 'usr', 'sbin', cmd) ] if instance: config = os.path.join(os.sep, 'etc', 'postfix-%s' % instance) cmd.extend([ '-c', config ]) if db: src = "%s:%s" % (db,src) cmd.append(src) subprocess.check_output(cmd, stderr=subprocess.STDOUT) def main(): module = AnsibleModule( argument_spec = dict( src = dict( required=True ), - db = dict( choices=['btree','cdb','hash'] ), + db = dict( choices=['btree','cdb','hash','lmdb'] ), cmd = dict( choices=['postmap','postalias'], default='postmap' ), instance = dict( required=False ) ), add_file_common_args=True, supports_check_mode=True ) params = module.params src = params['src'] db = params['db'] cmd = params['cmd'] instance = params['instance'] if os.path.isabs(src): src = src else: module.fail_json(msg="absolute paths are required") if not os.path.exists(src): module.fail_json(src=src, msg="no such file") |