pcp
[Top] [All Lists]

pmrep: drop PCP 3.9 compat code

To: pcp developers <pcp@xxxxxxxxxxx>
Subject: pmrep: drop PCP 3.9 compat code
From: Marko Myllynen <myllynen@xxxxxxxxxx>
Date: Mon, 18 Jan 2016 11:26:40 +0200
Delivered-to: pcp@xxxxxxxxxxx
Organization: Red Hat
Reply-to: Marko Myllynen <myllynen@xxxxxxxxxx>
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0
Let's start dropping pmrep compatibility code as agreed earlier.

pmrep: drop PCP 3.9 compat code

---
 src/pmrep/pmrep.py | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/pmrep/pmrep.py b/src/pmrep/pmrep.py
index 8d3b8fd..40b3eec 100644
--- a/src/pmrep/pmrep.py
+++ b/src/pmrep/pmrep.py
@@ -1,6 +1,6 @@
 #!/usr/bin/pcp python
 #
-# Copyright (C) 2015 Marko Myllynen <myllynen@xxxxxxxxxx>
+# Copyright (C) 2015-2016 Marko Myllynen <myllynen@xxxxxxxxxx>
 #
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by the
@@ -211,7 +211,6 @@ class PMReporter(object):
         self.count_scale = None
         self.space_scale = None
         self.time_scale = None
-        self.can_scale = None # PCP 3.9 compat
 
         # Performance metrics store
         # key - metric name
@@ -619,8 +618,6 @@ class PMReporter(object):
             else:
                 self.zabbix_interval = int(self.interval)
 
-        self.can_scale = "pmParseUnitsStr" in dir(self.context)
-
     def validate_metrics(self):
         """ Validate the metrics set """
         # Check the metrics against PMNS, resolve non-leaf metrics
@@ -724,7 +721,7 @@ class PMReporter(object):
                     self.metrics[metric][2] = unitstr
             # Set unit/scale for non-raw numeric metrics
             try:
-                if self.metrics[metric][3] == 0 and self.can_scale and \
+                if self.metrics[metric][3] == 0 and \
                    self.descs[i].contents.type != PM_TYPE_STRING:
                     (unitstr, mult) = 
self.context.pmParseUnitsStr(self.metrics[metric][2])
                     label = self.metrics[metric][2]
@@ -925,15 +922,14 @@ class PMReporter(object):
                         vtype)
 
                     if self.metrics[metric][3] != 1 and rescale and \
-                       self.descs[i].contents.type != PM_TYPE_STRING and \
-                       self.can_scale:
+                       self.descs[i].contents.type != PM_TYPE_STRING:
                         atom = self.context.pmConvScale(
                             vtype,
                             atom, self.descs, i,
                             self.metrics[metric][2][1])
 
                     val = atom.dref(vtype)
-                    if rescale and self.can_scale and \
+                    if rescale and \
                        self.descs[i].contents.type != PM_TYPE_STRING:
                         val *= self.metrics[metric][2][2]
                         val = int(val) if val == int(val) else val

Thanks,

-- 
Marko Myllynen

<Prev in Thread] Current Thread [Next in Thread>
  • pmrep: drop PCP 3.9 compat code, Marko Myllynen <=