rgw: correctly handle mgr-proxied rgw cli commands in multus scenarios

Due to multi-site Ceph object resources (realms, zonegroups, zones)
reconciliation CLI commands being proxied through CephCluster's Mgr pods
in Multus-based scenarios, return codes were being additionally wrapped
by K8S' command streams and weren't adequately handled in-code, causing
reconciliation of CephObject(Realm|ZoneGroup|Zone) resources to fail, as
an exit code of 0, instead of the expected syscall.ENOENT (2) was returned.

Fixes #12833

Signed-off-by: zer0def <zv0uzqbqnncivw0afjsx79jmd19shpps3r5f2vjc6yv@definedaszero.xyz>
This commit is contained in:
zer0def authored and zer0def committed 2023-11-20 23:42:17 +01:00
1 parent 8f611cfdfc
commit 9b69b5cb46
1 file changed
+3 -2
+3 -2
View File
@@ -19,6 +19,7 @@ package exec
import (
"fmt"
kexec "k8s.io/client-go/util/exec"
"os/exec"
"syscall"
)
@@ -41,12 +42,12 @@ func ExitStatus(err error) (int, bool) {
if ok {
return waitStatus.ExitStatus(), true
}
case kexec.CodeExitError:
return int(e.ExitStatus()), true
case *CephCLIError:
return ExitStatus(e.err)
case syscall.Errno:
return int(e), true
}
return 0, false
}