use of jetbrains.buildServer.serverSide.healthStatus.HealthStatusItem in project teamcity-git by JetBrains.
the class GitGcErrorsHealthPage method isAvailable.
@Override
public boolean isAvailable(@NotNull HttpServletRequest request) {
if (!super.isAvailable(request))
return false;
if (!SessionUser.getUser(request).isPermissionGrantedGlobally(Permission.MANAGE_SERVER_INSTALLATION))
return false;
HealthStatusItem item = getStatusItem(request);
Object path = item.getAdditionalData().get(GitGcErrorsHealthReport.ERRORS_KEY);
return path instanceof Map && !((Map) path).isEmpty();
}
use of jetbrains.buildServer.serverSide.healthStatus.HealthStatusItem in project teamcity-git by JetBrains.
the class GitServerVersionHealthPage method isAvailable.
@Override
public boolean isAvailable(@NotNull HttpServletRequest request) {
if (!super.isAvailable(request))
return false;
if (!SessionUser.getUser(request).isPermissionGrantedGlobally(Permission.MANAGE_SERVER_INSTALLATION))
return false;
if (!myGitOperations.isNativeGitOperationsEnabled())
return false;
final HealthStatusItem item = getStatusItem(request);
final Object gitExec = item.getAdditionalData().get("gitExec");
return gitExec == null || gitExec instanceof GitExec && ((GitExec) gitExec).getVersion().equals(getCurrentGitVersion());
}
use of jetbrains.buildServer.serverSide.healthStatus.HealthStatusItem in project teamcity-git by JetBrains.
the class GitGcErrorsHealthPage method fillModel.
@Override
public void fillModel(@NotNull final Map<String, Object> model, @NotNull final HttpServletRequest request) {
HealthStatusItem item = getStatusItem(request);
Object errors = item.getAdditionalData().get(GitGcErrorsHealthReport.ERRORS_KEY);
Map<String, Pair<String, String>> sortedErrors = new TreeMap<>();
if (errors instanceof Map) {
File mainDataDirectory;
try {
mainDataDirectory = myServerPaths.getDataDirectory().getCanonicalFile();
} catch (IOException e) {
mainDataDirectory = myServerPaths.getDataDirectory().getAbsoluteFile();
}
ErrorMessageSanitizer errorMessageSanitizer = new ErrorMessageSanitizer(mainDataDirectory.getAbsolutePath(), "<TeamCity Data Directory>");
File currentNodeDataDir = NodeSpecificConfigs.getNodeDataDirectory(mainDataDirectory);
errorMessageSanitizer.addSanitizedPath(currentNodeDataDir.getAbsolutePath(), "<Node Data Directory>");
// noinspection unchecked
Set<Map.Entry> entries = ((Map) errors).entrySet();
for (Map.Entry entry : entries) {
Object key = entry.getKey();
Object value = entry.getValue();
if (key instanceof File && value instanceof String) {
try {
String url = myMirrorManager.getUrl(((File) key).getName());
if (url != null) {
sortedErrors.put(url, Pair.create(errorMessageSanitizer.sanitize(((File) key).getCanonicalPath()), (String) value));
}
} catch (IOException e) {
LOG.warnAndDebugDetails("Error while preparing health report data", e);
}
}
}
}
model.put("errors", sortedErrors);
}
use of jetbrains.buildServer.serverSide.healthStatus.HealthStatusItem in project teamcity-git by JetBrains.
the class GitNotFoundHealthPage method isAvailable.
@Override
public boolean isAvailable(@NotNull HttpServletRequest request) {
if (!super.isAvailable(request))
return false;
if (!SessionUser.getUser(request).isPermissionGrantedGlobally(Permission.CHANGE_SERVER_SETTINGS))
return false;
HealthStatusItem item = getStatusItem(request);
Object path = item.getAdditionalData().get(GitNotFoundHealthReport.PATH_KEY);
Object error = item.getAdditionalData().get(GitNotFoundHealthReport.ERROR_KEY);
return path instanceof String && error instanceof VcsException;
}
Aggregations