Skip to content

Commit

Permalink
Improve warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfontein committed Jul 20, 2024
1 parent 1da01f3 commit 969e0a0
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 79 deletions.
6 changes: 3 additions & 3 deletions plugins/module_utils/compose_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ def parse_json_events(stderr, warn_function=None):
continue
if warn_function:
warn_function(
'Found non-JSON line: {0!r}. Please report this at '
'Cannot parse event from non-JSON line: {0!r}. Please report this at '
'https://github.com/ansible-collections/community.docker/issues/new?assignees=&labels=&projects=&template=bug_report.md'
.format(line)
)
Expand Down Expand Up @@ -412,9 +412,9 @@ def parse_json_events(stderr, warn_function=None):
except KeyError:
if warn_function:
warn_function(
'Unknown resource type {0!r}. Please report this at '
'Unknown resource type {0!r} in line {1!r}. Please report this at '
'https://github.com/ansible-collections/community.docker/issues/new?assignees=&labels=&projects=&template=bug_report.md'
.format(resource_type_str)
.format(resource_type_str, line)
)
resource_type = ResourceType.UNKNOWN
elif text in DOCKER_STATUS_PULL:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
- assert:
that:
- present_1_check is changed
- present_1_check.warnings | default([]) | select('regex', 'Cannot parse event from line:') | length == 0
- present_1_check.warnings | default([]) | select('regex', 'Cannot parse event from ') | length == 0
- present_1 is changed
- present_1.containers | length == 1
- present_1.containers[0].Name == pname ~ '-' ~ cname ~ '-1'
Expand All @@ -86,15 +86,15 @@
- present_1.images[0].ContainerName == pname ~ '-' ~ cname ~ '-1'
- present_1.images[0].Repository == (docker_test_image_alpine | split(':') | first)
- present_1.images[0].Tag == (docker_test_image_alpine | split(':') | last)
- present_1.warnings | default([]) | select('regex', 'Cannot parse event from line:') | length == 0
- present_1.warnings | default([]) | select('regex', 'Cannot parse event from ') | length == 0
- present_2_check is not changed
- present_2_check.warnings | default([]) | select('regex', 'Cannot parse event from line:') | length == 0
- present_2_check.warnings | default([]) | select('regex', 'Cannot parse event from ') | length == 0
- present_2 is not changed
- present_2.warnings | default([]) | select('regex', 'Cannot parse event from line:') | length == 0
- present_2.warnings | default([]) | select('regex', 'Cannot parse event from ') | length == 0
- present_3_check is changed
- present_3_check.warnings | default([]) | select('regex', 'Cannot parse event from line:') | length == 0
- present_3_check.warnings | default([]) | select('regex', 'Cannot parse event from ') | length == 0
- present_3 is changed
- present_3.warnings | default([]) | select('regex', 'Cannot parse event from line:') | length == 0
- present_3.warnings | default([]) | select('regex', 'Cannot parse event from ') | length == 0

####################################################################
## Absent ##########################################################
Expand Down Expand Up @@ -133,13 +133,13 @@
- assert:
that:
- absent_1_check is changed
- absent_1_check.warnings | default([]) | select('regex', 'Cannot parse event from line:') | length == 0
- absent_1_check.warnings | default([]) | select('regex', 'Cannot parse event from ') | length == 0
- absent_1 is changed
- absent_1.warnings | default([]) | select('regex', 'Cannot parse event from line:') | length == 0
- absent_1.warnings | default([]) | select('regex', 'Cannot parse event from ') | length == 0
- absent_2_check is not changed
- absent_2_check.warnings | default([]) | select('regex', 'Cannot parse event from line:') | length == 0
- absent_2_check.warnings | default([]) | select('regex', 'Cannot parse event from ') | length == 0
- absent_2 is not changed
- absent_2.warnings | default([]) | select('regex', 'Cannot parse event from line:') | length == 0
- absent_2.warnings | default([]) | select('regex', 'Cannot parse event from ') | length == 0

