Module: check_mk
Branch: master
Commit: eadbfb4c0fe4e58bd788d6384a0eb39d70c8d833
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=eadbfb4c0fe4e5…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Sun May 5 13:22:53 2019 +0200
Better use precomputed tags from HostConfig object
Change-Id: I7646c5488b54e9f4d928f585d7c3bb9c13d48e78
---
cmk_base/core_config.py | 2 +-
cmk_base/dump_host.py | 4 +---
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/cmk_base/core_config.py b/cmk_base/core_config.py
index ec5d159..48883f4 100644
--- a/cmk_base/core_config.py
+++ b/cmk_base/core_config.py
@@ -375,7 +375,7 @@ def get_host_attributes(hostname, config_cache):
# "__TAG_" instead. We may deprecate this is one day.
attrs["_TAGS"] = "
".join(sorted(config_cache.get_host_config(hostname).tags))
- attrs.update(_get_tag_attributes(config_cache.tags_of_host(hostname),
"TAG"))
+ attrs.update(_get_tag_attributes(host_config.tag_groups, "TAG"))
attrs.update(_get_tag_attributes(host_config.labels, "LABEL"))
attrs.update(_get_tag_attributes(host_config.label_sources,
"LABELSOURCE"))
diff --git a/cmk_base/dump_host.py b/cmk_base/dump_host.py
index 342cb69..73606e8 100644
--- a/cmk_base/dump_host.py
+++ b/cmk_base/dump_host.py
@@ -77,9 +77,7 @@ def dump_host(hostname):
(addresses if addresses is not None else "No IP") +
"\n")
tag_template = tty.bold + "[" + tty.normal + "%s" + tty.bold +
"]" + tty.normal
- tags = [
- (tag_template % ":".join(t)) for t in
sorted(config_cache.tags_of_host(hostname).items())
- ]
+ tags = [(tag_template % ":".join(t)) for t in
sorted(host_config.tag_groups.items())]
console.output(tty.yellow + "Tags: " + tty.normal +
", ".join(tags) + "\n")
# TODO: Clean this up once cluster parent handling has been moved to HostConfig
if host_config.is_cluster: