added condition for mutate rule count
@@ -869,6 +869,15 @@ func SetInStoreContext(mutatedPolicies []*v1.ClusterPolicy, variables map[string
}
func processMutateEngineResponse(policy *v1.ClusterPolicy, mutateResponse *response.EngineResponse, resPath string, rc *ResultCounts, mutateLogPath string, stdin bool, mutateLogPathIsDir bool, resourceName string) error {
+
+ var policyHasMutate bool
+ for _, rule := range policy.Spec.Rules {
+ if rule.HasMutate() {
+ policyHasMutate = true
+ }
+ }
+ if policyHasMutate {
+
printCount := 0
printMutatedRes := false
for _, policyRule := range policy.Spec.Rules {
@@ -918,5 +927,6 @@ func processMutateEngineResponse(policy *v1.ClusterPolicy, mutateResponse *respo
fmt.Printf("\n\nMutation:\nMutation has been applied successfully. Check the files.")
}
}
+ }
return nil
}
