mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +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: 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
|
||||
* FIX: Purge didn't remove more than 1000 services at once (#2339)
|
||||
|
||||
|
@ -411,25 +411,31 @@ class IcingaConfig
|
||||
}
|
||||
|
||||
$activity = $this->dbBin($this->getLastActivityChecksum());
|
||||
$this->db->insert(
|
||||
self::$table,
|
||||
array(
|
||||
$this->db->beginTransaction();
|
||||
try {
|
||||
$this->db->insert(self::$table, [
|
||||
'duration' => $this->generationTime,
|
||||
'first_activity_checksum' => $activity,
|
||||
'last_activity_checksum' => $activity,
|
||||
'checksum' => $this->dbBin($this->getChecksum()),
|
||||
)
|
||||
);
|
||||
/** @var IcingaConfigFile $file */
|
||||
foreach ($this->files as $name => $file) {
|
||||
$this->db->insert(
|
||||
'director_generated_config_file',
|
||||
array(
|
||||
]);
|
||||
/** @var IcingaConfigFile $file */
|
||||
foreach ($this->files as $name => $file) {
|
||||
$this->db->insert('director_generated_config_file', [
|
||||
'config_checksum' => $this->dbBin($this->getChecksum()),
|
||||
'file_checksum' => $this->dbBin($file->getChecksum()),
|
||||
'file_path' => $name,
|
||||
)
|
||||
);
|
||||
]);
|
||||
}
|
||||
$this->db->commit();
|
||||
} catch (\Exception $e) {
|
||||
try {
|
||||
$this->db->rollBack();
|
||||
} catch (\Exception $ignored) {
|
||||
// Well...
|
||||
}
|
||||
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
Loading…
x
Reference in New Issue
Block a user