mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
Adds comments on handling quoted group vars
This commit is contained in:
@@ -169,7 +169,9 @@ class InventoryParser(object):
|
||||
raise errors.AnsibleError("variables assigned to group must be in key=value form")
|
||||
else:
|
||||
(k, v) = [e.strip() for e in line.split("=", 1)]
|
||||
# When the value is a single-quoted or double-quoted string
|
||||
if re.match(r"^(['\"]).*\1$", v):
|
||||
# Unquote the string
|
||||
group.set_variable(k, re.sub(r"^['\"]|['\"]$", '', v))
|
||||
else:
|
||||
group.set_variable(k, v)
|
||||
|
||||
Reference in New Issue
Block a user