pcp
[Top] [All Lists]

pmfg: ignore target with local context

To: pcp developers <pcp@xxxxxxxxxxx>
Subject: pmfg: ignore target with local context
From: Marko Myllynen <myllynen@xxxxxxxxxx>
Date: Wed, 20 Jul 2016 19:30:58 +0300
Delivered-to: pcp@xxxxxxxxxxx
Organization: Red Hat
Reply-to: Marko Myllynen <myllynen@xxxxxxxxxx>
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2
Hi,

When calling pmNewContext(3) with type PM_CONTEXT_LOCAL, name is
ignored. Allow clients using pmapi.py / pmfg to pass None as well.

---
 src/python/pcp/pmapi.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/python/pcp/pmapi.py b/src/python/pcp/pmapi.py
index e4ba79a..e696330 100644
--- a/src/python/pcp/pmapi.py
+++ b/src/python/pcp/pmapi.py
@@ -2304,6 +2304,8 @@ class fetchgroup(object):
 
         self.pmfg = c_void_p()
         self.items = []
+        if typed == c_api.PM_CONTEXT_LOCAL and target = None:
+            target = "" # Ignored
         sts = LIBPCP.pmCreateFetchGroup(byref(self.pmfg), typed, 
target.encode('utf-8'))
         if sts < 0:
             raise pmErr(sts)

Thanks,

-- 
Marko Myllynen

<Prev in Thread] Current Thread [Next in Thread>
  • pmfg: ignore target with local context, Marko Myllynen <=