diff --git a/main.py b/main.py index 09f2e3b..a9a3761 100755 --- a/main.py +++ b/main.py @@ -682,8 +682,4 @@ if __name__ == "__main__": sys.exit() if args.action == "refresh_status": - if args.stack == "all": - print("Stopping all stacks...") - stcks = por.get_stacks(endpoint_id=args.endpoint_id) - else: - por.refresh_status(args.stack_id) + por.refresh_status(args) \ No newline at end of file diff --git a/portainer/api.py b/portainer/api.py index 8864401..10dc7ea 100644 --- a/portainer/api.py +++ b/portainer/api.py @@ -141,6 +141,13 @@ class PortainerApi: self.get_endpoints() self.get_stacks() + def refresh_status(self, args): + for s in self.all_data['stacks']['m-s']['by_id']: + path = f'/stacks/{s}/images_status?refresh=true' + + print(path) + res = self._api_get(path, timeout=args.timeout) + def _is_number(self, s): """Check if the input string is a number.""" try: