diff --git a/moonraker/components/update_manager/zip_deploy.py b/moonraker/components/update_manager/zip_deploy.py index b984132..6f6f229 100644 --- a/moonraker/components/update_manager/zip_deploy.py +++ b/moonraker/components/update_manager/zip_deploy.py @@ -40,7 +40,7 @@ class ZipDeploy(AppDeploy): def __init__(self, config: ConfigHelper, cmd_helper: CommandHelper, - app_params: Optional[Dict[str, Any]] + app_params: Optional[Dict[str, Any]] = None ) -> None: super().__init__(config, cmd_helper, app_params) self.official_repo: str = "?" @@ -83,8 +83,11 @@ class ZipDeploy(AppDeploy): return new_app async def _parse_info_file(self, file_name: str) -> Dict[str, Any]: + info_file = self.path.joinpath(file_name) + if not info_file.exists(): + self.log_info(f"Unable to locate file '{info_file}'") + return {} try: - info_file = self.path.joinpath(file_name) event_loop = self.server.get_event_loop() info_bytes = await event_loop.run_in_thread(info_file.read_text) info: Dict[str, Any] = json.loads(info_bytes) @@ -124,10 +127,11 @@ class ZipDeploy(AppDeploy): if key not in release_info: self._add_error(f"Missing release info item: {key}") self.detected_type = "?" - self.need_channel_update = False + self.need_channel_update = self.channel == "dev" if 'channel' in release_info: local_channel = release_info['channel'] - self.need_channel_update = self.channel != local_channel + if self.channel == "stable" and local_channel == "beta": + self.need_channel_update = True self.detected_type = "zip" if local_channel == "beta": self.detected_type = "zip_beta" @@ -191,10 +195,11 @@ class ZipDeploy(AppDeploy): current_release: Dict[str, Any] = {} for release in releases: if not latest_release: - if release['prerelease']: - if self.channel != "stable": - latest_release = release - elif self.channel == "stable": + if self.channel != "stable": + # Allow the beta channel to update regardless + latest_release = release + elif not release['prerelease']: + # This is a stable release on the stable channle latest_release = release if current_tag is not None: if not current_release and release['tag_name'] == current_tag: @@ -248,15 +253,14 @@ class ZipDeploy(AppDeploy): self._add_error( "RELEASE_INFO not found in latest release assets") self.commit_log = [] - if self.short_version == self.latest_version: - # No need to report the commit log when versions match - return - if "COMMIT_LOG" in asset_info: - asset_url, content_type, size = asset_info['COMMIT_LOG'] - commit_bytes = await self.cmd_helper.http_download_request( - asset_url, content_type) - commit_info: Dict[str, Any] = json.loads(commit_bytes) - self.commit_log = commit_info.get(self.name, []) + if self.short_version != self.latest_version: + # Only report commit log if versions change + if "COMMIT_LOG" in asset_info: + asset_url, content_type, size = asset_info['COMMIT_LOG'] + commit_bytes = await self.cmd_helper.http_download_request( + asset_url, content_type) + commit_info: Dict[str, Any] = json.loads(commit_bytes) + self.commit_log = commit_info.get(self.name, []) if zip_file_name in asset_info: self.release_download_info = asset_info[zip_file_name] self._is_valid = True