From 034cd9c140195fca3099f9785ef6a14d3c04474d Mon Sep 17 00:00:00 2001 From: Michael Friedrich Date: Mon, 27 Oct 2014 19:15:34 +0100 Subject: [PATCH] Cli: Don't run 'agent update-config' if there are uncommitted changes refs #7249 --- lib/cli/agentupdateconfigcommand.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/cli/agentupdateconfigcommand.cpp b/lib/cli/agentupdateconfigcommand.cpp index 5210210a1..ca51e2ead 100644 --- a/lib/cli/agentupdateconfigcommand.cpp +++ b/lib/cli/agentupdateconfigcommand.cpp @@ -57,6 +57,15 @@ ImpersonationLevel AgentUpdateConfigCommand::GetImpersonationLevel(void) const */ int AgentUpdateConfigCommand::Run(const boost::program_options::variables_map& vm, const std::vector& 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 "; -- 2.40.0