From 7ed05f8b0e7db988d2146a36d609f66a2d5de2b4 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Fri, 14 Sep 2018 08:43:53 +0200 Subject: [PATCH] agent: use any to filter source objects Change-Id: Ic9105eae9fa72ea34ab336ec8439909553fc4d39 --- ceilometer/agent.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ceilometer/agent.py b/ceilometer/agent.py index c5a15fdf71..2b76204667 100644 --- a/ceilometer/agent.py +++ b/ceilometer/agent.py @@ -124,13 +124,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)