Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions imageroot/actions/get-facts/50facts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def main():
facts.update(get_mailbox_settings_facts())
facts.update(get_master_users_facts())
facts.update(get_queue_settings_facts())
facts.update(get_custom_config_facts())
json.dump(facts, sys.stdout)

def get_addresses_facts():
Expand Down Expand Up @@ -243,6 +244,18 @@ def get_master_users_facts():
"master_users_count": len(odata.get("master_users", [])),
}

def get_custom_config_facts():
with subprocess.Popen(["podman", "exec", "dovecot", "ash", "-c",
"""grep -E '^[[:space:]]*[A-Za-z0-9_.-]+([[:space:]]|$)' /etc/dovecot/local.conf.d/*.conf | grep -v '[{}]' | wc -l"""
], stdout=subprocess.PIPE) as proc:
# Extract the line count from grep|wc output
try:
odata = json.load(proc.stdout)
except json.JSONDecodeError:
return {"get_custom_config_facts_error": True}
return {
"dovecot_custom_config_count": odata
}

if __name__ == "__main__":
main()
Loading