Skip to content

Commit

Permalink
Remove empty entries from grommunio-admin output
Browse files Browse the repository at this point in the history
  • Loading branch information
deajan committed Nov 11, 2024
1 parent f078f30 commit c2c2481
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions grommunio_exporter/grommunio_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,10 @@ def _get_mailbox_properties(self, usernames: List[str]):
"""
Get various properties of mailboxes
grommunio-admin shell -x << EOF 2>/dev/null | awk 'BEGIN {printf "["} {if ($1=="exmdb") { if (first==1) { printf "],["} else {first=1}}; if ($1~/^0x/) {next} ; printf"\n%s{\"%s\": \"%s\"}", sep,$1,$2; sep=","} END { printf "]" }'
grommunio-admin shell -x << EOF 2>/dev/null | awk 'BEGIN {printf "["} {if ($1=="") {next}; if ($1=="exmdb") { if (first==1) { printf "],["} else {first=1}}; if ($1~/^0x/) {next} ; printf"\n%s{\"%s\": \"%s\"}", sep,$1,$2; sep=","} END { printf "]" }'
"""
mailbox_properties = {}
awk_cmd = r"""awk 'BEGIN {printf "["} {if ($1=="exmdb") { if (first==1) { printf "],["} else {first=1}}; if ($1~/^0x/) {next} ; printf"\n%s{\"%s\": \"%s\"}", sep,$1,$2; sep=","} END { printf "]" }'"""
awk_cmd = r"""awk 'BEGIN {printf "["} {if ($1=="") {next}; if ($1=="exmdb") { if (first==1) { printf "],["} else {first=1}}; if ($1~/^0x/) {next} ; printf"\n%s{\"%s\": \"%s\"}", sep,$1,$2; sep=","} END { printf "]" }'"""
grommunio_shell_cmds = ""
for username in usernames:
grommunio_shell_cmds += f"exmdb {username} store get\n"
Expand Down

0 comments on commit c2c2481

Please sign in to comment.