Skip to content

Commit 5ca3a9c

Browse files
committed
rebase
Signed-off-by: Anand Kumar Singh <[email protected]>
1 parent 0fb3339 commit 5ca3a9c

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

cmd/argocd/commands/applicationset.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ func printAppSetSummaryTable(appSet *arogappsetv1.ApplicationSet) {
460460
syncPolicyStr string
461461
syncPolicy = appSet.Spec.Template.Spec.SyncPolicy
462462
)
463-
if syncPolicy != nil && syncPolicy.Automated != nil {
463+
if syncPolicy != nil && *syncPolicy.IsAutomatedSyncEnabled() {
464464
syncPolicyStr = "Automated"
465465
if syncPolicy.Automated.Prune {
466466
syncPolicyStr += " (Prune)"

server/application/application.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -1948,7 +1948,7 @@ func (s *Server) Sync(ctx context.Context, syncReq *application.ApplicationSyncR
19481948
if err := s.enf.EnforceErr(ctx.Value("claims"), rbac.ResourceApplications, rbac.ActionOverride, a.RBACName(s.ns)); err != nil {
19491949
return nil, err
19501950
}
1951-
if a.Spec.SyncPolicy != nil && a.Spec.SyncPolicy.Automated != nil && !syncReq.GetDryRun() {
1951+
if a.Spec.SyncPolicy != nil && *a.Spec.SyncPolicy.IsAutomatedSyncEnabled() && !syncReq.GetDryRun() {
19521952
return nil, status.Error(codes.FailedPrecondition, "cannot use local sync when Automatic Sync Policy is enabled unless for dry run")
19531953
}
19541954
}
@@ -2048,7 +2048,7 @@ func (s *Server) resolveSourceRevisions(ctx context.Context, a *v1alpha1.Applica
20482048
sources[pos-1].TargetRevision = syncReq.Revisions[i]
20492049
}
20502050
for index, source := range sources {
2051-
if a.Spec.SyncPolicy != nil && a.Spec.SyncPolicy.Automated != nil && !syncReq.GetDryRun() {
2051+
if a.Spec.SyncPolicy != nil && *a.Spec.SyncPolicy.IsAutomatedSyncEnabled() && !syncReq.GetDryRun() {
20522052
if text.FirstNonEmpty(a.Spec.GetSources()[index].TargetRevision, "HEAD") != text.FirstNonEmpty(source.TargetRevision, "HEAD") {
20532053
return "", "", nil, nil, status.Errorf(codes.FailedPrecondition, "Cannot sync source %s to %s: auto-sync currently set to %s", source.RepoURL, source.TargetRevision, a.Spec.Sources[index].TargetRevision)
20542054
}
@@ -2063,7 +2063,7 @@ func (s *Server) resolveSourceRevisions(ctx context.Context, a *v1alpha1.Applica
20632063
return "", "", sourceRevisions, displayRevisions, nil
20642064
}
20652065
source := a.Spec.GetSource()
2066-
if a.Spec.SyncPolicy != nil && a.Spec.SyncPolicy.Automated != nil && !syncReq.GetDryRun() {
2066+
if a.Spec.SyncPolicy != nil && *a.Spec.SyncPolicy.IsAutomatedSyncEnabled() && !syncReq.GetDryRun() {
20672067
if syncReq.GetRevision() != "" && syncReq.GetRevision() != text.FirstNonEmpty(source.TargetRevision, "HEAD") {
20682068
return "", "", nil, nil, status.Errorf(codes.FailedPrecondition, "Cannot sync to %s: auto-sync currently set to %s", syncReq.GetRevision(), source.TargetRevision)
20692069
}
@@ -2086,7 +2086,7 @@ func (s *Server) Rollback(ctx context.Context, rollbackReq *application.Applicat
20862086
if a.DeletionTimestamp != nil {
20872087
return nil, status.Errorf(codes.FailedPrecondition, "application is deleting")
20882088
}
2089-
if a.Spec.SyncPolicy != nil && a.Spec.SyncPolicy.Automated != nil {
2089+
if a.Spec.SyncPolicy != nil && *a.Spec.SyncPolicy.IsAutomatedSyncEnabled() {
20902090
return nil, status.Errorf(codes.FailedPrecondition, "rollback cannot be initiated when auto-sync is enabled")
20912091
}
20922092

0 commit comments

Comments
 (0)