1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

dont validate group names in yaml plugin

This commit is contained in:
Brian Coca 2017-09-21 22:22:01 -04:00 committed by Brian Coca
parent aaaf88908d
commit a819cfcad7

View file

@ -68,9 +68,6 @@ class InventoryModule(BaseFileInventoryPlugin):
def __init__(self):
super(InventoryModule, self).__init__()
self.patterns = {}
self._compile_patterns()
def verify_file(self, path):
@ -104,8 +101,6 @@ class InventoryModule(BaseFileInventoryPlugin):
def _parse_group(self, group, group_data):
if self.patterns['groupname'].match(group):
self.inventory.add_group(group)
if isinstance(group_data, MutableMapping):
@ -127,8 +122,6 @@ class InventoryModule(BaseFileInventoryPlugin):
for host_pattern in group_data['hosts']:
hosts, port = self._parse_host(host_pattern)
self.populate_host_vars(hosts, group_data['hosts'][host_pattern] or {}, group, port)
else:
self.display.warning("Skipping '%s' as this is not a valid group name" % group)
def _parse_host(self, host_pattern):
'''
@ -162,9 +155,3 @@ class InventoryModule(BaseFileInventoryPlugin):
hostnames = [pattern]
return (hostnames, port)
def _compile_patterns(self):
'''
Compiles the regular expressions required to parse the inventory and stores them in self.patterns.
'''
self.patterns['groupname'] = re.compile(u'''^[A-Za-z_][A-Za-z0-9_]*$''')