This commit is contained in:
2026-03-20 20:57:15 +01:00
parent c5c5a5fafd
commit 18afddee86
+4 -5
View File
@@ -1236,15 +1236,14 @@ class PortainerApi:
def stop_stack(self, stack, endpoint_id):
"""Stop one stack or all stacks on an endpoint."""
print(f"Stopping stack {stack}")
# print(f"Stopping stack {stack}")
if endpoint_id is not None:
self.get_endpoint(endpoint_id)
if stack is not None:
for s in stack:
self.stack_ids.append(self._resolve_stack_id(s, endpoint_id))
# print(self.stack_ids)
self.stack_ids = list(dict.fromkeys(self.stack_ids))
for stck in self.stack_ids:
path = f"/stacks/{stck}/stop"
# print(path)
@@ -1283,8 +1282,8 @@ class PortainerApi:
return "all"
if not self._is_number(stack):
result = self.get_stack(stack, endpoint_id)
return result["Id"]
result = self.stacks_all[endpoint_id]['by_name'][stack]
return result
return int(stack)