diff --git a/SoftLayer/CLI/ticket/__init__.py b/SoftLayer/CLI/ticket/__init__.py index 9886aa686..81c248322 100644 --- a/SoftLayer/CLI/ticket/__init__.py +++ b/SoftLayer/CLI/ticket/__init__.py @@ -1,10 +1,10 @@ """Support tickets.""" import click +import re from SoftLayer.CLI import formatting - TEMPLATE_MSG = "***** SoftLayer Ticket Content ******" # https://softlayer.github.io/reference/services/SoftLayer_Ticket_Priority/getPriorities/ @@ -17,7 +17,7 @@ ] -def get_ticket_results(mgr, ticket_id, update_count=1): +def get_ticket_results(mgr, ticket_id, is_json = False, update_count=1): """Get output about a ticket. :param integer id: the ticket ID @@ -64,6 +64,7 @@ def get_ticket_results(mgr, ticket_id, update_count=1): # NOTE(kmcdonald): Windows new-line characters need to be stripped out wrapped_entry += click.wrap_text(update['entry'].replace('\r', '')) + if is_json and '\n' in wrapped_entry: + wrapped_entry = re.sub(r"(?