]> arthur.barton.de Git - netdata.git/commitdiff
Merge pull request #689 from paulfantom/master
authorCosta Tsaousis <costa@tsaousis.gr>
Thu, 14 Jul 2016 11:11:25 +0000 (14:11 +0300)
committerGitHub <noreply@github.com>
Thu, 14 Jul 2016 11:11:25 +0000 (14:11 +0300)
Fix `solve the mutual exclusion issue in python.d.plugin`

plugins.d/python.d.plugin

index f5738e6e3257e09b694f2ea1205d3c5b6a0e1ea9..74e19063a87a0ff13ee5e8e10393beebe73175ce 100755 (executable)
@@ -285,11 +285,13 @@ class PythonCharts(object):
         prefix = job.__module__
         if job.name is not None and len(job.name) != 0:
             prefix += "/" + job.name
-        prefix += ": "
         try:
             self.jobs.remove(job)
+            msg.info("Disabled", prefix)
         except Exception as e:
             msg.debug("This shouldn't happen. NO " + prefix + " IN LIST:" + str(self.jobs))
+
+        prefix += ": "
         if reason is None:
             return
         elif reason[:3] == "no ":
@@ -328,14 +330,14 @@ class PythonCharts(object):
                     i += 1
                     try:
                         if job.override_name is not None:
-                            tmp = job.name
-                            job.name = job.override_name
-                            msg.debug(job.chart_name + " changing chart name to: " + job.__module__ + '_' + job.name)
-                            job.chart_name = job.__module__ + '_' + job.name
-                            if job.chart_name in overridden:
+                            new_name = job.__module__ + '_' + job.override_name
+                            if new_name in overridden:
+                                msg.error(job.chart_name + " already exists. Stopping '" + job.name + "'")
                                 self._stop(job)
-                                msg.error(job.chart_name + " already exists. Created with '" + tmp + "'")
                             else:
+                                job.name = job.override_name
+                                msg.debug(job.chart_name + " changing chart name to: '" + new_name + "'")
+                                job.chart_name = new_name
                                 overridden.append(job.chart_name)
                     except Exception:
                         pass