From defbb95855443047c3fb0a90ca4a9c9d1a51180b Mon Sep 17 00:00:00 2001 From: Eoghan Glynn Date: Thu, 27 Mar 2014 10:28:08 +0000 Subject: Ensure statistics aggregates are ordered with parameterized first Fixes bug 1298528 Due to WSME re-ordering of query parameters, in the mixed case any parameterized aggregates must be specified in the URL first, prior to any unparameterized aggregates. Otherwise the aggregate parameter will be associated with the wrong aggregate function. Change-Id: Ib2c76d03a4fc91d13074a03caade2c776d2309b3 --- ceilometerclient/v2/statistics.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'ceilometerclient/v2/statistics.py') diff --git a/ceilometerclient/v2/statistics.py b/ceilometerclient/v2/statistics.py index 689992c..d0b56c9 100644 --- a/ceilometerclient/v2/statistics.py +++ b/ceilometerclient/v2/statistics.py @@ -26,13 +26,19 @@ class StatisticsManager(base.Manager): def _build_aggregates(self, aggregates): url_aggregates = [] for aggregate in aggregates: - url_aggregates.append( - "aggregate.func=%(func)s" % aggregate - ) if 'param' in aggregate: - url_aggregates.append( + url_aggregates.insert( + 0, "aggregate.param=%(param)s" % aggregate ) + url_aggregates.insert( + 0, + "aggregate.func=%(func)s" % aggregate + ) + else: + url_aggregates.append( + "aggregate.func=%(func)s" % aggregate + ) return url_aggregates def list(self, meter_name, q=None, period=None, groupby=[], aggregates=[]): -- cgit v1.2.1