This commit is contained in:
2025-12-23 11:16:56 +01:00
parent 4339a7d769
commit b0c570d7ba

10
port.py
View File

@@ -914,6 +914,7 @@ class Portainer:
#print(longest) #print(longest)
ok = "\033[92m✔\033[0m" ok = "\033[92m✔\033[0m"
err = "\033[91m✖\033[0m" err = "\033[91m✖\033[0m"
updates = []
for service_id in service_ids: for service_id in service_ids:
# print(self.all_data["containers"][self.args.endpoint_id]) # print(self.all_data["containers"][self.args.endpoint_id])
@@ -934,7 +935,7 @@ class Portainer:
#print("Recreate") #print("Recreate")
self.recreate_container(service_id, pull) self.recreate_container(service_id, pull)
#print(f"Service {service_dict[service_id]:<{longest}} : updated") #print(f"Service {service_dict[service_id]:<{longest}} : updated")
self.gotify_message(f"Service {service_dict[service_id]} updated") updates.append(service_dict[service_id])
print(ok, end=" ") print(ok, end=" ")
for name, hash_, image in self.all_data["containers"][self.args.endpoint_id]: for name, hash_, image in self.all_data["containers"][self.args.endpoint_id]:
if name.startswith(service_dict[service_id]): if name.startswith(service_dict[service_id]):
@@ -942,7 +943,7 @@ class Portainer:
else: else:
print(f"\r\033[4m{service_dict[service_id]:<{longest}}\033[0m ", end="", flush=True) print(f"\r\033[4m{service_dict[service_id]:<{longest}}\033[0m ", end="", flush=True)
#print(f"\033[4m{service_dict[service_id]:<{longest}} {err}\033[0m") #print(f"\033[4m{service_dict[service_id]:<{longest}} {err}\033[0m")
self.gotify_message(f"Service update available for {service_dict[service_id]}") updates.append(service_dict[service_id])
print(err, end=" ") print(err, end=" ")
for name, hash_, image in self.all_data["containers"][self.args.endpoint_id]: for name, hash_, image in self.all_data["containers"][self.args.endpoint_id]:
if name.startswith(service_dict[service_id]): if name.startswith(service_dict[service_id]):
@@ -952,6 +953,11 @@ class Portainer:
for name, hash_, image in self.all_data["containers"][self.args.endpoint_id]: for name, hash_, image in self.all_data["containers"][self.args.endpoint_id]:
if name.startswith(service_dict[service_id]): if name.startswith(service_dict[service_id]):
print(image) print(image)
if len(updates) > 0:
if pull:
self.gotify_message(f"Services updated: {", ".join(updates)}")
else:
self.gotify_message(f"Services updates available: {', '.join(updates)}")
print("\033[?25h", end="") print("\033[?25h", end="")
return True return True