Skip to content

Commit

Permalink
Add logic to update smarthost settings with module information
Browse files Browse the repository at this point in the history
  • Loading branch information
stephdl committed Apr 12, 2024
1 parent 127206a commit 9bd932a
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,24 @@ import sys
import json
import agent

rdb = agent.redis_connect() # full read-only access on every key

manual_configuration = True
smtp = agent.get_smarthost_settings(agent.redis_connect())
modules=[]
rdb = agent.redis_connect()
# we query all the list of service provider
for key in agent.list_service_providers(rdb,'imap','tcp'):
node_name = rdb.get('node/'+ key['node'] + '/ui_name') or ""
obj = {
"mail_id": key['module_id'],
"mail_name": key['ui_name'] or "",
"node": key['node'],
"node_name": node_name,
"host": key['host']
}
manual_configuration = False if key['host'] == smtp['host'] else True
modules.append(obj)
smtp.update({"mail_server":modules, "manual_configuration": manual_configuration})

json.dump(smtp, fp=sys.stdout)

0 comments on commit 9bd932a

Please sign in to comment.