####################################################################
## Stopping and starting ###########################################
Expand Down Expand Up @@ -259,30 +259,30 @@
- assert:
that:
- present_1_check is changed
- present_1_check.warnings | default([]) | select('regex', 'Cannot parse event from line:') | length == 0
- present_1_check.warnings | default([]) | select('regex', 'Cannot parse event from ') | length == 0
- present_1 is changed
- present_1.warnings | default([]) | select('regex', 'Cannot parse event from line:') | length == 0
- present_1.warnings | default([]) | select('regex', 'Cannot parse event from ') | length == 0
- present_2_check is not changed
- present_2_check.warnings | default([]) | select('regex', 'Cannot parse event from line:') | length == 0
- present_2_check.warnings | default([]) | select('regex', 'Cannot parse event from ') | length == 0
- present_2 is not changed
- present_2.warnings | default([]) | select('regex', 'Cannot parse event from line:') | length == 0
- present_2.warnings | default([]) | select('regex', 'Cannot parse event from ') | length == 0
- present_3_check is changed
- present_3_check.warnings | default([]) | select('regex', 'Cannot parse event from line:') | length == 0
- present_3_check.warnings | default([]) | select('regex', 'Cannot parse event from ') | length == 0
- present_3 is changed
- present_3.warnings | default([]) | select('regex', 'Cannot parse event from line:') | length == 0
- present_3.warnings | default([]) | select('regex', 'Cannot parse event from ') | length == 0
- present_4_check is not changed
- present_4_check.warnings | default([]) | select('regex', 'Cannot parse event from line:') | length == 0
- present_4_check.warnings | default([]) | select('regex', 'Cannot parse event from ') | length == 0
- present_4 is not changed
- present_4.warnings | default([]) | select('regex', 'Cannot parse event from line:') | length == 0
- present_4.warnings | default([]) | select('regex', 'Cannot parse event from ') | length == 0
- present_5_check is changed
- present_5_check.warnings | default([]) | select('regex', 'Cannot parse event from line:') | length == 0
- present_5_check.warnings | default([]) | select('regex', 'Cannot parse event from ') | length == 0
- present_5 is changed
- present_5.warnings | default([]) | select('regex', 'Cannot parse event from line:') | length == 0
- present_5.warnings | default([]) | select('regex', 'Cannot parse event from ') | length == 0
- present_6_check is changed
- present_6_check.warnings | default([]) | select('regex', 'Cannot parse event from line:') | length == 0
- present_6_check.warnings | default([]) | select('regex', 'Cannot parse event from ') | length == 0
- present_6 is changed
- present_6.warnings | default([]) | select('regex', 'Cannot parse event from line:') | length == 0
- present_6.warnings | default([]) | select('regex', 'Cannot parse event from ') | length == 0
- present_7_check is changed
- present_7_check.warnings | default([]) | select('regex', 'Cannot parse event from line:') | length == 0
- present_7_check.warnings | default([]) | select('regex', 'Cannot parse event from ') | length == 0
- present_7 is changed
- present_7.warnings | default([]) | select('regex', 'Cannot parse event from line:') | length == 0
- present_7.warnings | default([]) | select('regex', 'Cannot parse event from ') | length == 0
28 changes: 14 additions & 14 deletions tests/integration/targets/docker_compose_v2/tasks/tests/pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,16 @@
that:
- present_1_check is failed or present_1_check is changed
- present_1_check is changed or present_1_check.msg.startswith('General error:')
- present_1_check.warnings | default([]) | select('regex', 'Cannot parse event from line:') | length == 0
- present_1_check.warnings | default([]) | select('regex', 'Cannot parse event from ') | length == 0
- present_1 is failed
- present_1.msg.startswith('General error:')
- present_1.warnings | default([]) | select('regex', 'Cannot parse event from line:') | length == 0
- present_1.warnings | default([]) | select('regex', 'Cannot parse event from ') | length == 0
- present_2_check is failed
- present_2_check.msg.startswith('Error when processing ' ~ cname ~ ':')
- present_2_check.warnings | default([]) | select('regex', 'Cannot parse event from line:') | length == 0
- present_2_check.warnings | default([]) | select('regex', 'Cannot parse event from ') | length == 0
- present_2 is failed
- present_2.msg.startswith('Error when processing ' ~ cname ~ ':')
- present_2.warnings | default([]) | select('regex', 'Cannot parse event from line:') | length == 0
- present_2.warnings | default([]) | select('regex', 'Cannot parse event from ') | length == 0

