Skip to content

Commit

Permalink
fix: VM state indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
bencromwell committed Feb 9, 2024
1 parent 559452e commit ea30a7f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
4 changes: 1 addition & 3 deletions lib/KatapultWhmcs.php
Original file line number Diff line number Diff line change
Expand Up @@ -455,10 +455,8 @@ public static function runModuleCommandOnVm(
}

return 'success';
} catch (ClientException $e) {
return $formatErrorResponse(implode(', ', KatapultApiV1Helper::humaniseHttpError($e)));
} catch (\Throwable $e) {
return $formatErrorResponse($e->getMessage());
return katapultFormatError('Run command', $e);
}
}
}
5 changes: 1 addition & 4 deletions lib/WHMCS/Service/VirtualMachine.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,7 @@ public function getVmAttribute(): ?KatapultVirtualMachine
public function getVmStateAttribute(): string
{
if ($this->vm) {
return match ($this->vm->getState()) {
VirtualMachineStateEnum::Started, VirtualMachineStateEnum::Stopped => $this->vm->getState(),
default => self::STATE_UNKNOWN,
};
return $this->vm->getState();
}

if ($this->vm_build_id && !$this->vm_id) {
Expand Down

0 comments on commit ea30a7f

Please sign in to comment.