Skip to content

Commit

Permalink
IcingaConfig: render IfW fallback template
Browse files Browse the repository at this point in the history
fixes #2776
  • Loading branch information
Thomas-Gelf committed Jul 19, 2023
1 parent 91b99d8 commit de13119
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/82-Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ This version hasn't been released yet
* FIX: Service Sets can now be searched by Service name in branches too (#2738)

### Icinga Configuration
* FEATURE: render fallback template for IfW 1.11 for Icinga < 2.14 (#2776)
* FIX: render Set Services to individual zones where required (#1589, #2356)

### Import and Sync
Expand Down
15 changes: 15 additions & 0 deletions library/Director/IcingaConfig/IcingaConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,7 @@ protected function prepareGlobalBasics()
"\nconst DirectorStageDir = dirname(dirname(current_filename))\n"
. $this->renderFlappingLogHelper()
. $this->renderHostOverridableVars()
. $this->renderIfwFallbackTemplate()
);

return $this;
Expand Down Expand Up @@ -566,6 +567,20 @@ protected function renderHostOverridableVars()
);
}


protected function renderIfwFallbackTemplate(): string
{
return '
// Make sure config validates for Icinga < 2.14 with IfW 1.11 configuration. This might look weird,
// but is intentional. get_object() does\'t work as expected at parse time.
if (! globals.System || ! System.get_template || ! get_template(CheckCommand, "ifw-api-check-command")) {
object CheckCommand "ifw-api" {
import "plugin-check-command"
}
}
';
}

/**
* @param string $checksum
*
Expand Down

0 comments on commit de13119

Please sign in to comment.