@@ -84,7 +84,7 @@ func (c *HetznerConfigurer) curlQueryFailover(post bool) (string, error) {
8484 }
8585 if user == "" || password == "" {
8686 log .Infoln ("Couldn't retrieve username or password from file" , credentialsFile )
87- return "" , errors .New ("Couldn 't retrieve username or password from file" )
87+ return "" , errors .New ("couldn 't retrieve username or password from file" )
8888 }
8989
9090 /**
@@ -101,33 +101,33 @@ func (c *HetznerConfigurer) curlQueryFailover(post bool) (string, error) {
101101 myOwnIP := getOutboundIP ()
102102 if myOwnIP == nil {
103103 log .Error ("Error determining this machine's IP address." )
104- return "" , errors .New ("Error determining this machine's IP address" )
104+ return "" , errors .New ("error determining this machine's IP address" )
105105 }
106106 log .Infof ("my_own_ip: %s\n " , myOwnIP .String ())
107107
108108 cmd = exec .Command ("curl" ,
109109 "--ipv4" ,
110110 "-u" , user + ":" + password ,
111- "https://robot-ws.your-server.de/failover/" + c .IPConfiguration . VIP .String (),
111+ "https://robot-ws.your-server.de/failover/" + c .VIP .String (),
112112 "-d" , "active_server_ip=" + myOwnIP .String ())
113113
114114 log .Debugf ("%s %s %s '%s' %s %s %s" ,
115115 "curl" ,
116116 "--ipv4" ,
117117 "-u" , user + ":XXXXXX" ,
118- "https://robot-ws.your-server.de/failover/" + c .IPConfiguration . VIP .String (),
118+ "https://robot-ws.your-server.de/failover/" + c .VIP .String (),
119119 "-d" , "active_server_ip=" + myOwnIP .String ())
120120 } else {
121121 cmd = exec .Command ("curl" ,
122122 "--ipv4" ,
123123 "-u" , user + ":" + password ,
124- "https://robot-ws.your-server.de/failover/" + c .IPConfiguration . VIP .String ())
124+ "https://robot-ws.your-server.de/failover/" + c .VIP .String ())
125125
126126 log .Debugf ("%s %s %s %s %s" ,
127127 "curl" ,
128128 "--ipv4" ,
129129 "-u" , user + ":XXXXXX" ,
130- "https://robot-ws.your-server.de/failover/" + c .IPConfiguration . VIP .String ())
130+ "https://robot-ws.your-server.de/failover/" + c .VIP .String ())
131131 }
132132
133133 out , err := cmd .Output ()
@@ -164,7 +164,7 @@ func (c *HetznerConfigurer) getActiveIPFromJSON(str string) (net.IP, error) {
164164 errormap ["status" ].(float64 ),
165165 errormap ["code" ].(string ),
166166 errormap ["message" ].(string ))
167- return nil , errors .New ("Hetzner API returned error response " )
167+ return nil , errors .New ("error response from Hetzner API returned" )
168168 }
169169
170170 if f ["failover" ] != nil {
@@ -202,9 +202,10 @@ func (c *HetznerConfigurer) queryAddress() bool {
202202 /** no need to check, we can use "cached" state if set.
203203 * if it is set to UNKNOWN, a check will be done.
204204 */
205- if c .cachedState == configured {
205+ switch c .cachedState {
206+ case configured :
206207 return true
207- } else if c . cachedState == released {
208+ case released :
208209 return false
209210 }
210211 }
0 commit comments