IcingaConfig: Deprecate magic_apply_for as config feature

fixes #1850
This commit is contained in:
Markus Frosch 2019-04-30 12:30:55 +02:00
parent baa3ae248f
commit 92f2f9f44d
3 changed files with 18 additions and 3 deletions

View File

@ -221,6 +221,7 @@ class HostController extends ObjectController
$content->add($table); $content->add($table);
} }
/* @deprecated to be removed in 1.8.0 #1850 #1851 */
if ($applied = $host->vars()->get($db->settings()->magic_apply_for)) { if ($applied = $host->vars()->get($db->settings()->magic_apply_for)) {
if ($applied instanceof CustomVariableDictionary) { if ($applied instanceof CustomVariableDictionary) {
$table = IcingaHostAppliedForServiceTable::load($host, $applied) $table = IcingaHostAppliedForServiceTable::load($host, $applied)

View File

@ -509,7 +509,7 @@ class IcingaConfig
"\nconst DirectorStageDir = dirname(dirname(current_filename))\n" "\nconst DirectorStageDir = dirname(dirname(current_filename))\n"
. $this->renderFlappingLogHelper() . $this->renderFlappingLogHelper()
. $this->renderHostOverridableVars() . $this->renderHostOverridableVars()
. $this->renderMagicApplyFor() . $this->renderMagicApplyFor() /* @deprecated Will be removed in 1.8.0 - #1850 #1851 */
); );
return $this; return $this;
@ -575,6 +575,10 @@ if (! globals.contains(DirectorOverrideTemplate)) {
); );
} }
/**
* @deprecated Will be removed in 1.8.0 - #1850 #1851
* @return string
*/
protected function renderMagicApplyFor() protected function renderMagicApplyFor()
{ {
if (! $this->usesMagicApplyFor()) { if (! $this->usesMagicApplyFor()) {
@ -585,8 +589,10 @@ if (! globals.contains(DirectorOverrideTemplate)) {
return sprintf( return sprintf(
' '
/* Warning: this is experimental and might be removed */ /* DEPRECATED: This feature always was experimental and will be removed in 1.8.0 (see issue #1850 #1851) */
apply Service for (title => params in host.vars["%s"]) { apply Service for (title => params in host.vars["%s"]) {
log(LogWarning, "config", "Director: Magic Apply For was used on Host \"" +
host.name + "\", it is now deprecated and will be removed in Director 1.8.0 (see issue #1850 #1851)")
var override = host.vars["%s_vars"][title] var override = host.vars["%s_vars"][title]
@ -614,11 +620,19 @@ apply Service for (title => params in host.vars["%s"]) {
); );
} }
/**
* @deprecated Will be removed in 1.8.0 - #1850 #1851
* @return mixed|null
*/
protected function getMagicApplyVarName() protected function getMagicApplyVarName()
{ {
return $this->connection->settings()->magic_apply_for; return $this->connection->settings()->magic_apply_for;
} }
/**
* @deprecated Will be removed in 1.8.0 - #1850 #1851
* @return string
*/
protected function usesMagicApplyFor() protected function usesMagicApplyFor()
{ {
$db = $this->db; $db = $this->db;

View File

@ -13,7 +13,7 @@ class Settings
protected $defaults = [ protected $defaults = [
'default_global_zone' => 'director-global', 'default_global_zone' => 'director-global',
'icinga_package_name' => 'director', 'icinga_package_name' => 'director',
'magic_apply_for' => '_director_apply_for', 'magic_apply_for' => '_director_apply_for', /* @deprecated to be removed in 1.8.0 #1850 #1851 */
'config_format' => 'v2', 'config_format' => 'v2',
'override_services_varname' => '_override_servicevars', 'override_services_varname' => '_override_servicevars',
'override_services_templatename' => 'host var overrides (Director)', 'override_services_templatename' => 'host var overrides (Director)',