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

Add deprecation warning regarding host patterns

This commit is contained in:
James Cammarata 2015-08-13 14:50:28 -04:00
parent 6bf6b9fdbb
commit 32034feec5

View file

@ -34,6 +34,12 @@ from ansible.inventory.host import Host
from ansible.plugins import vars_loader
from ansible.utils.vars import combine_vars
try:
from __main__ import display
except ImportError:
from ansible.utils.display import Display
display = Display()
class Inventory(object):
"""
Host inventory for ansible.
@ -183,6 +189,10 @@ class Inventory(object):
# either a list of patterns or a string like 'pat1:pat2').
if isinstance(pattern, list):
pattern = ':'.join(pattern)
if ';' in pattern or ',' in pattern:
display.deprecated("The use of ',' or ';' in host patterns has been removed", version=2.0, removed=True)
patterns = self._split_pattern(pattern)
hosts = self._evaluate_patterns(patterns)