mirror of
https://gitlab.sectorq.eu/jaydee/portainer.git
synced 2025-12-17 11:49:59 +01:00
build
This commit is contained in:
17
port.py
17
port.py
@@ -161,6 +161,7 @@ class Portainer:
|
|||||||
data=payload,
|
data=payload,
|
||||||
headers={"X-Gotify-Key": "ASn_fIAd5OVjm8c"}
|
headers={"X-Gotify-Key": "ASn_fIAd5OVjm8c"}
|
||||||
)
|
)
|
||||||
|
logger.debug(response.text)
|
||||||
# print("Status:", response.status_code)
|
# print("Status:", response.status_code)
|
||||||
# print("Response:", response.text)
|
# print("Response:", response.text)
|
||||||
pass
|
pass
|
||||||
@@ -889,12 +890,16 @@ class Portainer:
|
|||||||
service_ids = [s[0] for s in service_tuples if s[0] != "__ALL__" and s[0] != "__ONLY_CHECK__"]
|
service_ids = [s[0] for s in service_tuples if s[0] != "__ALL__" and s[0] != "__ONLY_CHECK__"]
|
||||||
else:
|
else:
|
||||||
service_ids = [self.args.service_id]
|
service_ids = [self.args.service_id]
|
||||||
if "__ONLY_CHECK__" in service_ids or self.args.update is False:
|
if self.args.update is False:
|
||||||
pull = False
|
if "__ONLY_CHECK__" in service_ids:
|
||||||
print("Checking for updates only...")
|
pull = False
|
||||||
|
print("Checking for updates only...")
|
||||||
|
else:
|
||||||
|
pull = True
|
||||||
|
print("Checking for updates and pulling updates...")
|
||||||
else:
|
else:
|
||||||
print("Checking for updates and pulling updates...")
|
|
||||||
pull = True
|
pull = True
|
||||||
|
print("Checking for updates and pulling updates...")
|
||||||
if "__ALL__" in service_ids:
|
if "__ALL__" in service_ids:
|
||||||
service_ids = [s[0] for s in service_tuples if s[0] != "__ALL__" and s[0] != "__ONLY_CHECK__"]
|
service_ids = [s[0] for s in service_tuples if s[0] != "__ALL__" and s[0] != "__ONLY_CHECK__"]
|
||||||
|
|
||||||
@@ -923,7 +928,7 @@ class Portainer:
|
|||||||
print("?")
|
print("?")
|
||||||
elif resp['Status'] == "outdated":
|
elif resp['Status'] == "outdated":
|
||||||
if pull:
|
if pull:
|
||||||
|
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")
|
self.gotify_message(f"Service {service_dict[service_id]} updated")
|
||||||
@@ -1082,7 +1087,7 @@ class Portainer:
|
|||||||
def recreate_container(self,service_id, pull=False):
|
def recreate_container(self,service_id, pull=False):
|
||||||
"""Restart a service on an endpoint."""
|
"""Restart a service on an endpoint."""
|
||||||
path = f"/docker/{self.endpoint_id}/containers/{service_id}/recreate"
|
path = f"/docker/{self.endpoint_id}/containers/{service_id}/recreate"
|
||||||
#print(path)
|
print(path)
|
||||||
params={"pullImage": pull}
|
params={"pullImage": pull}
|
||||||
try:
|
try:
|
||||||
resp = self._api_post(path, json=params, timeout=20)
|
resp = self._api_post(path, json=params, timeout=20)
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ update_configs(cur_config)
|
|||||||
if args.debug:
|
if args.debug:
|
||||||
input(cur_config)
|
input(cur_config)
|
||||||
|
|
||||||
_LOG_LEVEL = "INFO"
|
_LOG_LEVEL = "DEBUG"
|
||||||
LOG_FILE = "/tmp/portainer.log"
|
LOG_FILE = "/tmp/portainer.log"
|
||||||
if _LOG_LEVEL == "DEBUG":
|
if _LOG_LEVEL == "DEBUG":
|
||||||
logging.basicConfig(
|
logging.basicConfig(
|
||||||
|
|||||||
Reference in New Issue
Block a user