Skip to content

Commit

Permalink
CheckCommand: search for vm object_name too
Browse files Browse the repository at this point in the history
fixes #109
  • Loading branch information
Thomas-Gelf committed Sep 14, 2020
1 parent 48b56e3 commit 238cf4d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
13 changes: 10 additions & 3 deletions application/clicommands/CheckCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Icinga\Module\Vspheredb\Clicommands;

use Icinga\Date\DateFormatter;
use Icinga\Exception\NotFoundError;
use Icinga\Module\Vspheredb\CheckPluginHelper;
use Icinga\Module\Vspheredb\Db;
use Icinga\Module\Vspheredb\DbObject\BaseDbObject;
Expand Down Expand Up @@ -76,9 +77,15 @@ public function vmAction()
{
$this->run(function () {
$db = Db::newConfiguredInstance();
$vm = VirtualMachine::findOneBy([
'guest_host_name' => $this->params->getRequired('name')
], $db);
try {
$vm = VirtualMachine::findOneBy([
'object_name' => $this->params->getRequired('name')
], $db);
} catch (NotFoundError $e) {
$vm = VirtualMachine::findOneBy([
'guest_host_name' => $this->params->getRequired('name')
], $db);
}
$quickStats = VmQuickStats::load($vm->get('uuid'), $db);
$this->checkOverallHealth($vm->object())
->checkRuntimePowerState($vm)
Expand Down
3 changes: 3 additions & 0 deletions doc/84-Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ next (will be 1.2.0)
* FEATURE: overview tree no longer skips some levels (#181)
* FEATURE: support 'compact' mode for dashboard use (#134)

### CLI
* FIX: vm check now also looks for object name (#109)

### Background Daemon
* FIX: do not allow ENV proxy settings to override server config (#159)
* FIX: sync no longer fails on objects with no overallState (#98)
Expand Down

0 comments on commit 238cf4d

Please sign in to comment.