Skip to content

Commit

Permalink
Handle tail messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfontein committed Jul 25, 2024
1 parent 969e0a0 commit f50c06c
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion plugins/module_utils/compose_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,22 @@ def parse_json_events(stderr, warn_function=None):
.format(line, exc)
)
continue
if line_data.get('error'):
if line_data.get('tail'):
resource_type = ResourceType.UNKNOWN
msg = line_data.get('text')
status = 'Error'
if isinstance(msg, str) and msg.lower().startswith('warning:'):
# For some reason, Writer.TailMsgf() is always used for errors *except* in one place,
# where its message is prepended with 'WARNING: ' (in pkg/compose/pull.go).
status = 'Warning'
msg = msg[len('warning:'):].lstrip()
event = Event(
resource_type,
None,
status,
msg,
)
elif line_data.get('error'):
resource_type = ResourceType.UNKNOWN
event = Event(
resource_type,
Expand Down

0 comments on commit f50c06c

Please sign in to comment.