Skip to content

Commit f3314d2

Browse files
mo-kiJenkins
authored andcommitted
base: derive _CUSTOMER from the builtin host label
The `cmk/customer` builtin host label is contributed by the managed-services edition alone, from the same `conf.d/customer.mk` that base reads into `current_customer`. Its presence is therefore an exact stand-in for the edition check, and since builtin labels are merged last in `labels_of_host()` a user label cannot shadow it. This removes one of two reads of `ConfigCache.edition`. Change-Id: I4c67a719dc6e0fa45e24f4da2ec516126cbff123
1 parent b1d21f2 commit f3314d2

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

cmk/base/config/_impl.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
from cmk.piggyback import backend as piggyback_backend
111111
from cmk.ruleset_matcher import matcher as ruleset_matcher
112112
from cmk.ruleset_matcher import tuple_rulesets
113-
from cmk.ruleset_matcher.labels import LabelManager, Labels, LabelSources
113+
from cmk.ruleset_matcher.labels import BuiltinLabelsKey, LabelManager, Labels, LabelSources
114114
from cmk.ruleset_matcher.matcher import (
115115
RulesetMatcher,
116116
RulesetName,
@@ -2715,8 +2715,8 @@ def get_host_attributes(
27152715
if actions := self.icons_and_actions(hostname):
27162716
attrs["_ACTIONS"] = ",".join(actions)
27172717

2718-
if self.edition is cmk_version.Edition.ULTIMATEMT:
2719-
attrs["_CUSTOMER"] = self._loaded_config.current_customer
2718+
if customer := self.label_manager.labels_of_host(hostname).get(BuiltinLabelsKey.CUSTOMER):
2719+
attrs["_CUSTOMER"] = customer
27202720

27212721
return attrs
27222722

0 commit comments

Comments
 (0)