mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
[PR #5794/3b73e7ed backport][stable-5] alternatives: make work with Fedora 37 (#5796)
alternatives: make work with Fedora 37 (#5794)
* alternatives in Fedora 37 uses follower instead of slave.
* Add changelog fragment.
(cherry picked from commit 3b73e7ed2a
)
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
7392a8e52c
commit
37feac8f68
2 changed files with 7 additions and 3 deletions
2
changelogs/fragments/5794-alternatives-fedora37.yml
Normal file
2
changelogs/fragments/5794-alternatives-fedora37.yml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- "alternatives - support subcommands on Fedora 37, which uses ``follower`` instead of ``slave`` (https://github.com/ansible-collections/community.general/pull/5794)."
|
|
@ -60,6 +60,8 @@ options:
|
||||||
description:
|
description:
|
||||||
- A list of subcommands.
|
- A list of subcommands.
|
||||||
- Each subcommand needs a name, a link and a path parameter.
|
- Each subcommand needs a name, a link and a path parameter.
|
||||||
|
- Subcommands are also named 'slaves' or 'followers', depending on the version
|
||||||
|
of alternatives.
|
||||||
type: list
|
type: list
|
||||||
elements: dict
|
elements: dict
|
||||||
aliases: ['slaves']
|
aliases: ['slaves']
|
||||||
|
@ -310,10 +312,10 @@ class AlternativesModule(object):
|
||||||
current_mode_regex = re.compile(r'\s-\s(?:status\sis\s)?(\w*)(?:\smode|.)$', re.MULTILINE)
|
current_mode_regex = re.compile(r'\s-\s(?:status\sis\s)?(\w*)(?:\smode|.)$', re.MULTILINE)
|
||||||
current_path_regex = re.compile(r'^\s*link currently points to (.*)$', re.MULTILINE)
|
current_path_regex = re.compile(r'^\s*link currently points to (.*)$', re.MULTILINE)
|
||||||
current_link_regex = re.compile(r'^\s*link \w+ is (.*)$', re.MULTILINE)
|
current_link_regex = re.compile(r'^\s*link \w+ is (.*)$', re.MULTILINE)
|
||||||
subcmd_path_link_regex = re.compile(r'^\s*slave (\S+) is (.*)$', re.MULTILINE)
|
subcmd_path_link_regex = re.compile(r'^\s*(?:slave|follower) (\S+) is (.*)$', re.MULTILINE)
|
||||||
|
|
||||||
alternative_regex = re.compile(r'^(\/.*)\s-\s(?:family\s\S+\s)?priority\s(\d+)((?:\s+slave.*)*)', re.MULTILINE)
|
alternative_regex = re.compile(r'^(\/.*)\s-\s(?:family\s\S+\s)?priority\s(\d+)((?:\s+(?:slave|follower).*)*)', re.MULTILINE)
|
||||||
subcmd_regex = re.compile(r'^\s+slave (.*): (.*)$', re.MULTILINE)
|
subcmd_regex = re.compile(r'^\s+(?:slave|follower) (.*): (.*)$', re.MULTILINE)
|
||||||
|
|
||||||
match = current_mode_regex.search(display_output)
|
match = current_mode_regex.search(display_output)
|
||||||
if not match:
|
if not match:
|
||||||
|
|
Loading…
Reference in a new issue