1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

snap_alias: fix regex expression when listing aliases (#6361)

* snap_alias: fix regex expression when listing aliases

* simplify regex, add changelog
This commit is contained in:
Alexei Znamensky 2023-04-20 16:56:21 +12:00 committed by GitHub
parent 996fc8c18e
commit 4171418e37
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 3 deletions

View 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).

View file

@ -98,7 +98,7 @@ _state_map = dict(
class SnapAlias(StateModuleHelper): 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( module = dict(
argument_spec={ argument_spec={
@ -142,7 +142,10 @@ class SnapAlias(StateModuleHelper):
return results return results
with self.runner("state name", check_rc=True, output_process=process) as ctx: 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): def _get_aliases_for(self, name):
return self._get_aliases().get(name, []) return self._get_aliases().get(name, [])

View file

@ -11,4 +11,3 @@ skip/freebsd
skip/osx skip/osx
skip/macos skip/macos
skip/docker skip/docker
skip/ubuntu # FIXME!