mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #8580 from mpeters/ec2_inv_empty_patterns
Handle the case where include_pattern and exclude_pattern exist but are empty strings
This commit is contained in:
commit
9edf3a749a
1 changed files with 5 additions and 1 deletions
|
@ -257,6 +257,8 @@ class Ec2Inventory(object):
|
||||||
pattern_include = config.get('ec2', 'pattern_include')
|
pattern_include = config.get('ec2', 'pattern_include')
|
||||||
if pattern_include and len(pattern_include) > 0:
|
if pattern_include and len(pattern_include) > 0:
|
||||||
self.pattern_include = re.compile(pattern_include)
|
self.pattern_include = re.compile(pattern_include)
|
||||||
|
else:
|
||||||
|
self.pattern_include = None
|
||||||
except ConfigParser.NoOptionError, e:
|
except ConfigParser.NoOptionError, e:
|
||||||
self.pattern_include = None
|
self.pattern_include = None
|
||||||
|
|
||||||
|
@ -265,8 +267,10 @@ class Ec2Inventory(object):
|
||||||
pattern_exclude = config.get('ec2', 'pattern_exclude');
|
pattern_exclude = config.get('ec2', 'pattern_exclude');
|
||||||
if pattern_exclude and len(pattern_exclude) > 0:
|
if pattern_exclude and len(pattern_exclude) > 0:
|
||||||
self.pattern_exclude = re.compile(pattern_exclude)
|
self.pattern_exclude = re.compile(pattern_exclude)
|
||||||
|
else:
|
||||||
|
self.pattern_exclude = None
|
||||||
except ConfigParser.NoOptionError, e:
|
except ConfigParser.NoOptionError, e:
|
||||||
self.pattern_exclude = ''
|
self.pattern_exclude = None
|
||||||
|
|
||||||
def parse_cli_args(self):
|
def parse_cli_args(self):
|
||||||
''' Command line argument processing '''
|
''' Command line argument processing '''
|
||||||
|
|
Loading…
Reference in a new issue