mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-31 03:45:17 +00:00
chore: make contrinue-on-fail flag available outside package (#10293)
Signed-off-by: anushkamittal20 <anumittal4641@gmail.com> Co-authored-by: anushkamittal20 <anumittal4641@gmail.com>
This commit is contained in:
parent
fbdd15fbc9
commit
68304e4b19
1 changed files with 4 additions and 4 deletions
|
@ -67,7 +67,7 @@ type ApplyCommandConfig struct {
|
|||
warnExitCode int
|
||||
warnNoPassed bool
|
||||
Exception []string
|
||||
continueOnFail bool
|
||||
ContinueOnFail bool
|
||||
}
|
||||
|
||||
func Command() *cobra.Command {
|
||||
|
@ -122,7 +122,7 @@ func Command() *cobra.Command {
|
|||
cmd.Flags().BoolVarP(&table, "table", "t", false, "Show results in table format")
|
||||
cmd.Flags().StringSliceVarP(&applyCommandConfig.Exception, "exception", "e", nil, "Policy exception to be considered when evaluating policies against resources")
|
||||
cmd.Flags().StringSliceVarP(&applyCommandConfig.Exception, "exceptions", "", nil, "Policy exception to be considered when evaluating policies against resources")
|
||||
cmd.Flags().BoolVar(&applyCommandConfig.continueOnFail, "continue-on-fail", false, "If set to true, will continue to apply policies on the next resource upon failure to apply to the current resource instead of exiting out")
|
||||
cmd.Flags().BoolVar(&applyCommandConfig.ContinueOnFail, "continue-on-fail", false, "If set to true, will continue to apply policies on the next resource upon failure to apply to the current resource instead of exiting out")
|
||||
return cmd
|
||||
}
|
||||
|
||||
|
@ -236,7 +236,7 @@ func (c *ApplyCommandConfig) applyValidatingAdmissionPolicytoResource(
|
|||
}
|
||||
ers, err := processor.ApplyPolicyOnResource()
|
||||
if err != nil {
|
||||
if c.continueOnFail {
|
||||
if c.ContinueOnFail {
|
||||
fmt.Printf("failed to apply policies on resource %s (%v)\n", resource.GetName(), err)
|
||||
continue
|
||||
}
|
||||
|
@ -304,7 +304,7 @@ func (c *ApplyCommandConfig) applyPolicytoResource(
|
|||
}
|
||||
ers, err := processor.ApplyPoliciesOnResource()
|
||||
if err != nil {
|
||||
if c.continueOnFail {
|
||||
if c.ContinueOnFail {
|
||||
fmt.Printf("failed to apply policies on resource %v (%v)\n", resource.GetName(), err)
|
||||
continue
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue