remail: Make sure list configs inherit global gpg/smime

Per-list config dictionaries were always instantiated with default gpg
configuration because global gpg/smime settings were being ignored. This
change makes sure that smime and gpg options set on the global level are
inherited by list-specific configurations.

Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
This commit is contained in:
Konstantin Ryabitsev 2019-11-26 20:27:55 -05:00 committed by Thomas Gleixner
parent 18a16b08fb
commit 5e8939d9a0

View file

@ -263,7 +263,10 @@ list_defaults = {
} }
class list_config(object): class list_config(object):
def __init__(self, name, cfgdict): def __init__(self, name, cfgdict, maincfgdict=None):
if maincfgdict is None:
maincfgdict = {}
base = 'base.lists.%s' %name base = 'base.lists.%s' %name
self.base = base self.base = base
self.name = name self.name = name
@ -283,8 +286,8 @@ class list_config(object):
listid = cfgdict.get('listid', self.listaccount.addr.replace('@', '.')) listid = cfgdict.get('listid', self.listaccount.addr.replace('@', '.'))
self.listheaders = build_listheaders(self.listaccount.addr, listid) self.listheaders = build_listheaders(self.listaccount.addr, listid)
self.smime = smime_config(self.listdir, None) self.smime = smime_config(self.listdir, maincfgdict.get('smime', None))
self.gpg = gpg_config(self.listdir, None) self.gpg = gpg_config(self.listdir, maincfgdict.get('gpg', None))
self.admins = accounts_config(get_mandatory('admins', cfgdict, base), self.admins = accounts_config(get_mandatory('admins', cfgdict, base),
base) base)
@ -334,7 +337,7 @@ class main_config(object):
# Configure the lists # Configure the lists
self.lists = [] self.lists = []
for name, l in cfgdict.get('lists', {}).items(): for name, l in cfgdict.get('lists', {}).items():
self.lists.append(list_config(name, l)) self.lists.append(list_config(name, l, cfgdict))
def show(self): def show(self):
show_attrs(self, main_defaults, 2) show_attrs(self, main_defaults, 2)