From: Michael Friedrich Date: Mon, 27 Oct 2014 18:15:34 +0000 (+0100) Subject: Cli: Don't run 'agent update-config' if there are uncommitted changes X-Git-Tag: v2.2.0~238 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=034cd9c140195fca3099f9785ef6a14d3c04474d;p=icinga2 Cli: Don't run 'agent update-config' if there are uncommitted changes refs #7249 --- 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 ";