mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
Allow parent groups to be variables or literal (#53649)
* Allow parent groups to be variables or literal, requires {{ }}
* Check strict before failing on templating errors
* Don't add a group if an invalid parent group was provided
This commit is contained in:
committed by
Brian Coca
parent
90a38670be
commit
87ebc56de6
@@ -404,6 +404,13 @@ class Constructable(object):
|
||||
prefix = keyed.get('prefix', '')
|
||||
sep = keyed.get('separator', '_')
|
||||
raw_parent_name = keyed.get('parent_group', None)
|
||||
if raw_parent_name:
|
||||
try:
|
||||
raw_parent_name = self.templar.template(raw_parent_name)
|
||||
except AnsibleError as e:
|
||||
if strict:
|
||||
raise AnsibleParserError("Could not generate parent group %s for group %s: %s" % (raw_parent_name, key, to_native(e)))
|
||||
continue
|
||||
|
||||
new_raw_group_names = []
|
||||
if isinstance(key, string_types):
|
||||
|
||||
Reference in New Issue
Block a user