diff --git a/cmd/gitops-pusher/gitops-pusher.go b/cmd/gitops-pusher/gitops-pusher.go index 1abf36a3b..c33937ef2 100644 --- a/cmd/gitops-pusher/gitops-pusher.go +++ b/cmd/gitops-pusher/gitops-pusher.go @@ -66,6 +66,12 @@ func apply(cache *Cache, client *http.Client, tailnet, apiKey string) func(conte log.Printf("local: %s", localEtag) log.Printf("cache: %s", cache.PrevETag) + if controlEtag == localEtag { + cache.PrevETag = localEtag + log.Println("no update needed, doing nothing") + return nil + } + if cache.PrevETag != controlEtag { if err := modifiedExternallyError(); err != nil { if *failOnManualEdits { @@ -76,12 +82,6 @@ func apply(cache *Cache, client *http.Client, tailnet, apiKey string) func(conte } } - if controlEtag == localEtag { - cache.PrevETag = localEtag - log.Println("no update needed, doing nothing") - return nil - } - if err := applyNewACL(ctx, client, tailnet, apiKey, *policyFname, controlEtag); err != nil { return err } @@ -113,6 +113,11 @@ func test(cache *Cache, client *http.Client, tailnet, apiKey string) func(contex log.Printf("local: %s", localEtag) log.Printf("cache: %s", cache.PrevETag) + if controlEtag == localEtag { + log.Println("no updates found, doing nothing") + return nil + } + if cache.PrevETag != controlEtag { if err := modifiedExternallyError(); err != nil { if *failOnManualEdits { @@ -123,11 +128,6 @@ func test(cache *Cache, client *http.Client, tailnet, apiKey string) func(contex } } - if controlEtag == localEtag { - log.Println("no updates found, doing nothing") - return nil - } - if err := testNewACLs(ctx, client, tailnet, apiKey, *policyFname); err != nil { return err }