From ad7dd5a91fba12ad5a456cfd623f56419a347031 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Tue, 13 Jul 2021 18:48:30 +0200 Subject: [PATCH] api: services: propagate "uninstalled" state for units Signed-off-by: Thomas Lamprecht --- PVE/API2/Services.pm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/PVE/API2/Services.pm b/PVE/API2/Services.pm index e8d9f4ca..f0159b65 100644 --- a/PVE/API2/Services.pm +++ b/PVE/API2/Services.pm @@ -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; };