Skip to content

Commit

Permalink
Fix host services losing configuration from parent imports when
Browse files Browse the repository at this point in the history
overriding service values
  • Loading branch information
araujorm committed Oct 22, 2021
1 parent 4f95957 commit 2a79b93
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
5 changes: 2 additions & 3 deletions library/Director/CustomVariable/CustomVariables.php
Original file line number Diff line number Diff line change
Expand Up @@ -393,10 +393,9 @@ public function toLegacyConfigString()
protected function renderSingleVar($key, $var, $renderExpressions = false)
{
if ($key === $this->overrideKeyName) {
return c::renderKeyOperatorValue(
return c::renderKeyValue(
$this->renderKeyName($key),
'+=',
$var->toConfigStringPrefetchable($renderExpressions)
'directorMergeOverrideConfig('.$this->renderKeyName($key) . ', ' . $var->toConfigStringPrefetchable($renderExpressions).')'
);
} else {
return c::renderKeyValue(
Expand Down
14 changes: 14 additions & 0 deletions library/Director/IcingaConfig/IcingaConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,20 @@ protected function renderHostOverridableVars()
)
}
}
globals.directorMergeOverrideConfig = function(existing,overrides) {
if (existing) {
for (var service => conf in overrides) {
if (existing[service]) {
existing[service] += conf
} else {
existing[service] = conf
}
}
return existing
} else {
return overrides
}
}
template Service DirectorOverrideTemplate {
/**
Expand Down

0 comments on commit 2a79b93

Please sign in to comment.