From: Marcin Haba Date: Tue, 3 Dec 2019 04:52:58 +0000 (+0100) Subject: baculum: Fix PHP error on storage view page with autochanger comming from host differ... X-Git-Tag: Release-9.6.0~58 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=521ffbd89319665090aa3c9572e1f00f31a4ed9a;p=thirdparty%2Fbacula.git baculum: Fix PHP error on storage view page with autochanger comming from host different than main (reported by Jose Alberto) --- diff --git a/gui/baculum/protected/Web/Pages/StorageView.php b/gui/baculum/protected/Web/Pages/StorageView.php index c6d3f4c93..3ae56d85f 100644 --- a/gui/baculum/protected/Web/Pages/StorageView.php +++ b/gui/baculum/protected/Web/Pages/StorageView.php @@ -90,6 +90,15 @@ class StorageView extends BaculumWebPage { public function setDevices() { $devices = array(); if ($this->getIsAutochanger() && !empty($_SESSION['sd'])) { + /** + * NOTE: Here is called only Main API host. For storage daemons + * on other hosts it can cause a problem. So far, there + * is no 100% way to unambiguously determine basing on storage daemon + * configuration if autochanger comes from Main or from other API host. + * The problem will be if on Main host is defined autochanger + * with the same name as autochanger from requested Storage here. + * @TODO: Find a way to solve it. + */ $result = $this->Application->getModule('api')->get( array( 'config', @@ -98,7 +107,7 @@ class StorageView extends BaculumWebPage { $this->getDeviceName() ) ); - if ($result->error === 0) { + if ($result->error === 0 && is_object($result->output)) { $devices = $result->output->Device; } } else {