diff --git a/port.py b/port.py index 853f2dd..4a6fb0b 100644 --- a/port.py +++ b/port.py @@ -161,6 +161,7 @@ class Portainer: data=payload, headers={"X-Gotify-Key": "ASn_fIAd5OVjm8c"} ) + logger.debug(response.text) # print("Status:", response.status_code) # print("Response:", response.text) 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__"] else: service_ids = [self.args.service_id] - if "__ONLY_CHECK__" in service_ids or self.args.update is False: - pull = False - print("Checking for updates only...") + if self.args.update is False: + if "__ONLY_CHECK__" in service_ids: + pull = False + print("Checking for updates only...") + else: + pull = True + print("Checking for updates and pulling updates...") else: - print("Checking for updates and pulling updates...") pull = True + print("Checking for updates and pulling updates...") if "__ALL__" in service_ids: 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("?") elif resp['Status'] == "outdated": if pull: - + print("Recreate") self.recreate_container(service_id, pull) #print(f"Service {service_dict[service_id]:<{longest}} : 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): """Restart a service on an endpoint.""" path = f"/docker/{self.endpoint_id}/containers/{service_id}/recreate" - #print(path) + print(path) params={"pullImage": pull} try: resp = self._api_post(path, json=params, timeout=20) diff --git a/portainer.py b/portainer.py index b5b52e2..527bf4f 100755 --- a/portainer.py +++ b/portainer.py @@ -163,7 +163,7 @@ update_configs(cur_config) if args.debug: input(cur_config) -_LOG_LEVEL = "INFO" +_LOG_LEVEL = "DEBUG" LOG_FILE = "/tmp/portainer.log" if _LOG_LEVEL == "DEBUG": logging.basicConfig(