Commit 31898f0
authored
Fix an exception thrown when an SSH mirror has an invalid credential type (#1336)
Motivation:
When an SSH mirror was configured with a non-SSH_KEY credential (e.g. ACCESS_TOKEN), `SshGitMirror` threw a `MirrorException` during mirror conversion. Although the exception was caught by `handleAllMirrors()` and the bad mirror was skipped, the mirror was invisible in the UI as a result, making it impossible to update or delete the mirror.
Modifications:
- Move the credential type validation from `SshGitMirror` constructor to `GitMirrorProvider.newMirror()`. When the credential type is wrong, log a warning and return `null` instead of throwing `MirrorException`.
Result:
- A mirror with an invalid credential type is loaded correctly and shown in the UI, allowing users to update or delete it.1 parent 5bc736b commit 31898f0
3 files changed
Lines changed: 13 additions & 7 deletions
File tree
- server-mirror-git/src/main/java/com/linecorp/centraldogma/server/internal/mirror
- server/src/main/java/com/linecorp/centraldogma/server/internal/storage/repository
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
28 | 32 | | |
29 | 33 | | |
30 | 34 | | |
31 | 35 | | |
32 | 36 | | |
33 | 37 | | |
34 | 38 | | |
| 39 | + | |
| 40 | + | |
35 | 41 | | |
36 | 42 | | |
37 | 43 | | |
| |||
44 | 50 | | |
45 | 51 | | |
46 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
47 | 57 | | |
48 | 58 | | |
49 | 59 | | |
| |||
server-mirror-git/src/main/java/com/linecorp/centraldogma/server/internal/mirror/SshGitMirror.java
Lines changed: 0 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | 104 | | |
109 | 105 | | |
110 | 106 | | |
| |||
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
192 | | - | |
193 | | - | |
194 | | - | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
| |||
0 commit comments