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
23 changes: 16 additions & 7 deletions msa_sdk/msa_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,31 @@ def process_content(cls, status, comment, new_params, log_response=False):

Process content.

This method should not be called directly instead use
task_success(), task_warning(), task_error() or task_pause().

Parameters
----------
status: String
Status ID: 'ENDED', 'FAIL', 'WARNING', 'PAUSE'
Possible values: MSA_API.ENDED, MSA_API.FAILED, MSA_API.WARNING, MSA_API.PAUSED
comment: String
Comment
new_params: Dictionary
Context
log_response: Bool
log_response: Boolean
Write log to a file

Returns
-------
Response content formated

"""
if ((status != cls.ENDED) and (status != cls.FAILED) and (status != cls.WARNING) and (status != cls.PAUSED)):
# overwrite comment
comment = "Bad status, wo_status should be MSA_API.ENDED, MSA_API.FAILED, MSA_API.WARNING, or MSA_API.PAUSED"
# force log_response
log_response = True

response = {
"wo_status": status,
"wo_comment": comment,
Expand Down Expand Up @@ -102,7 +111,7 @@ def task_error(cls, comment, context, log_response=True):
None

"""
print(cls.process_content(constants.FAILED, comment, context,
print(cls.process_content(cls.FAILED, comment, context,
log_response))
sys.exit(1)

Expand All @@ -126,7 +135,7 @@ def task_warning(cls, comment, context, log_response=True):
None

"""
print(cls.process_content(constants.WARNING, comment, context,
print(cls.process_content(cls.WARNING, comment, context,
log_response))
sys.exit(2)

Expand All @@ -150,7 +159,7 @@ def task_success(cls, comment, context, log_response=True):
None

"""
print(cls.process_content(constants.ENDED, comment, context,
print(cls.process_content(cls.ENDED, comment, context,
log_response))
sys.exit(0)

Expand All @@ -174,7 +183,7 @@ def task_pause(cls, comment, context, log_response=True):
None

"""
print(cls.process_content(constants.PAUSED, comment, context,
print(cls.process_content(cls.PAUSED, comment, context,
log_response))
sys.exit(0)

Expand Down Expand Up @@ -207,7 +216,7 @@ def content(self):

def check_response(self):
"""
Check reponse of a POST/GET/PUT/DELETE.
Check response of a POST/GET/PUT/DELETE.

Returns
--------
Expand Down