Move list config into "config" and don't config lists when absent

This commit is contained in:
Adam Goldsmith 2023-02-03 14:01:41 -05:00
parent 848c98c456
commit 2e612837c7

View File

@ -3,12 +3,14 @@
""" """
Update Mailman 2 lists via a json API of the form: Update Mailman 2 lists via a json API of the form:
{ {
"LIST": { LIST: {
"real_name": "REAL_NAME", "config"?: {
"moderator": ["ADDRESS", ...], "real_name": REAL_NAME,
"subject_prefix": "PREFIX", "moderator": [ADDRESS, ...],
"reply_to_address": "REPLY_TO_ADDRESS", "subject_prefix": PREFIX,
"members": ["ADDRESS", ...] "reply_to_address": REPLY_TO_ADDRESS,
}
"members": [ADDRESS, ...]
}, },
... ...
} }
@ -161,14 +163,11 @@ def main(
else: else:
list_manager.newlist(urlhost, emailhost, admin) list_manager.newlist(urlhost, emailhost, admin)
if "config" in props:
print(f"Configuring/syncing {list_name}...") print(f"Configuring/syncing {list_name}...")
list_manager.config_list( list_manager.config_list(emailhost, **props["config"])
emailhost, else:
props["real_name"], print("Not configuring {list_name}, as it has no config section")
props["moderator"],
props["subject_prefix"],
props["reply_to_address"],
)
list_manager.sync_members(props["members"]) list_manager.sync_members(props["members"])