mirror of
https://github.com/tailscale/tailscale.git
synced 2025-02-19 19:38:40 +00:00
cmd/gitops-pusher: things i forgot to push last PR (#5128)
Signed-off-by: Xe <xe@tailscale.com>
This commit is contained in:
parent
4dd799ec43
commit
904723691b
@ -57,7 +57,7 @@ func apply(cache *Cache, tailnet, apiKey string) func(context.Context, []string)
|
|||||||
|
|
||||||
if cache.PrevETag == "" {
|
if cache.PrevETag == "" {
|
||||||
log.Println("no previous etag found, assuming local file is correct and recording that")
|
log.Println("no previous etag found, assuming local file is correct and recording that")
|
||||||
cache.PrevETag = Shuck(localEtag)
|
cache.PrevETag = localEtag
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("control: %s", controlEtag)
|
log.Printf("control: %s", controlEtag)
|
||||||
@ -69,6 +69,7 @@ func apply(cache *Cache, tailnet, apiKey string) func(context.Context, []string)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if controlEtag == localEtag {
|
if controlEtag == localEtag {
|
||||||
|
cache.PrevETag = localEtag
|
||||||
log.Println("no update needed, doing nothing")
|
log.Println("no update needed, doing nothing")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -77,7 +78,7 @@ func apply(cache *Cache, tailnet, apiKey string) func(context.Context, []string)
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
cache.PrevETag = Shuck(localEtag)
|
cache.PrevETag = localEtag
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -97,7 +98,7 @@ func test(cache *Cache, tailnet, apiKey string) func(context.Context, []string)
|
|||||||
|
|
||||||
if cache.PrevETag == "" {
|
if cache.PrevETag == "" {
|
||||||
log.Println("no previous etag found, assuming local file is correct and recording that")
|
log.Println("no previous etag found, assuming local file is correct and recording that")
|
||||||
cache.PrevETag = Shuck(localEtag)
|
cache.PrevETag = localEtag
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("control: %s", controlEtag)
|
log.Printf("control: %s", controlEtag)
|
||||||
@ -246,7 +247,7 @@ func applyNewACL(ctx context.Context, tailnet, apiKey, policyFname, oldEtag stri
|
|||||||
|
|
||||||
req.SetBasicAuth(apiKey, "")
|
req.SetBasicAuth(apiKey, "")
|
||||||
req.Header.Set("Content-Type", "application/hujson")
|
req.Header.Set("Content-Type", "application/hujson")
|
||||||
req.Header.Set("If-Match", oldEtag)
|
req.Header.Set("If-Match", `"`+oldEtag+`"`)
|
||||||
|
|
||||||
resp, err := http.DefaultClient.Do(req)
|
resp, err := http.DefaultClient.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user