refactor: simplify Docker resource type determination logic by consolidating command structure

This commit is contained in:
Mauricio Siu
2025-09-05 02:50:37 -06:00
parent 35fc04dc8f
commit b90f0135d4
+8 -14
View File
@@ -257,20 +257,14 @@ export const getDockerResourceType = async (
console.log("resourceName", resourceName); console.log("resourceName", resourceName);
let result = ""; let result = "";
const command = ` const command = `
RESOURCE_NAME="${resourceName}" RESOURCE_NAME="${resourceName}"
if docker service inspect "$RESOURCE_NAME" &>/dev/null; then if docker service inspect "$RESOURCE_NAME" >/dev/null 2>&1; then
echo "service" echo "service"
exit 0 elif docker inspect "$RESOURCE_NAME" >/dev/null 2>&1; then
fi echo "standalone"
else
if docker inspect "$RESOURCE_NAME" &>/dev/null; then echo "unknown"
echo "standalone" fi`;
exit 0
fi
echo "unknown"
exit 0
`;
console.log("command", command); console.log("command", command);