Return error for authorized_keys and mergebase problems (#10990)

Signed-off-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
pull/10951/head^2
zeripath 5 years ago committed by GitHub
parent 3d63caa542
commit 089b34858c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      cmd/doctor.go

@ -353,7 +353,7 @@ func runDoctorAuthorizedKeys(ctx *cli.Context) ([]string, error) {
if ctx.Bool("fix") { if ctx.Bool("fix") {
return []string{"authorized_keys is out of date, attempting regeneration"}, models.RewriteAllPublicKeys() return []string{"authorized_keys is out of date, attempting regeneration"}, models.RewriteAllPublicKeys()
} }
return []string{"authorized_keys is out of date and should be regenerated with gitea admin regenerate keys"}, nil return nil, fmt.Errorf(`authorized_keys is out of date and should be regenerated with "gitea admin regenerate keys" or "gitea doctor --run authorized_keys --fix"`)
} }
return nil, nil return nil, nil
} }
@ -479,6 +479,9 @@ func runDoctorPRMergeBase(ctx *cli.Context) ([]string, error) {
if ctx.Bool("fix") { if ctx.Bool("fix") {
results = append(results, fmt.Sprintf("%d PR mergebases updated of %d PRs total in %d repos", numPRsUpdated, numPRs, numRepos)) results = append(results, fmt.Sprintf("%d PR mergebases updated of %d PRs total in %d repos", numPRsUpdated, numPRs, numRepos))
} else { } else {
if numPRsUpdated > 0 && err == nil {
return results, fmt.Errorf("%d PRs with incorrect mergebases of %d PRs total in %d repos", numPRsUpdated, numPRs, numRepos)
}
results = append(results, fmt.Sprintf("%d PRs with incorrect mergebases of %d PRs total in %d repos", numPRsUpdated, numPRs, numRepos)) results = append(results, fmt.Sprintf("%d PRs with incorrect mergebases of %d PRs total in %d repos", numPRsUpdated, numPRs, numRepos))
} }

Loading…
Cancel
Save