Skip to content

Commit

Permalink
Merge pull request ansible#8580 from mpeters/ec2_inv_empty_patterns
Browse files Browse the repository at this point in the history
Handle the case where include_pattern and exclude_pattern exist but are empty strings
  • Loading branch information
mpdehaan committed Aug 12, 2014
2 parents ab6e1a4 + 8b1d6f5 commit 9edf3a7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion plugins/inventory/ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ def read_settings(self):
pattern_include = config.get('ec2', 'pattern_include')
if pattern_include and len(pattern_include) > 0:
self.pattern_include = re.compile(pattern_include)
else:
self.pattern_include = None
except ConfigParser.NoOptionError, e:
self.pattern_include = None

Expand All @@ -265,8 +267,10 @@ def read_settings(self):
pattern_exclude = config.get('ec2', 'pattern_exclude');
if pattern_exclude and len(pattern_exclude) > 0:
self.pattern_exclude = re.compile(pattern_exclude)
else:
self.pattern_exclude = None
except ConfigParser.NoOptionError, e:
self.pattern_exclude = ''
self.pattern_exclude = None

def parse_cli_args(self):
''' Command line argument processing '''
Expand Down

0 comments on commit 9edf3a7

Please sign in to comment.