Skip to content

Commit

Permalink
Fixes problem with test not passing
Browse files Browse the repository at this point in the history
  • Loading branch information
AnushK-Fro authored Nov 10, 2024
1 parent 3c6200c commit 059a655
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions app/Services/Servers/ServerAuthService.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@ public function updatePassword(Server $server, string $password)
{
try {
$OsInfo = $this->guestAgentRepository->setServer($server)->guestAgentOs();
if (str_contains($OsInfo["result"]["name"], "Windows")) {
$username = "Administrator";
} else {
$username = "root";
if (is_array($OsInfo) && isset($OsInfo["result"]["name"])) {
if (str_contains($OsInfo["result"]["name"], "Windows")) {
$username = "Administrator";
} else {
$username = "root";
}

$this->guestAgentRepository->setServer($server)->updateGuestAgentPassword($username, $password);
}
$this->guestAgentRepository->setServer($server)->updateGuestAgentPassword($username, $password);
$this->configRepository->setServer($server)->update(['cipassword' => $password]);
} catch (\Exception $e) {
$this->configRepository->setServer($server)->update(['cipassword' => $password]);
Expand Down

0 comments on commit 059a655

Please sign in to comment.