From eff33bac49fcb465e6a6631958a4a0cc0cc993a8 Mon Sep 17 00:00:00 2001 From: Abhijit Menon-Sen Date: Thu, 13 Aug 2015 17:21:53 +0530 Subject: [PATCH] Don't accept undocumented "p1;p2" patterns; note in changelog The correct (and now only) way to say p1 OR p2 is "p1:p2". --- CHANGELOG.md | 5 +++++ lib/ansible/inventory/__init__.py | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 080e891bc6f..ce79901fc58 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -166,6 +166,11 @@ Other Notable Changes: * play output is now dynamically sized to terminal with a minimal of 80 coluumns (old default) * vars_prompt and pause are now skipped with a warning if the play is called non interactively (i.e. pull from cron) +Minor changes: + +* The undocumented semicolon-separated "pattern1;pattern2" syntax to + match hosts is no longer supported. + ## 1.9.2 "Dancing In the Street" - Jun 26, 2015 * Security fixes to check that hostnames match certificates with https urls (CVE-2015-3908) diff --git a/lib/ansible/inventory/__init__.py b/lib/ansible/inventory/__init__.py index 11739f33580..3e0f1f1da20 100644 --- a/lib/ansible/inventory/__init__.py +++ b/lib/ansible/inventory/__init__.py @@ -178,10 +178,11 @@ class Inventory(object): applied subsets. """ - # process patterns + # Enumerate all hosts matching the given pattern (which may be + # either a list of patterns or a string like 'pat1:pat2'). if isinstance(pattern, list): - pattern = ';'.join(pattern) - patterns = self._split_pattern(pattern.replace(";",":")) + pattern = ':'.join(pattern) + patterns = self._split_pattern(pattern) hosts = self._get_hosts(patterns) # exclude hosts not in a subset, if defined @@ -520,8 +521,7 @@ class Inventory(object): if subset_pattern is None: self._subset = None else: - subset_pattern = subset_pattern.replace(',',':') - subset_patterns = self._split_pattern(subset_pattern.replace(";",":")) + subset_patterns = self._split_pattern(subset_pattern) results = [] # allow Unix style @filename data for x in subset_patterns: