Add emailhost argument, set it in newlist and config_list
This commit is contained in:
parent
2b4d1acf52
commit
848c98c456
@ -46,7 +46,7 @@ class ListManager:
|
||||
for line in output.stdout.splitlines():
|
||||
print(f"[{script} {self.list_name}] {line}")
|
||||
|
||||
def newlist(self, urlhost: str, admin: str):
|
||||
def newlist(self, urlhost: str, emailhost: str, admin: str):
|
||||
password = "".join(secrets.choice(PASSWORD_CHARS) for i in range(PASSWORD_LEN))
|
||||
|
||||
self._call_script(
|
||||
@ -54,6 +54,7 @@ class ListManager:
|
||||
[
|
||||
"--quiet",
|
||||
f"--urlhost={urlhost}",
|
||||
f"--emailhost={emailhost}",
|
||||
self.list_name,
|
||||
admin,
|
||||
password,
|
||||
@ -62,6 +63,7 @@ class ListManager:
|
||||
|
||||
def config_list(
|
||||
self,
|
||||
emailhost: str,
|
||||
real_name: str,
|
||||
moderator: list[str],
|
||||
subject_prefix: str,
|
||||
@ -71,6 +73,7 @@ class ListManager:
|
||||
[
|
||||
# have to modify mlist directly to allow removing suffix
|
||||
"mlist.real_name = " + repr(real_name),
|
||||
"host_name = " + repr(emailhost),
|
||||
"moderator = " + repr(moderator),
|
||||
"subject_prefix = " + repr(subject_prefix),
|
||||
"from_is_list = 1",
|
||||
@ -133,6 +136,7 @@ def main(
|
||||
list_suffix: str,
|
||||
dry_run: bool,
|
||||
urlhost: str,
|
||||
emailhost: str,
|
||||
admin: str,
|
||||
):
|
||||
r = requests.get(api, headers={"Authorization": api_auth})
|
||||
@ -155,10 +159,11 @@ def main(
|
||||
print(f"Skipping non-existing list {list_name} in dry run mode")
|
||||
continue
|
||||
else:
|
||||
list_manager.newlist(urlhost, admin)
|
||||
list_manager.newlist(urlhost, emailhost, admin)
|
||||
|
||||
print(f"Configuring/syncing {list_name}...")
|
||||
list_manager.config_list(
|
||||
emailhost,
|
||||
props["real_name"],
|
||||
props["moderator"],
|
||||
props["subject_prefix"],
|
||||
@ -180,6 +185,9 @@ def parse_arguments():
|
||||
argp.add_argument(
|
||||
"--urlhost", help="Urlhost to use when creating new lists", required=True
|
||||
)
|
||||
argp.add_argument(
|
||||
"--emailhost", help="Emailhost to use when creating new lists", required=True
|
||||
)
|
||||
argp.add_argument(
|
||||
"--admin",
|
||||
help="Admin email address to use when creating new lists",
|
||||
@ -211,6 +219,7 @@ if __name__ == "__main__":
|
||||
args.list_suffix,
|
||||
args.dry_run,
|
||||
args.urlhost,
|
||||
args.emailhost,
|
||||
args.admin,
|
||||
)
|
||||
except subprocess.CalledProcessError as e:
|
||||
|
Loading…
Reference in New Issue
Block a user