Skip to content

Commit

Permalink
update_manager: report detected_type and configured_type for applicat…
Browse files Browse the repository at this point in the history
…ions

Signed-off-by:  Eric Callahan <[email protected]>
  • Loading branch information
Arksine committed Jul 8, 2021
1 parent d76abe0 commit dacd9f7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion moonraker/components/update_manager/app_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 3 additions & 1 deletion moonraker/components/update_manager/git_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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, ...]:
Expand Down
15 changes: 13 additions & 2 deletions moonraker/components/update_manager/zip_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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', ""))
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit dacd9f7

Please sign in to comment.