mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-09-25 10:57:41 +02:00
IcingaConfig: store config file relations in a...
...transaction: all or nothing fixes #2351
This commit is contained in:
parent
fed74eb33d
commit
eee4f7cf55
@ -48,6 +48,9 @@ next patch release (will be 1.8.1)
|
|||||||
* FIX: don't fail when showing a Host overriding multiple inherited groups (#2253)
|
* FIX: don't fail when showing a Host overriding multiple inherited groups (#2253)
|
||||||
* FIX: deal with inherited values which are invalid for a select box (#2288)
|
* FIX: deal with inherited values which are invalid for a select box (#2288)
|
||||||
|
|
||||||
|
### Icinga Configuration
|
||||||
|
* FIX: rare race condition, where generated config might miss some files (#2351)
|
||||||
|
|
||||||
### Import and Sync
|
### Import and Sync
|
||||||
* FIX: Purge didn't remove more than 1000 services at once (#2339)
|
* FIX: Purge didn't remove more than 1000 services at once (#2339)
|
||||||
|
|
||||||
|
@ -411,25 +411,31 @@ class IcingaConfig
|
|||||||
}
|
}
|
||||||
|
|
||||||
$activity = $this->dbBin($this->getLastActivityChecksum());
|
$activity = $this->dbBin($this->getLastActivityChecksum());
|
||||||
$this->db->insert(
|
$this->db->beginTransaction();
|
||||||
self::$table,
|
try {
|
||||||
array(
|
$this->db->insert(self::$table, [
|
||||||
'duration' => $this->generationTime,
|
'duration' => $this->generationTime,
|
||||||
'first_activity_checksum' => $activity,
|
'first_activity_checksum' => $activity,
|
||||||
'last_activity_checksum' => $activity,
|
'last_activity_checksum' => $activity,
|
||||||
'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('director_generated_config_file', [
|
||||||
$this->db->insert(
|
|
||||||
'director_generated_config_file',
|
|
||||||
array(
|
|
||||||
'config_checksum' => $this->dbBin($this->getChecksum()),
|
'config_checksum' => $this->dbBin($this->getChecksum()),
|
||||||
'file_checksum' => $this->dbBin($file->getChecksum()),
|
'file_checksum' => $this->dbBin($file->getChecksum()),
|
||||||
'file_path' => $name,
|
'file_path' => $name,
|
||||||
)
|
]);
|
||||||
);
|
}
|
||||||
|
$this->db->commit();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
try {
|
||||||
|
$this->db->rollBack();
|
||||||
|
} catch (\Exception $ignored) {
|
||||||
|
// Well...
|
||||||
|
}
|
||||||
|
|
||||||
|
throw $e;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user