####################################################################
## Regular image ###################################################
Expand Down Expand Up @@ -194,32 +194,32 @@
- present_1_check is changed
- present_1_check.actions | selectattr('status', 'eq', 'Pulling') | first
- present_1_check.actions | selectattr('status', 'eq', 'Creating') | first
- present_1_check.warnings | default([]) | select('regex', 'Cannot parse event from line:') | length == 0
- present_1_check.warnings | default([]) | select('regex', 'Cannot parse event from ') | length == 0
- present_1 is changed
- present_1.actions | selectattr('status', 'eq', 'Pulling') | first
- present_1.actions | selectattr('status', 'eq', 'Creating') | first
- present_1.warnings | default([]) | select('regex', 'Cannot parse event from line:') | length == 0
- present_1.warnings | default([]) | select('regex', 'Cannot parse event from ') | length == 0
- present_2_check is not changed
- present_2_check.warnings | default([]) | select('regex', 'Cannot parse event from line:') | length == 0
- present_2_check.warnings | default([]) | select('regex', 'Cannot parse event from ') | length == 0
- present_2 is not changed
- present_2.warnings | default([]) | select('regex', 'Cannot parse event from line:') | length == 0
- present_2.warnings | default([]) | select('regex', 'Cannot parse event from ') | length == 0
- present_3_check is changed
- present_3_check.actions | selectattr('status', 'eq', 'Pulling') | first
- present_3_check.actions | selectattr('status', 'eq', 'Creating') | length == 0
- present_3_check.actions | selectattr('status', 'eq', 'Recreating') | length == 0
- present_3_check.warnings | default([]) | select('regex', 'Cannot parse event from line:') | length == 0
- present_3_check.warnings | default([]) | select('regex', 'Cannot parse event from ') | length == 0
- present_3 is not changed
- present_3.actions | selectattr('status', 'eq', 'Pulling') | first
- present_3.actions | selectattr('status', 'eq', 'Creating') | length == 0
- present_3.actions | selectattr('status', 'eq', 'Recreating') | length == 0
- present_3.warnings | default([]) | select('regex', 'Cannot parse event from line:') | length == 0
- present_3.warnings | default([]) | select('regex', 'Cannot parse event from ') | length == 0
- present_4_check is changed
- present_4_check.actions | selectattr('status', 'eq', 'Pulling') | length == 0
- present_4_check.warnings | default([]) | select('regex', 'Cannot parse event from line:') | length == 0
- present_4_check.warnings | default([]) | select('regex', 'Cannot parse event from ') | length == 0
- present_4 is changed
- present_4.actions | selectattr('status', 'eq', 'Pulling') | length == 0
- present_4.warnings | default([]) | select('regex', 'Cannot parse event from line:') | length == 0
- present_4.warnings | default([]) | select('regex', 'Cannot parse event from ') | length == 0
- present_5_check is not changed
- present_5_check.warnings | default([]) | select('regex', 'Cannot parse event from line:') | length == 0
- present_5_check.warnings | default([]) | select('regex', 'Cannot parse event from ') | length == 0
- present_5 is not changed
- present_5.warnings | default([]) | select('regex', 'Cannot parse event from line:') | length == 0
- present_5.warnings | default([]) | select('regex', 'Cannot parse event from ') | length == 0
Loading

0 comments on commit 969e0a0

Please sign in to comment.