File: enable.patch

package info (click to toggle)
golang-github-hashicorp-go-checkpoint 0.0~git20151022.0.e4b2dc3-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 164 kB
  • ctags: 51
  • sloc: makefile: 3; sh: 3
file content (78 lines) | stat: -rw-r--r-- 2,830 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
Description: swap the explicit disabling behavior for DFSG compliance
Forwarded: not-needed
Author: Tianon Gravi <tianon@debian.org>

Index: golang-github-hashicorp-go-checkpoint/README.md
===================================================================
--- golang-github-hashicorp-go-checkpoint.orig/README.md
+++ golang-github-hashicorp-go-checkpoint/README.md
@@ -17,6 +17,10 @@ in the case of packer:
 CHECKPOINT_DISABLE=1 packer build 
 ```
 
+In the Debian package, this behavior is swapped so that the service is disabled
+by default, and only enabled with an explicit `CHECKPOINT_ENABLE=1` due to DFSG
+compliance.
+
 **Note:** This repository is probably useless outside of internal HashiCorp
 use. It is open source for disclosure and because our open source projects
 must be able to link to it.
Index: golang-github-hashicorp-go-checkpoint/checkpoint.go
===================================================================
--- golang-github-hashicorp-go-checkpoint.orig/checkpoint.go
+++ golang-github-hashicorp-go-checkpoint/checkpoint.go
@@ -95,7 +95,7 @@ type CheckAlert struct {
 
 // Check checks for alerts and new version information.
 func Check(p *CheckParams) (*CheckResponse, error) {
-	if disabled := os.Getenv("CHECKPOINT_DISABLE"); disabled != "" && !p.Force {
+	if enabled := os.Getenv("CHECKPOINT_ENABLE"); enabled == "" && !p.Force {
 		return &CheckResponse{}, nil
 	}
 
@@ -188,7 +188,7 @@ func Check(p *CheckParams) (*CheckRespon
 func CheckInterval(p *CheckParams, interval time.Duration, cb func(*CheckResponse, error)) chan struct{} {
 	doneCh := make(chan struct{})
 
-	if disabled := os.Getenv("CHECKPOINT_DISABLE"); disabled != "" {
+	if enabled := os.Getenv("CHECKPOINT_ENABLE"); enabled == "" {
 		return doneCh
 	}
 
Index: golang-github-hashicorp-go-checkpoint/checkpoint_test.go
===================================================================
--- golang-github-hashicorp-go-checkpoint.orig/checkpoint_test.go
+++ golang-github-hashicorp-go-checkpoint/checkpoint_test.go
@@ -9,6 +9,10 @@ import (
 	"time"
 )
 
+func init() {
+	os.Setenv("CHECKPOINT_ENABLE", "1")
+}
+
 func TestCheck(t *testing.T) {
 	expected := &CheckResponse{
 		Product:             "test",
@@ -36,8 +40,8 @@ func TestCheck(t *testing.T) {
 }
 
 func TestCheck_disabled(t *testing.T) {
-	os.Setenv("CHECKPOINT_DISABLE", "1")
-	defer os.Setenv("CHECKPOINT_DISABLE", "")
+	os.Setenv("CHECKPOINT_ENABLE", "")
+	defer os.Setenv("CHECKPOINT_ENABLE", "1")
 
 	expected := &CheckResponse{}
 
@@ -165,8 +169,8 @@ func TestCheckInterval(t *testing.T) {
 }
 
 func TestCheckInterval_disabled(t *testing.T) {
-	os.Setenv("CHECKPOINT_DISABLE", "1")
-	defer os.Setenv("CHECKPOINT_DISABLE", "")
+	os.Setenv("CHECKPOINT_ENABLE", "")
+	defer os.Setenv("CHECKPOINT_ENABLE", "1")
 
 	params := &CheckParams{
 		Product: "test",