From: Marcin Haba Date: Tue, 1 Aug 2017 17:19:44 +0000 (+0200) Subject: baculum: Fix bconsole connection test in config wizard X-Git-Tag: Release-9.0.3~8 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=bcc929e75e36e0ead88bfb74e147b391d49e0517;p=bacula%2Fbacula baculum: Fix bconsole connection test in config wizard --- diff --git a/gui/baculum/protected/API/Class/Bconsole.php b/gui/baculum/protected/API/Class/Bconsole.php index 4ecdb66cb0..f07990f3ea 100644 --- a/gui/baculum/protected/API/Class/Bconsole.php +++ b/gui/baculum/protected/API/Class/Bconsole.php @@ -51,9 +51,9 @@ class Bconsole extends APIModule { } } - public static function setCmdPath($path) { + public static function setCmdPath($path, $force = false) { // possible to set only once - if (is_null(self::$cmd_path)) { + if (is_null(self::$cmd_path) || $force) { self::$cmd_path = $path; } } @@ -73,9 +73,9 @@ class Bconsole extends APIModule { return self::$cfg_path; } - public function setUseSudo($use_sudo) { + public function setUseSudo($use_sudo, $force) { // possible to set only once - if (is_null($this->use_sudo)) { + if (is_null($this->use_sudo) || $force) { $this->use_sudo = $use_sudo; } } @@ -84,10 +84,10 @@ class Bconsole extends APIModule { return $this->use_sudo; } - private function setEnvironmentParams($cmd_path, $cfg_path, $use_sudo) { - self::setCmdPath($cmd_path); - self::setCfgPath($cfg_path); - $this->setUseSudo($use_sudo); + private function setEnvironmentParams($cmd_path, $cfg_path, $use_sudo, $force = false) { + self::setCmdPath($cmd_path, $force); + self::setCfgPath($cfg_path, $force); + $this->setUseSudo($use_sudo, $force); } private function isCommandValid($command) { @@ -188,7 +188,7 @@ class Bconsole extends APIModule { } public function testBconsoleCommand(array $command, $cmd_path, $cfg_path, $use_sudo) { - $this->setEnvironmentParams($cmd_path, $cfg_path, $use_sudo); + $this->setEnvironmentParams($cmd_path, $cfg_path, $use_sudo, true); $director = ''; $result = null; try {