IcingaConfig: remove magic_apply_for
This has always been and experimental feature, deprecated since v1.7.0 fixes #1851
This commit is contained in:
parent
6ef8d98594
commit
e2696fd75a
|
@ -168,16 +168,6 @@ class HostController extends ObjectController
|
||||||
$content->add($table);
|
$content->add($table);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($applied = $host->vars()->get($db->settings()->magic_apply_for)) {
|
|
||||||
if ($applied instanceof CustomVariableDictionary) {
|
|
||||||
$table = IcingaHostAppliedForServiceTable::load($host, $applied)
|
|
||||||
->setTitle($this->translate('Generated from host vars'));
|
|
||||||
if (count($table)) {
|
|
||||||
$content->add($table);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @var IcingaHost[] $parents */
|
/** @var IcingaHost[] $parents */
|
||||||
$parents = IcingaTemplateRepository::instanceByObject($this->object)
|
$parents = IcingaTemplateRepository::instanceByObject($this->object)
|
||||||
->getTemplatesFor($this->object, true);
|
->getTemplatesFor($this->object, true);
|
||||||
|
@ -246,19 +236,6 @@ 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 instanceof CustomVariableDictionary) {
|
|
||||||
$table = IcingaHostAppliedForServiceTable::load($host, $applied)
|
|
||||||
->setReadonly()
|
|
||||||
->highlightService($service)
|
|
||||||
->setTitle($this->translate('Generated from host vars'));
|
|
||||||
if (count($table)) {
|
|
||||||
$content->add($table);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @var IcingaHost[] $parents */
|
/** @var IcingaHost[] $parents */
|
||||||
$parents = IcingaTemplateRepository::instanceByObject($this->object)
|
$parents = IcingaTemplateRepository::instanceByObject($this->object)
|
||||||
->getTemplatesFor($this->object, true);
|
->getTemplatesFor($this->object, true);
|
||||||
|
|
|
@ -67,6 +67,7 @@ next (will be 1.8.0)
|
||||||
|
|
||||||
### Icinga Configuration
|
### Icinga Configuration
|
||||||
* FIX: Correctly render Service Dependencies with Array-style parent hosts (#2088)
|
* FIX: Correctly render Service Dependencies with Array-style parent hosts (#2088)
|
||||||
|
* REMOVED: magic-apply-for (a hidden deprecated feature) has been removed (#1851)
|
||||||
|
|
||||||
### Icinga Agent handling
|
### Icinga Agent handling
|
||||||
* FIX: Linux Agent installer now fails when unable to retrieve a certificate
|
* FIX: Linux Agent installer now fails when unable to retrieve a certificate
|
||||||
|
|
|
@ -509,7 +509,6 @@ 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() /* @deprecated Will be removed in 1.8.0 - #1850 #1851 */
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -575,78 +574,6 @@ if (! globals.contains(DirectorOverrideTemplate)) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Will be removed in 1.8.0 - #1850 #1851
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
protected function renderMagicApplyFor()
|
|
||||||
{
|
|
||||||
if (! $this->usesMagicApplyFor()) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
$varname = $this->getMagicApplyVarName();
|
|
||||||
|
|
||||||
return sprintf(
|
|
||||||
'
|
|
||||||
/* 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"]) {
|
|
||||||
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]
|
|
||||||
|
|
||||||
if (typeof(params["templates"]) in [Array, String]) {
|
|
||||||
for (tpl in params["templates"]) {
|
|
||||||
import tpl
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
import title
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof(params.vars) == Dictionary) {
|
|
||||||
vars += params.vars
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof(params["host_name"]) == String) {
|
|
||||||
host_name = params["host_name"]
|
|
||||||
}
|
|
||||||
|
|
||||||
import DirectorOverrideTemplate
|
|
||||||
}
|
|
||||||
',
|
|
||||||
$varname,
|
|
||||||
$varname
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Will be removed in 1.8.0 - #1850 #1851
|
|
||||||
* @return mixed|null
|
|
||||||
*/
|
|
||||||
protected function getMagicApplyVarName()
|
|
||||||
{
|
|
||||||
return $this->connection->settings()->magic_apply_for;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Will be removed in 1.8.0 - #1850 #1851
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
protected function usesMagicApplyFor()
|
|
||||||
{
|
|
||||||
$db = $this->db;
|
|
||||||
$query = $db->select()->from(
|
|
||||||
array('hv' => 'icinga_host_var'),
|
|
||||||
array('c' => 'COUNT(*)')
|
|
||||||
)->where(
|
|
||||||
'hv.varname = ?',
|
|
||||||
$this->getMagicApplyVarName()
|
|
||||||
);
|
|
||||||
|
|
||||||
return $db->fetchOne($query);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $checksum
|
* @param string $checksum
|
||||||
*
|
*
|
||||||
|
|
|
@ -13,8 +13,6 @@ class Settings
|
||||||
protected $defaults = [
|
protected $defaults = [
|
||||||
'default_global_zone' => 'director-global',
|
'default_global_zone' => 'director-global',
|
||||||
'icinga_package_name' => 'director',
|
'icinga_package_name' => 'director',
|
||||||
/* @deprecated to be removed in 1.8.0 #1850 #1851 */
|
|
||||||
'magic_apply_for' => '_director_apply_for',
|
|
||||||
'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)',
|
||||||
|
|
Loading…
Reference in New Issue