mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-14 19:45:54 +00:00
api: services: improve state detection for one-shot units
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
7195dcd37a
commit
4ec19e8487
@ -116,7 +116,12 @@ my $service_state = sub {
|
|||||||
if (my $err = $@) {
|
if (my $err = $@) {
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
$res->{state} = $ss->{SubState} || 'unknown';
|
my $state = $ss->{SubState} || 'unknown';
|
||||||
|
if ($state eq 'dead' && $ss->{Type} && $ss->{Type} eq 'oneshot' && $ss->{Result}) {
|
||||||
|
$res->{state} = $ss->{Result};
|
||||||
|
} else {
|
||||||
|
$res->{state} = $ss->{SubState} || 'unknown';
|
||||||
|
}
|
||||||
$res->{'active-state'} = $ss->{ActiveState} || 'unknown';
|
$res->{'active-state'} = $ss->{ActiveState} || 'unknown';
|
||||||
$res->{'unit-state'} = $ss->{UnitFileState} || 'unknown';
|
$res->{'unit-state'} = $ss->{UnitFileState} || 'unknown';
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user