update_manager: report detected_type and configured_type for applications

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2021-07-08 09:02:08 -04:00
parent d76abe019f
commit dacd9f7565
3 changed files with 17 additions and 4 deletions

View File

@ -166,7 +166,7 @@ class AppDeploy(BaseDeploy):
'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,

View File

@ -578,6 +578,7 @@ class GitRepo:
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 @@ class GitRepo:
'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, ...]:

View File

@ -58,6 +58,7 @@ class ZipDeploy(AppDeploy):
"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 @@ class ZipDeploy(AppDeploy):
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 @@ 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(
@ -388,6 +398,7 @@ class ZipDeploy(AppDeploy):
# 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,