Module: check_mk
Branch: master
Commit: d38de7f7ed00dbf1d6747aeff70c30bbb95e8e3b
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d38de7f7ed00db…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Apr 9 17:16:07 2019 +0200
Do not create discovered label files with empty dicts
Change-Id: I066e2df9ce66bd9b2fcb22ff33ed7fde15e11d60
---
cmk_base/discovered_host_labels.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/cmk_base/discovered_host_labels.py b/cmk_base/discovered_host_labels.py
index e697120..fc35d7a 100644
--- a/cmk_base/discovered_host_labels.py
+++ b/cmk_base/discovered_host_labels.py
@@ -50,8 +50,9 @@ class DiscoveredHostLabelsStore(object):
def save(self, labels):
# type: (Dict) -> None
- if not labels and self.file_path.exists(): # pylint: disable=no-member
- self.file_path.unlink() # pylint: disable=no-member
+ if not labels:
+ if self.file_path.exists():
+ self.file_path.unlink()
return
self.file_path.parent.mkdir(parents=True, exist_ok=True) # pylint:
disable=no-member