mirror of https://github.com/Icinga/icinga2.git
Only remove directories if they exist during sync
This commit is contained in:
parent
4e9439f2d8
commit
83c11962b2
|
@ -310,7 +310,10 @@ Value ApiListener::ConfigUpdateHandler(const MessageOrigin::Ptr& origin, const D
|
||||||
* runtime production config and newly received configuration.
|
* runtime production config and newly received configuration.
|
||||||
*/
|
*/
|
||||||
String apiZonesStageDir = GetApiZonesStageDir();
|
String apiZonesStageDir = GetApiZonesStageDir();
|
||||||
|
|
||||||
|
if (Utility::PathExists(apiZonesStageDir))
|
||||||
Utility::RemoveDirRecursive(apiZonesStageDir);
|
Utility::RemoveDirRecursive(apiZonesStageDir);
|
||||||
|
|
||||||
Utility::MkDirP(apiZonesStageDir, 0700);
|
Utility::MkDirP(apiZonesStageDir, 0700);
|
||||||
|
|
||||||
ObjectLock olock(updateV1);
|
ObjectLock olock(updateV1);
|
||||||
|
@ -388,7 +391,9 @@ void ApiListener::TryActivateZonesStageCallback(const ProcessResult& pr,
|
||||||
String apiZonesDir = GetApiZonesDir();
|
String apiZonesDir = GetApiZonesDir();
|
||||||
|
|
||||||
/* Purge production before copying stage. */
|
/* Purge production before copying stage. */
|
||||||
|
if (Utility::PathExists(apiZonesDir))
|
||||||
Utility::RemoveDirRecursive(apiZonesDir);
|
Utility::RemoveDirRecursive(apiZonesDir);
|
||||||
|
|
||||||
Utility::MkDirP(apiZonesDir, 0700);
|
Utility::MkDirP(apiZonesDir, 0700);
|
||||||
|
|
||||||
/* Copy all synced configuration files from stage to production. */
|
/* Copy all synced configuration files from stage to production. */
|
||||||
|
|
Loading…
Reference in New Issue