1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-04-25 13:12:46 +00:00

snap: fix regex to support option values with whitespaces (#5475) (#5479)

* snap: fix regex to support option values with whitespaces

* add changelog fragment

(cherry picked from commit 8fb2228125)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
This commit is contained in:
patchback[bot] 2022-11-06 11:51:31 +01:00 committed by GitHub
parent ad2d899713
commit 460cd523fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 5 deletions

View file

@ -170,7 +170,7 @@ def _state_map(value):
class Snap(CmdStateModuleHelper):
__disable_re = re.compile(r'(?:\S+\s+){5}(?P<notes>\S+)')
__set_param_re = re.compile(r'(?P<snap_prefix>\S+:)?(?P<key>\S+)=(?P<value>\S+)')
__set_param_re = re.compile(r'(?P<snap_prefix>\S+:)?(?P<key>\S+)\s*=\s*(?P<value>.+)')
module = dict(
argument_spec={
'name': dict(type='list', elements='str', required=True),
@ -342,7 +342,7 @@ class Snap(CmdStateModuleHelper):
if selected_snap_name is None or (snap_name is not None and snap_name == selected_snap_name):
key = match.group("key")
value = match.group("value")
value = match.group("value").strip()
if key not in option_map or key in option_map and option_map[key] != value:
option_without_prefix = key + "=" + value