update_manager: add report_anomalies option
Anomalies do not prevent updates, they are intended to alert users of potential issues detected within an extension for update. Anomalies are always logged, however it is not necessary for them to be reported to frontends. This option gives users the ability to silence anomalies on a per extension basis. Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
1 parent
ccbfd64989
commit
dbe0dc4d08
4 files changed
+8
-5
No files matched your search
@@ -55,6 +55,7 @@ class AppDeploy(BaseDeploy):
|
||||
f"option 'channel'. Type '{self.type}' supports the following "
|
||||
f"channels: {str_channels}. Falling back to channel '{self.channel}'"
|
||||
)
|
||||
self.report_anomalies = config.getboolean("report_anomalies", True)
|
||||
self._is_valid: bool = False
|
||||
self.virtualenv: Optional[pathlib.Path] = None
|
||||
self.py_exec: Optional[pathlib.Path] = None
|
||||
|
||||
@@ -42,7 +42,7 @@ BASE_CONFIG: Dict[str, Dict[str, str]] = {
|
||||
}
|
||||
}
|
||||
|
||||
OPTION_OVERRIDES = ("channel", "pinned_commit", "refresh_interval")
|
||||
OPTION_OVERRIDES = ("channel", "pinned_commit", "refresh_interval", "report_anomalies")
|
||||
|
||||
class AppType(ExtendedEnum):
|
||||
NONE = 1
|
||||
|
||||
@@ -151,7 +151,7 @@ class GitDeploy(AppDeploy):
|
||||
|
||||
def get_update_status(self) -> Dict[str, Any]:
|
||||
status = super().get_update_status()
|
||||
status.update(self.repo.get_repo_status())
|
||||
status.update(self.repo.get_repo_status(self.report_anomalies))
|
||||
status["name"] = self.name
|
||||
return status
|
||||
|
||||
@@ -1019,8 +1019,9 @@ class GitRepo:
|
||||
# Return tagged commits as SHA keys mapped to tag values
|
||||
return tagged_commits
|
||||
|
||||
def get_repo_status(self) -> Dict[str, Any]:
|
||||
def get_repo_status(self, rpt_anomalies: bool) -> Dict[str, Any]:
|
||||
no_untrk_src = len(self.untracked_files) == 0
|
||||
anomalies = self.repo_anomalies if rpt_anomalies else []
|
||||
return {
|
||||
'detected_type': "git_repo",
|
||||
'remote_alias': self.git_remote,
|
||||
@@ -1043,7 +1044,7 @@ class GitRepo:
|
||||
'pristine': no_untrk_src and not self.current_version.dirty,
|
||||
'corrupt': self.repo_corrupt,
|
||||
'warnings': self.repo_warnings,
|
||||
'anomalies': self.repo_anomalies
|
||||
'anomalies': anomalies
|
||||
}
|
||||
|
||||
def get_version(self, upstream: bool = False) -> GitVersion:
|
||||
|
||||
@@ -487,6 +487,7 @@ class NetDeploy(AppDeploy):
|
||||
|
||||
def get_update_status(self) -> Dict[str, Any]:
|
||||
status = super().get_update_status()
|
||||
anomalies = self.anomalies if self.report_anomalies else []
|
||||
status.update({
|
||||
'name': self.name,
|
||||
'repo_name': self.project_name,
|
||||
@@ -496,6 +497,6 @@ class NetDeploy(AppDeploy):
|
||||
'rollback_version': self.rollback_version,
|
||||
'last_error': self.last_error,
|
||||
'warnings': self.warnings,
|
||||
'anomalies': self.anomalies
|
||||
'anomalies': anomalies
|
||||
})
|
||||
return status
|
||||
Reference in new issue
Block a user