]> granicus.if.org Git - icinga2/commitdiff
Ensure directory paths are created from stage -> prod
authorMichael Friedrich <michael.friedrich@icinga.com>
Thu, 27 Sep 2018 16:31:08 +0000 (18:31 +0200)
committerMichael Friedrich <michael.friedrich@icinga.com>
Wed, 19 Jun 2019 12:46:11 +0000 (14:46 +0200)
lib/remote/apilistener-filesync.cpp

index f1d5902939e5fb396f5263b83b653ec989355dad..1ae461d747fa3f83d65cedaac43a24b4a0898e2f 100644 (file)
@@ -369,7 +369,12 @@ void ApiListener::TryActivateZonesStageCallback(const ProcessResult& pr,
                        Log(LogCritical, "ApiListener")
                                << "Copying file '" << path << "' from config sync staging to production directory.";
 
-                       Utility::CopyFile(GetApiZonesStageDir() + path, GetApiZonesDir() + path);
+                       String stagePath = GetApiZonesStageDir() + path;
+                       String currentPath = GetApiZonesDir() + path;
+
+                       Utility::MkDirP(Utility::DirName(currentPath), 0755);
+
+                       Utility::CopyFile(stagePath, currentPath);
                }
 
                if (reload)