File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,8 +37,6 @@ const (
3737 DisableStatus Status = "disable"
3838)
3939
40- const defaultStatus = ""
41-
4240// Meta data of telemetry.
4341type Meta struct {
4442 UUID string `yaml:"uuid,omitempty"`
@@ -88,11 +86,11 @@ func LoadFrom(fname string) (meta *Meta, err error) {
8886
8987 // populate UUID and secret if not set
9088 var updated bool
91- if meta .UUID == "" {
89+ if meta .UUID == "" && meta . Status == EnableStatus {
9290 meta .UUID = NewUUID ()
9391 updated = true
9492 }
95- if meta .Secret == "" {
93+ if meta .Secret == "" && meta . Status == EnableStatus {
9694 meta .Secret = NewSecret ()
9795 updated = true
9896 }
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ func (s *teleSuite) TestTelemetry(c *check.C) {
2323 // Should no error and get a default meta.
2424 meta , err := LoadFrom (fname )
2525 c .Assert (err , check .IsNil )
26- c .Assert (meta .Status , check .Equals , defaultStatus )
26+ c .Assert (meta .Status , check .Equals , Status ( "" ) )
2727 c .Assert (len (meta .UUID ), check .Equals , 0 )
2828
2929 // Save and load back
You can’t perform that action at this time.
0 commit comments