IcingaConfig: cleanup, hardcode director-global
This commit is contained in:
parent
ac622ac7f0
commit
029ee84d33
|
@ -175,6 +175,7 @@ class IcingaConfig
|
||||||
->where('checksum IN (?)', array_map(array($this, 'dbBin'), $this->getFilesChecksums()));
|
->where('checksum IN (?)', array_map(array($this, 'dbBin'), $this->getFilesChecksums()));
|
||||||
|
|
||||||
$existing = $this->db->fetchCol($existingQuery);
|
$existing = $this->db->fetchCol($existingQuery);
|
||||||
|
|
||||||
foreach ($existing as $key => $val) {
|
foreach ($existing as $key => $val) {
|
||||||
if (is_resource($val)) {
|
if (is_resource($val)) {
|
||||||
$existing[$key] = stream_get_contents($val);
|
$existing[$key] = stream_get_contents($val);
|
||||||
|
@ -189,6 +190,7 @@ class IcingaConfig
|
||||||
if (! in_array($checksum, $missing)) {
|
if (! in_array($checksum, $missing)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->insert(
|
$this->db->insert(
|
||||||
$fileTable,
|
$fileTable,
|
||||||
array(
|
array(
|
||||||
|
@ -206,7 +208,6 @@ class IcingaConfig
|
||||||
'checksum' => $this->dbBin($this->getChecksum()),
|
'checksum' => $this->dbBin($this->getChecksum()),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
/** @var IcingaConfigFile $file */
|
/** @var IcingaConfigFile $file */
|
||||||
foreach ($this->files as $name => $file) {
|
foreach ($this->files as $name => $file) {
|
||||||
$this->db->insert(
|
$this->db->insert(
|
||||||
|
@ -235,6 +236,8 @@ throw $e;
|
||||||
|
|
||||||
$this->configFile('conf.d/001-director-basics.conf')->prepend(
|
$this->configFile('conf.d/001-director-basics.conf')->prepend(
|
||||||
"\nconst DirectorStageDir = dirname(dirname(current_filename))\n"
|
"\nconst DirectorStageDir = dirname(dirname(current_filename))\n"
|
||||||
|
. "\nobject Zone \"director-global\" {\n global = true\n}\n"
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$this
|
$this
|
||||||
|
@ -302,6 +305,7 @@ throw $e;
|
||||||
{
|
{
|
||||||
$class = 'Icinga\\Module\\Director\\Objects\\Icinga' . ucfirst($type);
|
$class = 'Icinga\\Module\\Director\\Objects\\Icinga' . ucfirst($type);
|
||||||
$objects = $class::loadAll($this->connection);
|
$objects = $class::loadAll($this->connection);
|
||||||
|
if (empty($objects)) return $this;
|
||||||
$ourGlobalZone = 'director-global';
|
$ourGlobalZone = 'director-global';
|
||||||
$file = null;
|
$file = null;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue