Skip to content

Commit 8b37f0f

Browse files
committed
fix: add STOP state
1 parent 6d276e7 commit 8b37f0f

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

robot_failover.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,7 @@ def has_ip(ip_bin_path, ip, interface):
5959

6060
def change_request(endstate, url, header, target_ip, ip_bin_path, floating_ip, interface, dummy_interface):
6161
log_prefix = "[%s -> %s] S " % (url, target_ip)
62-
if endstate == "BACKUP":
63-
del_ip(ip_bin_path, floating_ip, interface)
64-
if dummy_interface:
65-
add_ip(ip_bin_path, floating_ip, dummy_interface)
66-
elif endstate == "FAULT":
62+
if endstate == "BACKUP" or endstate == "FAULT" or endstate == "STOP":
6763
del_ip(ip_bin_path, floating_ip, interface)
6864
if dummy_interface:
6965
add_ip(ip_bin_path, floating_ip, dummy_interface)
@@ -117,7 +113,7 @@ def change_request(endstate, url, header, target_ip, ip_bin_path, floating_ip, i
117113
sleep(120)
118114

119115
else:
120-
normal_log("Error: Endstate not defined!")
116+
normal_log(f"Error: Endstate {endstate} not defined!")
121117

122118

123119
def main(arg_vrouter, arg_type, arg_name, arg_endstate):

0 commit comments

Comments
 (0)