From dacd9f75656f2a143835d6286a8343aac8946aa6 Mon Sep 17 00:00:00 2001 From: Eric Callahan Date: Thu, 8 Jul 2021 09:02:08 -0400 Subject: [PATCH] update_manager: report detected_type and configured_type for applications Signed-off-by: Eric Callahan --- moonraker/components/update_manager/app_deploy.py | 2 +- moonraker/components/update_manager/git_deploy.py | 4 +++- moonraker/components/update_manager/zip_deploy.py | 15 +++++++++++++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/moonraker/components/update_manager/app_deploy.py b/moonraker/components/update_manager/app_deploy.py index c369063b9..32c2f4cbe 100644 --- a/moonraker/components/update_manager/app_deploy.py +++ b/moonraker/components/update_manager/app_deploy.py @@ -166,7 +166,7 @@ def get_update_status(self) -> Dict[str, Any]: 'debug_enabled': self.debug, 'need_channel_update': self.need_channel_update, 'is_valid': self._is_valid, - 'type': self.type + 'configured_type': self.type } async def _get_file_hash(self, diff --git a/moonraker/components/update_manager/git_deploy.py b/moonraker/components/update_manager/git_deploy.py index f482365e4..c9f37372a 100644 --- a/moonraker/components/update_manager/git_deploy.py +++ b/moonraker/components/update_manager/git_deploy.py @@ -578,6 +578,7 @@ async def get_tagged_commits(self) -> Dict[str, Any]: def get_repo_status(self) -> Dict[str, Any]: return { + 'detected_type': "git_repo", 'remote_alias': self.git_remote, 'branch': self.git_branch, 'owner': self.git_owner, @@ -589,7 +590,8 @@ def get_repo_status(self) -> Dict[str, Any]: 'detached': self.head_detached, 'commits_behind': self.commits_behind, 'git_messages': self.git_messages, - 'full_version_string': self.full_version_string + 'full_version_string': self.full_version_string, + 'pristine': not self.dirty } def get_version(self, upstream: bool = False) -> Tuple[Any, ...]: diff --git a/moonraker/components/update_manager/zip_deploy.py b/moonraker/components/update_manager/zip_deploy.py index 781d52e9f..e5050c07d 100644 --- a/moonraker/components/update_manager/zip_deploy.py +++ b/moonraker/components/update_manager/zip_deploy.py @@ -58,6 +58,7 @@ def __init__(self, "Invalid url set for 'origin' option in section " f"[{config.get_name()}]. Unable to extract owner/repo.") self.host_repo: str = config.get('host_repo', self.official_repo) + self.detected_type: str = "?" self.source_checksum: str = "" self.pristine = False self.verified = False @@ -125,8 +126,14 @@ async def _update_repo_state(self) -> None: for key in RINFO_KEYS: if key not in release_info: self._add_error(f"Missing release info item: {key}") - local_channel = release_info.get('channel', "?") - self.need_channel_update = self.channel != local_channel + self.detected_type = "?" + self.need_channel_update = False + if 'channel' in release_info: + local_channel = release_info['channel'] + self.need_channel_update = self.channel != local_channel + self.detected_type = "zip" + if local_channel == "beta": + self.detected_type = "zip_beta" self.full_version = release_info.get('long_version', "?") self.short_version = self._get_tag_version( release_info.get('git_version', "")) @@ -245,6 +252,9 @@ async def _process_latest_release(self, release: Dict[str, Any]): 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( @@ -388,6 +398,7 @@ def get_update_status(self) -> Dict[str, Any]: # client functionality. In the future it would be # good to report values that are specifc status.update({ + 'detected_type': self.detected_type, 'remote_alias': "origin", 'branch': "master", 'owner': self.owner,