Add enterprise sudo paths to api.SudoPaths map (#15219)

* Add enterprise sudo paths to api.SudoPaths map

* add comment to denote ent-only sudo paths

* go fmt

Co-authored-by: Chris Capurso <1036769+ccapurso@users.noreply.github.com>
This commit is contained in:
VAL 2022-04-29 07:09:25 -07:00 committed by GitHub
parent 43bb764808
commit a06c8a139f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 9 deletions

View File

@ -58,6 +58,14 @@ var (
"/sys/revoke-force/{prefix}": regexp.MustCompile(`^/sys/revoke-force/.+$`),
"/sys/revoke-prefix/{prefix}": regexp.MustCompile(`^/sys/revoke-prefix/.+$`),
"/sys/rotate": regexp.MustCompile(`^/sys/rotate$`),
// enterprise-only paths
"/sys/replication/dr/primary/secondary-token": regexp.MustCompile(`^/sys/replication/dr/primary/secondary-token$`),
"/sys/replication/performance/primary/secondary-token": regexp.MustCompile(`^/sys/replication/performance/primary/secondary-token$`),
"/sys/replication/primary/secondary-token": regexp.MustCompile(`^/sys/replication/primary/secondary-token$`),
"/sys/replication/reindex": regexp.MustCompile(`^/sys/replication/reindex$`),
"/sys/storage/raft/snapshot-auto/config/": regexp.MustCompile(`^/sys/storage/raft/snapshot-auto/config/$`),
"/sys/storage/raft/snapshot-auto/config/{name}": regexp.MustCompile(`^/sys/storage/raft/snapshot-auto/config/[^/]+$`),
}
)

View File

@ -71,15 +71,7 @@ func TestSudoPaths(t *testing.T) {
sudoPathsInCode := api.SudoPaths()
// check for missing or superfluous paths
for path := range sudoPathsInCode {
if _, ok := sudoPathsFromSpec[path]; !ok {
t.Fatalf(
"A path in the static list of sudo paths in the api module is "+
"missing from the OpenAPI spec (%s). Please reconcile the two "+
"accordingly.", path)
}
}
// check for missing paths
for path := range sudoPathsFromSpec {
if _, ok := sudoPathsInCode[path]; !ok {
t.Fatalf(