[#1279] adm: Interpret "root" name as empty for namespace target type
All checks were successful
DCO action / DCO (pull_request) Successful in 1m58s
Build / Build Components (1.21) (pull_request) Successful in 3m35s
Pre-commit hooks / Pre-commit (pull_request) Successful in 3m55s
Tests and linters / gopls check (pull_request) Successful in 5m38s
Tests and linters / Lint (pull_request) Successful in 7m22s
Tests and linters / Tests with -race (pull_request) Successful in 7m9s
Tests and linters / Staticcheck (pull_request) Successful in 2m6s
Tests and linters / Tests (1.22) (pull_request) Successful in 5m49s
Tests and linters / Tests (1.21) (pull_request) Successful in 5m49s
Build / Build Components (1.22) (pull_request) Successful in 1m14s
Vulncheck / Vulncheck (pull_request) Successful in 45s

Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
This commit is contained in:
Airat Arifullin 2024-07-29 15:33:36 +03:00
parent 76cf7a051b
commit f5c6e515ac

View file

@ -38,6 +38,12 @@ var (
func parseTarget(cmd *cobra.Command) policyengine.Target {
name, _ := cmd.Flags().GetString(targetNameFlag)
typ, err := parseTargetType(cmd)
// interpret "root" namespace as empty
if typ == policyengine.Namespace && name == "root" {
name = ""
}
commonCmd.ExitOnErr(cmd, "read target type error: %w", err)
return policyengine.Target{