From d2b4151b7a3d8f6fa1f430e36a7d9ae025ea54d1 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Mon, 10 Jan 2022 07:27:12 +0100 Subject: [PATCH] fix alternatives parsing when they are part of a group (#3976) (#4020) * fix alternatives parsing when they are part of a group * add changelog fragment Co-authored-by: Guillaume Rousse (cherry picked from commit a675afcba9ab167832a6d273eb272e6a3d5ac216) Co-authored-by: Guillaume Rousse --- changelogs/fragments/3976-fix-alternatives-parsing.yml | 2 ++ plugins/modules/system/alternatives.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/3976-fix-alternatives-parsing.yml 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: