api: services: propagate "uninstalled" state for units

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2021-07-13 18:48:30 +02:00
parent 4ec19e8487
commit ad7dd5a91f

View File

@ -122,8 +122,13 @@ my $service_state = sub {
} else {
$res->{state} = $ss->{SubState} || 'unknown';
}
if ($ss->{LoadState} eq 'not-found') {
$res->{'unit-state'} = 'not-found'; # not installed
} else {
$res->{'unit-state'} = $ss->{UnitFileState} || 'unknown';
}
$res->{'active-state'} = $ss->{ActiveState} || 'unknown';
$res->{'unit-state'} = $ss->{UnitFileState} || 'unknown';
return $res;
};