@@ -125,15 +125,20 @@ func updateCrd() (string, string, error) {
125125 if (* cluster ).Spec .Tags == nil {
126126 logger .Infof ("Creating '%s' tag with the 'Tick' value..." , tagSLT )
127127 (* cluster ).Spec .Tags = map [string ]string {tagSLT : "Tick" }
128-
129- } else if (* cluster ).Spec .Tags [tagSLT ] == "Tick" {
130- logger .Infof ("Changing '%s' tag value from '%s' to '%s'..." ,
131- tagSLT , (* cluster ).Spec .Tags [tagSLT ], "Tack" )
132- (* cluster ).Spec .Tags [tagSLT ] = "Tack"
133-
134- } else if (* cluster ).Spec .Tags [tagSLT ] == "Tack" {
135- logger .Infof ("Changing '%s' tag value from '%s' to '%s'..." ,
136- tagSLT , (* cluster ).Spec .Tags [tagSLT ], "Tick" )
128+ } else if value , ok := (* cluster ).Spec .Tags [tagSLT ]; ok {
129+ if value == "Tick" {
130+ logger .Infof ("Changing '%s' tag value from '%s' to '%s'..." ,
131+ tagSLT , value , "Tack" )
132+ (* cluster ).Spec .Tags [tagSLT ] = "Tack"
133+ } else if value == "Tack" {
134+ logger .Infof ("Changing '%s' tag value from '%s' to '%s'..." ,
135+ tagSLT , value , "Tick" )
136+ (* cluster ).Spec .Tags [tagSLT ] = "Tick"
137+ } else {
138+ return "" , "" , fmt .Errorf ("found '%s' tag with wrong value '%s'" , tagSLT , value )
139+ }
140+ } else {
141+ logger .Infof ("Creating '%s' tag with the 'Tick' value..." , tagSLT )
137142 (* cluster ).Spec .Tags [tagSLT ] = "Tick"
138143 }
139144
0 commit comments