added some checks regarding output delimiter

This commit is contained in:
Ralf Mellis 2023-08-20 11:44:59 +02:00
parent 2cc5e0f703
commit 790d5b8e48

View File

@ -221,8 +221,8 @@ def getMailcowInfo(headers, verify, base_url):
Output is as follows: Output is as follows:
mailbox name email address used for login mailbox name email address used for login
active 1 --> active, 0 --> not active active 1 --> active, 0 --> not active
creation date creation date "None" if ???
last modified date "None" if never modified last modified date "None" if never modified
name display name name display name
number of messages number of messages
percent in use quota used, rounded to full percents percent in use quota used, rounded to full percents
@ -245,6 +245,8 @@ def doCmkOutputMailboxes():
created = mailbox_data[mb]["created"] created = mailbox_data[mb]["created"]
modified = mailbox_data[mb]["modified"] modified = mailbox_data[mb]["modified"]
name = mailbox_data[mb]["name"] name = mailbox_data[mb]["name"]
# strip semicolons, if present, since we use it as delimiter
name = name.replace(";", "")
num_messages = mailbox_data[mb]["num_messages"] num_messages = mailbox_data[mb]["num_messages"]
percent_in_use = mailbox_data[mb]["percent_in_use"] percent_in_use = mailbox_data[mb]["percent_in_use"]
quota = mailbox_data[mb]["quota"] quota = mailbox_data[mb]["quota"]
@ -257,6 +259,8 @@ def doCmkOutputMailboxes():
def doCmkOutputMailcow(version, num_domains, num_mailboxes, num_global_messages): def doCmkOutputMailcow(version, num_domains, num_mailboxes, num_global_messages):
print("<<<mailcow_info:sep(59)>>>") print("<<<mailcow_info:sep(59)>>>")
# strip semicolons, if present, since we use it as delimiter
version = version.replace(";", "")
print(f"{version};{num_domains};{num_mailboxes};{num_global_messages}") print(f"{version};{num_domains};{num_mailboxes};{num_global_messages}")
@ -264,7 +268,7 @@ def doCmkOutputMailcow(version, num_domains, num_mailboxes, num_global_messages)
Output is as follows: Output is as follows:
domain_name domain_name
active 1 --> active, 0 --> not active active 1 --> active, 0 --> not active
creation date creation date "None" if ???
last modified date "None" if never modified last modified date "None" if never modified
max number mailboxes max number mailboxes
number of mailboxes number of mailboxes