Fix #5956 issue: The APIs should not get chart information when Harbor is not installed with chart repo

Signed-off-by: Steven Zou <szou@vmware.com>
This commit is contained in:
Steven Zou 2018-09-27 13:22:25 +08:00
parent 6c00747390
commit 55c50f310d

View File

@ -420,13 +420,15 @@ func (p *ProjectAPI) populateProperties(project *models.Project) {
project.RepoCount = total
// Populate chart count property
count, err := chartController.GetCountOfCharts([]string{project.Name})
if err != nil {
log.Errorf("Failed to get total of charts under project %s: %v", project.Name, err)
p.CustomAbort(http.StatusInternalServerError, "")
}
if config.WithChartMuseum() {
count, err := chartController.GetCountOfCharts([]string{project.Name})
if err != nil {
log.Errorf("Failed to get total of charts under project %s: %v", project.Name, err)
p.CustomAbort(http.StatusInternalServerError, "")
}
project.ChartCount = count
project.ChartCount = count
}
}
// Put ...