diff --git a/changelogs/fragments/3976-fix-alternatives-parsing.yml b/changelogs/fragments/3976-fix-alternatives-parsing.yml new file mode 100644 index 0000000000..cc6dd60b97 --- /dev/null +++ b/changelogs/fragments/3976-fix-alternatives-parsing.yml @@ -0,0 +1,2 @@ +bugfixes: + - alternatives - fix output parsing for alternatives groups (https://github.com/ansible-collections/community.general/pull/3976). diff --git a/plugins/modules/system/alternatives.py b/plugins/modules/system/alternatives.py index 5831382680..fb4c05e110 100644 --- a/plugins/modules/system/alternatives.py +++ b/plugins/modules/system/alternatives.py @@ -104,7 +104,7 @@ def main(): # available alternatives current_path_regex = re.compile(r'^\s*link currently points to (.*)$', re.MULTILINE) - alternative_regex = re.compile(r'^(\/.*)\s-\spriority', re.MULTILINE) + alternative_regex = re.compile(r'^(\/.*)\s-\s(?:family\s\S+\s)?priority', re.MULTILINE) match = current_path_regex.search(display_output) if match: