diff --git a/ceilometer/alarm/evaluator/gnocchi.py b/ceilometer/alarm/evaluator/gnocchi.py index 54c9963d..0627c0bd 100644 --- a/ceilometer/alarm/evaluator/gnocchi.py +++ b/ceilometer/alarm/evaluator/gnocchi.py @@ -109,7 +109,7 @@ class GnocchiThresholdEvaluator(evaluator.Evaluator): except Exception: LOG.exception(_('alarm stats retrieval failed')) return [] - if int(r.status_code / 100) != 2: + if r.status_code // 100 != 2: LOG.exception(_('alarm stats retrieval failed: %s') % r.text) return [] else: diff --git a/ceilometer/dispatcher/gnocchi.py b/ceilometer/dispatcher/gnocchi.py index 4a7fe42b..e6d450e3 100644 --- a/ceilometer/dispatcher/gnocchi.py +++ b/ceilometer/dispatcher/gnocchi.py @@ -419,7 +419,7 @@ class GnocchiDispatcher(dispatcher.Base): 'resource_id': resource_id, 'status_code': r.status_code}) raise NoSuchMetric - elif int(r.status_code / 100) != 2: + elif r.status_code // 100 != 2: raise UnexpectedWorkflowError( _("Fail to post measure on metric %(metric_name)s of " "resource %(resource_id)s with status: " @@ -442,7 +442,7 @@ class GnocchiDispatcher(dispatcher.Base): LOG.debug("Resource %s already exists", resource_id) raise ResourceAlreadyExists - elif int(r.status_code / 100) != 2: + elif r.status_code // 100 != 2: raise UnexpectedWorkflowError( _("Resource %(resource_id)s creation failed with " "status: %(status_code)d: %(msg)s") % @@ -460,7 +460,7 @@ class GnocchiDispatcher(dispatcher.Base): headers=self._get_headers(), data=json.dumps(resource_attributes)) - if int(r.status_code / 100) != 2: + if r.status_code // 100 != 2: raise UnexpectedWorkflowError( _("Resource %(resource_id)s update failed with " "status: %(status_code)d: %(msg)s") % @@ -483,7 +483,7 @@ class GnocchiDispatcher(dispatcher.Base): metric_name, resource_id) raise MetricAlreadyExists - elif int(r.status_code / 100) != 2: + elif r.status_code // 100 != 2: raise UnexpectedWorkflowError( _("Fail to create metric %(metric_name)s of " "resource %(resource_id)s with status: " diff --git a/ceilometer/network/statistics/opendaylight/client.py b/ceilometer/network/statistics/opendaylight/client.py index 24e6be69..4c48d944 100644 --- a/ceilometer/network/statistics/opendaylight/client.py +++ b/ceilometer/network/statistics/opendaylight/client.py @@ -227,7 +227,7 @@ class Client(object): resp = requests.get(url, **self._req_params) if CONF.debug: self._log_res(resp) - if resp.status_code / 100 != 2: + if resp.status_code // 100 != 2: raise OpenDaylightRESTAPIFailed( _('OpenDaylitght API returned %(status)s %(reason)s') % {'status': resp.status_code, 'reason': resp.reason})