Skip to content

Commit

Permalink
PB-8845: Add check to return error if excluderesourcetypes and includ…
Browse files Browse the repository at this point in the history
…eResources is set for VM type backup (#1877)
  • Loading branch information
aks-px authored Nov 20, 2024
1 parent e8c8f4d commit 21dfd16
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/applicationmanager/controllers/applicationbackup.go
Original file line number Diff line number Diff line change
Expand Up @@ -2711,10 +2711,17 @@ func (a *ApplicationBackupController) validateApplicationBackupParameters(backup
return fmt.Errorf("both ResourceTypes and ExcludeResourceTypes parameter can not be set together")
}
if IsBackupObjectTypeVirtualMachine(backup) {
//Check if excludeResourceType is not specified
if len(backup.Spec.ExcludeResourceTypes) != 0 {
return fmt.Errorf("excludeResourceType should be nil for backup Object type %v", resourcecollector.PxBackupObjectType_virtualMachine)
}
//Check resourceTypes is not specified
if len(backup.Spec.ResourceTypes) != 0 {
return fmt.Errorf("resourceType should be nil for backup Object type %v", resourcecollector.PxBackupObjectType_virtualMachine)
}
if len(backup.Spec.IncludeResources) != 0 {
return fmt.Errorf("includeResources should be nil for backup Object type %v", resourcecollector.PxBackupObjectType_virtualMachine)
}
//check skipAutoExecRules is true for custom rules.
if backup.Spec.PreExecRule != "" || backup.Spec.PostExecRule != "" {
if !backup.Spec.SkipAutoExecRules {
Expand Down

0 comments on commit 21dfd16

Please sign in to comment.