mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-03-30 07:13:08 +00:00
[PR #6361/4171418e backport][stable-6] snap_alias: fix regex expression when listing aliases (#6378)
snap_alias: fix regex expression when listing aliases (#6361)
* snap_alias: fix regex expression when listing aliases
* simplify regex, add changelog
(cherry picked from commit 4171418e37)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
2
changelogs/fragments/6361-snap-alias-regex-bugfix.yml
Normal file
2
changelogs/fragments/6361-snap-alias-regex-bugfix.yml
Normal file
@@ -0,0 +1,2 @@
|
||||
bugfixes:
|
||||
- snap_alias - module would only recognize snap names containing letter, numbers or the underscore character, failing to identify valid snap names such as ``lxd.lxc`` (https://github.com/ansible-collections/community.general/pull/6361).
|
||||
@@ -98,7 +98,7 @@ _state_map = dict(
|
||||
|
||||
|
||||
class SnapAlias(StateModuleHelper):
|
||||
_RE_ALIAS_LIST = re.compile(r"^(?P<snap>[\w-]+)\s+(?P<alias>[\w-]+)\s+.*$")
|
||||
_RE_ALIAS_LIST = re.compile(r"^(?P<snap>\S+)\s+(?P<alias>[\w-]+)\s+.*$")
|
||||
|
||||
module = dict(
|
||||
argument_spec={
|
||||
@@ -142,7 +142,10 @@ class SnapAlias(StateModuleHelper):
|
||||
return results
|
||||
|
||||
with self.runner("state name", check_rc=True, output_process=process) as ctx:
|
||||
return ctx.run(state="info")
|
||||
aliases = ctx.run(state="info")
|
||||
if self.verbosity >= 4:
|
||||
self.vars.get_aliases_run_info = ctx.run_info
|
||||
return aliases
|
||||
|
||||
def _get_aliases_for(self, name):
|
||||
return self._get_aliases().get(name, [])
|
||||
|
||||
@@ -11,4 +11,3 @@ skip/freebsd
|
||||
skip/osx
|
||||
skip/macos
|
||||
skip/docker
|
||||
skip/ubuntu # FIXME!
|
||||
|
||||
Reference in New Issue
Block a user