mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-02 23:31:25 -07:00
Add toggle to control invalid character substitution in group names (#52748)
* make add_group return proper name * ensure central transform/check * added 'silent' option to avoid spamming current users those already using the plugins were used to the transformations, so no need to alert them * centralized valid var names * dont display dupes * comment on regex * added regex tests ini and script will now warn about deprecation * more complete errormsg
This commit is contained in:
parent
9c54649449
commit
d241794daa
14 changed files with 107 additions and 41 deletions
|
@ -77,6 +77,7 @@ EXAMPLES = '''
|
|||
import ast
|
||||
import re
|
||||
|
||||
from ansible.inventory.group import to_safe_group_name
|
||||
from ansible.plugins.inventory import BaseFileInventoryPlugin
|
||||
|
||||
from ansible.errors import AnsibleError, AnsibleParserError
|
||||
|
@ -171,6 +172,8 @@ class InventoryModule(BaseFileInventoryPlugin):
|
|||
if m:
|
||||
(groupname, state) = m.groups()
|
||||
|
||||
groupname = to_safe_group_name(groupname)
|
||||
|
||||
state = state or 'hosts'
|
||||
if state not in ['hosts', 'children', 'vars']:
|
||||
title = ":".join(m.groups())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue