Skip to content

Commit

Permalink
wip: properly return true or false values
Browse files Browse the repository at this point in the history
issue #2044
  • Loading branch information
frankiejol committed Apr 22, 2024
1 parent 8bcceb2 commit b92ce40
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions script/rvd_front
Original file line number Diff line number Diff line change
Expand Up @@ -2840,9 +2840,14 @@ get '/status.(#type)'=> sub($c) {
}
}
return access_denied($c) unless $allowed{$remote_ip};

my $status = { backend => _ping_backend()};
my $sth = $RAVADA->_dbh->prepare("SELECT id,name,is_active "
my $backend = _ping_backend();
if ($backend) {
$backend='true';
} else {
$backend='false';
}
my $status = { backend => $backend, frontend => 'true' };
my $sth = $RAVADA->_dbh->prepare("SELECT name,is_active "
." FROM vms "
." ORDER BY 'name'"
);
Expand All @@ -2855,6 +2860,12 @@ get '/status.(#type)'=> sub($c) {
while ( my $row = $sth->fetchrow_hashref) {
$sth_active->execute($row->{id});
$row->{vms}=$sth_active->fetchrow;
if ($row->{is_active}) {
$row->{status} = 'active';
} else {
$row->{status} = 'disabled';
}
delete $row->{is_active};
push@{$status->{nodes}},($row);
}
return $c->render(json => $status);
Expand Down

0 comments on commit b92ce40

Please sign in to comment.