]> granicus.if.org Git - icinga2/commitdiff
Cli: Don't run 'agent update-config' if there are uncommitted changes
authorMichael Friedrich <michael.friedrich@netways.de>
Mon, 27 Oct 2014 18:15:34 +0000 (19:15 +0100)
committerMichael Friedrich <michael.friedrich@netways.de>
Mon, 27 Oct 2014 18:15:34 +0000 (19:15 +0100)
refs #7249

lib/cli/agentupdateconfigcommand.cpp

index 5210210a1dd3a582d5ce361a95e2bf945945576c..ca51e2eadfbbcec7ab7f081922bcfd79116cd000 100644 (file)
@@ -57,6 +57,15 @@ ImpersonationLevel AgentUpdateConfigCommand::GetImpersonationLevel(void) const
  */
 int AgentUpdateConfigCommand::Run(const boost::program_options::variables_map& vm, const std::vector<std::string>& ap) const
 {
+       //If there are changes pending, abort the current operation
+       if (RepositoryUtility::ChangeLogHasPendingChanges()) {
+               Log(LogWarning, "cli")
+                   << "There are pending changes for commit.\n"
+                   << "Please review and commit them using 'icinga2 repository commit [--simulate]\n"
+                   << "or drop them using 'icinga2 repository commit --clear' before proceeding.";
+               return 1;
+       }
+
        Log(LogInformation, "cli")
            << "Updating agent configuration for ";