main.py: create missing lists
This commit is contained in:
parent
916e037b26
commit
3b07155f20
1 changed files with 12 additions and 0 deletions
12
main.py
12
main.py
|
@ -84,6 +84,18 @@ def listmonk_get_list(list):
|
|||
json_object = json_object['data']['results']
|
||||
return json_object[0]
|
||||
|
||||
# ensure that groups exist as lists
|
||||
for group_info in authentik_get_groups():
|
||||
try:
|
||||
list_info = listmonk_get_list(group_info['name'])
|
||||
|
||||
except Exception as e:
|
||||
print('> Failed to find group as list, creating ' + group_info['name'])
|
||||
create_resp = listmonk_create_list(group_info['name'])
|
||||
print(create_resp)
|
||||
continue
|
||||
|
||||
|
||||
# ensure that users are synced
|
||||
for user_info in authentik_get_users():
|
||||
print('>>> Checking user ' + user_info['username'])
|
||||
|
|
Loading…
Reference in a new issue