IcingaObjectInspection: Properly read and handle config_checksum

This adapts behavior from DeploymentLogTable

fixes #1420
This commit is contained in:
Markus Frosch 2018-03-11 13:49:59 +01:00 committed by Thomas Gelf
parent 034319dbe7
commit 1e7f0f962b
3 changed files with 13 additions and 6 deletions

View File

@ -42,4 +42,14 @@ trait DbHelper
return $value; return $value;
} }
public function getChecksum($checksum)
{
return bin2hex($this->wantBinaryValue($checksum));
}
public function getShortChecksum($checksum)
{
return substr($this->getChecksum($checksum), 0, 7);
}
} }

View File

@ -39,11 +39,6 @@ class DeploymentLogTable extends ZfQueryBasedTable
return $tr; return $tr;
} }
protected function getShortChecksum($checksum)
{
return substr(bin2hex($this->wantBinaryValue($checksum)), 0, 7);
}
protected function getMyRowClasses($row) protected function getMyRowClasses($row)
{ {
if ($row->startup_succeeded === 'y') { if ($row->startup_succeeded === 'y') {

View File

@ -10,10 +10,12 @@ use dipl\Web\Widget\NameValueTable;
use Icinga\Date\DateFormatter; use Icinga\Date\DateFormatter;
use Icinga\Module\Director\Db; use Icinga\Module\Director\Db;
use Icinga\Module\Director\PlainObjectRenderer; use Icinga\Module\Director\PlainObjectRenderer;
use Icinga\Module\Director\Web\Table\DbHelper;
use stdClass; use stdClass;
class IcingaObjectInspection extends BaseElement class IcingaObjectInspection extends BaseElement
{ {
use DbHelper;
use TranslationHelper; use TranslationHelper;
protected $tag = 'div'; protected $tag = 'div';
@ -193,7 +195,7 @@ class IcingaObjectInspection extends BaseElement
sprintf('%s:%s', $filename, $source->first_line), sprintf('%s:%s', $filename, $source->first_line),
'director/config/file', 'director/config/file',
[ [
'config_checksum' => bin2hex($deployment->config_checksum), 'config_checksum' => $this->getChecksum($deployment->config_checksum),
'deployment_id' => $deployment->id, 'deployment_id' => $deployment->id,
'backTo' => 'deployment', 'backTo' => 'deployment',
'file_path' => $filename, 'file_path' => $filename,