diff --git a/go.sum b/go.sum index ab91610c34..8eebbce470 100644 --- a/go.sum +++ b/go.sum @@ -939,6 +939,7 @@ golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20u golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980 h1:OjiUf46hAmXblsZdnoSXsEUSKU8r1UEzcL5RVZ4gO9Y= golang.org/x/sys v0.0.0-20200602225109-6fdc65e7d980/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.0.0-20160726164857-2910a502d2bf/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/pkg/kyverno/apply/command.go b/pkg/kyverno/apply/command.go index 6f53df8815..07c63a3678 100644 --- a/pkg/kyverno/apply/command.go +++ b/pkg/kyverno/apply/command.go @@ -18,7 +18,7 @@ import ( "github.com/kyverno/kyverno/pkg/engine/context" "github.com/kyverno/kyverno/pkg/engine/response" "github.com/kyverno/kyverno/pkg/kyverno/common" - sanitizederror "github.com/kyverno/kyverno/pkg/kyverno/sanitizedError" + sanitizedError "github.com/kyverno/kyverno/pkg/kyverno/sanitizedError" "github.com/kyverno/kyverno/pkg/openapi" policy2 "github.com/kyverno/kyverno/pkg/policy" "github.com/kyverno/kyverno/pkg/utils" @@ -68,7 +68,7 @@ func Command() *cobra.Command { RunE: func(cmd *cobra.Command, policyPaths []string) (err error) { defer func() { if err != nil { - if !sanitizederror.IsErrorSanitized(err) { + if !sanitizedError.IsErrorSanitized(err) { log.Log.Error(err, "failed to sanitize") err = fmt.Errorf("internal error") } @@ -76,7 +76,7 @@ func Command() *cobra.Command { }() if valuesFile != "" && variablesString != "" { - return sanitizederror.NewWithError("pass the values either using set flag or values_file flag", err) + return sanitizedError.NewWithError("pass the values either using set flag or values_file flag", err) } variables, valuesMap, err := getVariable(variablesString, valuesFile) @@ -89,7 +89,7 @@ func Command() *cobra.Command { openAPIController, err := openapi.NewOpenAPIController() if err != nil { - return sanitizederror.NewWithError("failed to initialize openAPIController", err) + return sanitizedError.NewWithError("failed to initialize openAPIController", err) } var dClient *client.Client @@ -192,7 +192,7 @@ func Command() *cobra.Command { ers, validateErs, err := applyPolicyOnResource(policy, resource, mutateLogPath, mutateLogPathIsDir, thisPolicyResourceValues, rc, policyReport) if err != nil { - return sanitizederror.NewWithError(fmt.Errorf("failed to apply policy %v on resource %v", policy.Name, resource.GetName()).Error(), err) + return sanitizedError.NewWithError(fmt.Errorf("failed to apply policy %v on resource %v", policy.Name, resource.GetName()).Error(), err) } engineResponses = append(engineResponses, ers...) validateEngineResponses = append(validateEngineResponses, validateErs) @@ -446,8 +446,8 @@ func mutatePolices(policies []*v1.ClusterPolicy) ([]*v1.ClusterPolicy, error) { for _, policy := range policies { p, err := common.MutatePolicy(policy, logger) if err != nil { - if !sanitizederror.IsErrorSanitized(err) { - return nil, sanitizederror.NewWithError("failed to mutate policy.", err) + if !sanitizedError.IsErrorSanitized(err) { + return nil, sanitizedError.NewWithError("failed to mutate policy.", err) } return nil, err } @@ -500,30 +500,30 @@ func createFileOrFolder(mutateLogPath string, mutateLogPathIsDir bool) error { if os.IsNotExist(err) { errDir := os.MkdirAll(folderPath, 0755) if errDir != nil { - return sanitizederror.NewWithError(fmt.Sprintf("failed to create directory"), err) + return sanitizedError.NewWithError(fmt.Sprintf("failed to create directory"), err) } } } file, err := os.OpenFile(mutateLogPath, os.O_RDONLY|os.O_CREATE, 0644) if err != nil { - return sanitizederror.NewWithError(fmt.Sprintf("failed to create file"), err) + return sanitizedError.NewWithError(fmt.Sprintf("failed to create file"), err) } err = file.Close() if err != nil { - return sanitizederror.NewWithError(fmt.Sprintf("failed to close file"), err) + return sanitizedError.NewWithError(fmt.Sprintf("failed to close file"), err) } } else { errDir := os.MkdirAll(mutateLogPath, 0755) if errDir != nil { - return sanitizederror.NewWithError(fmt.Sprintf("failed to create directory"), err) + return sanitizedError.NewWithError(fmt.Sprintf("failed to create directory"), err) } } } else { - return sanitizederror.NewWithError(fmt.Sprintf("failed to describe file"), err) + return sanitizedError.NewWithError(fmt.Sprintf("failed to describe file"), err) } }