mirror of
https://gitlab.sectorq.eu/jaydee/portainer.git
synced 2026-05-04 14:49:49 +02:00
build-all
This commit is contained in:
@@ -405,6 +405,8 @@ if __name__ == "__main__":
|
||||
("update_service","update_service"),
|
||||
("update_containers","update_containers"),
|
||||
("list_stacks","list_stacks"),
|
||||
("list_all_stacks", "list_all_stacks"),
|
||||
("delete_ophaned_stacks", "delete_ophaned_stacks"),
|
||||
("update_stack","update_stack"),
|
||||
("secrets","secrets"),
|
||||
("print_all_data","print_all_data"),
|
||||
@@ -591,6 +593,21 @@ if __name__ == "__main__":
|
||||
# print(json.dumps(por.all_data, indent=2))
|
||||
sys.exit()
|
||||
|
||||
if args.action == "list_all_stacks":
|
||||
por.get_stacks_failed()
|
||||
if args.launcher:
|
||||
input("Press ENTER to continue...")
|
||||
# print(json.dumps(por.all_data, indent=2))
|
||||
sys.exit()
|
||||
|
||||
if args.action == "delete_ophaned_stacks":
|
||||
por.delete_failed_stack()
|
||||
if args.launcher:
|
||||
input("Press ENTER to continue...")
|
||||
# print(json.dumps(por.all_data, indent=2))
|
||||
sys.exit()
|
||||
|
||||
|
||||
if args.action == "list_containers":
|
||||
print("Getting containers")
|
||||
args = prompt_missing_args(
|
||||
|
||||
+29
-1
@@ -237,6 +237,34 @@ class PortainerApi:
|
||||
self.get_containers(self)
|
||||
return True
|
||||
|
||||
def get_stacks_failed(self, timeout=20):
|
||||
'''Get a list of stacks for a specific endpoint or all endpoints.'''
|
||||
path = "/stacks"
|
||||
stcks = []
|
||||
stacks = self._api_get(path, timeout=timeout)
|
||||
self.stacks_all = {}
|
||||
fail_endponts = [20, 39, 41, 32, 43]
|
||||
# print(json.dumps(stacks,indent=2))
|
||||
for s in stacks:
|
||||
stcks.append((s["EndpointId"], s["Id"]))
|
||||
print(f"{s['EndpointId']} : {s['Id']}")
|
||||
return stcks
|
||||
|
||||
def delete_failed_stack(self, timeout=20):
|
||||
'''Get a list of stacks for a specific endpoint or all endpoints.'''
|
||||
path = "/stacks"
|
||||
stcks = []
|
||||
stacks = self._api_get(path, timeout=timeout)
|
||||
|
||||
# print(json.dumps(stacks,indent=2))
|
||||
eid = input("Enter endpoint : ")
|
||||
for s in stacks:
|
||||
# print(s)
|
||||
# print(f"{s['EndpointId']} : {s['Id']}")
|
||||
if int(eid) == s["EndpointId"]:
|
||||
print(f"deleting stack {s['Id']}")
|
||||
self._delete_single_stack(s["Id"], "50")
|
||||
|
||||
def get_stacks(self, endpoint_id="all", timeout=20):
|
||||
'''Get a list of stacks for a specific endpoint or all endpoints.'''
|
||||
if endpoint_id != "all":
|
||||
@@ -245,7 +273,7 @@ class PortainerApi:
|
||||
stcks = []
|
||||
stacks = self._api_get(path, timeout=timeout)
|
||||
self.stacks_all = {}
|
||||
fail_endponts = [20, 39, 41]
|
||||
fail_endponts = [20, 39, 41, 32, 43]
|
||||
# print(json.dumps(stacks,indent=2))
|
||||
webhooks = {}
|
||||
for s in stacks:
|
||||
|
||||
Reference in New Issue
Block a user