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:
parent
996fc8c18e
commit
4171418e37
3 changed files with 7 additions and 3 deletions
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):
|
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, [])
|
||||||
|
|
|
@ -11,4 +11,3 @@ skip/freebsd
|
||||||
skip/osx
|
skip/osx
|
||||||
skip/macos
|
skip/macos
|
||||||
skip/docker
|
skip/docker
|
||||||
skip/ubuntu # FIXME!
|
|
||||||
|
|
Loading…
Reference in a new issue