Merge "agent: use any to filter source objects"

This commit is contained in:
Zuul 2018-09-14 09:06:33 +00:00 committed by Gerrit Code Review
commit 27f6c3532e
1 changed files with 3 additions and 3 deletions

View File

@ -91,13 +91,13 @@ class Source(object):
if not data:
raise SourceException('No %s specified' % d_type, self.cfg)
if ([x for x in data if x[0] not in '!*'] and
[x for x in data if x[0] == '!']):
if (any(x for x in data if x[0] not in '!*') and
any(x for x in data if x[0] == '!')):
raise SourceException(
'Both included and excluded %s specified' % d_type,
self.cfg)
if '*' in data and [x for x in data if x[0] not in '!*']:
if '*' in data and any(x for x in data if x[0] not in '!*'):
raise SourceException(
'Included %s specified with wildcard' % d_type,
self.cfg)