From f9eb5ac1a89ad81c1ea5b798e3421d0fe3776cca Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Tue, 14 Feb 2017 14:43:18 +0100 Subject: [PATCH] CLI: don't fail to disable an already disabled module refs #2714 --- application/clicommands/ModuleCommand.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/application/clicommands/ModuleCommand.php b/application/clicommands/ModuleCommand.php index 9b8e3240a..8cc470dad 100644 --- a/application/clicommands/ModuleCommand.php +++ b/application/clicommands/ModuleCommand.php @@ -3,6 +3,8 @@ namespace Icinga\Clicommands; +use Icinga\Application\Logger; +use Icinga\Application\Modules\Manager; use Icinga\Cli\Command; /** @@ -14,6 +16,9 @@ use Icinga\Cli\Command; */ class ModuleCommand extends Command { + /** + * @var Manager + */ protected $modules; public function init() @@ -109,7 +114,12 @@ class ModuleCommand extends Command if (! $module || $this->hasRemainingParams()) { return $this->showUsage(); } - $this->modules->disableModule($module); + + if ($this->modules->hasEnabled($module)) { + $this->modules->disableModule($module); + } else { + Logger::info('Module "%s" is already disabled', $module); + } } /**