diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2021-12-10 16:14:24 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-10 16:14:24 +0800 |
commit | 3ca5dc7e32b372d14ff80d96f14b8f6a805862f1 (patch) | |
tree | 50d193ed0dacf2888d57b193a9b0d36065aff205 /modules/doctor | |
parent | 0a9fcf63a49799ad3b0f146c54879161bac61e10 (diff) | |
download | gitea-3ca5dc7e32b372d14ff80d96f14b8f6a805862f1.tar.gz gitea-3ca5dc7e32b372d14ff80d96f14b8f6a805862f1.zip |
Move keys to models/asymkey (#17917)
* Move keys to models/keys
* Rename models/keys -> models/asymkey
* change the missed package name
* Fix package alias
* Fix test
* Fix docs
* Fix test
* Fix test
* merge
Diffstat (limited to 'modules/doctor')
-rw-r--r-- | modules/doctor/authorizedkeys.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/doctor/authorizedkeys.go b/modules/doctor/authorizedkeys.go index d9bc70bb77..1a9b60e248 100644 --- a/modules/doctor/authorizedkeys.go +++ b/modules/doctor/authorizedkeys.go @@ -12,7 +12,7 @@ import ( "path/filepath" "strings" - "code.gitea.io/gitea/models" + asymkey_model "code.gitea.io/gitea/models/asymkey" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/setting" ) @@ -32,7 +32,7 @@ func checkAuthorizedKeys(logger log.Logger, autofix bool) error { return fmt.Errorf("Unable to open authorized_keys file. ERROR: %v", err) } logger.Warn("Unable to open authorized_keys. (ERROR: %v). Attempting to rewrite...", err) - if err = models.RewriteAllPublicKeys(); err != nil { + if err = asymkey_model.RewriteAllPublicKeys(); err != nil { logger.Critical("Unable to rewrite authorized_keys file. ERROR: %v", err) return fmt.Errorf("Unable to rewrite authorized_keys file. ERROR: %v", err) } @@ -53,7 +53,7 @@ func checkAuthorizedKeys(logger log.Logger, autofix bool) error { // now we regenerate and check if there are any lines missing regenerated := &bytes.Buffer{} - if err := models.RegeneratePublicKeys(regenerated); err != nil { + if err := asymkey_model.RegeneratePublicKeys(regenerated); err != nil { logger.Critical("Unable to regenerate authorized_keys file. ERROR: %v", err) return fmt.Errorf("Unable to regenerate authorized_keys file. ERROR: %v", err) } @@ -75,7 +75,7 @@ func checkAuthorizedKeys(logger log.Logger, autofix bool) error { return fmt.Errorf(`authorized_keys is out of date and should be regenerated with "gitea admin regenerate keys" or "gitea doctor --run authorized_keys --fix"`) } logger.Warn("authorized_keys is out of date. Attempting rewrite...") - err = models.RewriteAllPublicKeys() + err = asymkey_model.RewriteAllPublicKeys() if err != nil { logger.Critical("Unable to rewrite authorized_keys file. ERROR: %v", err) return fmt.Errorf("Unable to rewrite authorized_keys file. ERROR: %v", err) |