Commit ec18c7be authored by Sigmund Augdal's avatar Sigmund Augdal

Added some function docstrings

parent 9a0964ca
......@@ -15,6 +15,9 @@ HAPROXY_CHECK_URL = "http://localhost:1936/haproxy_up"
def check_state(interface):
"""
Checks downstream status to determine which state we should announce upstream
"""
try:
response = requests.get(HAPROXY_CHECK_URL, timeout=1)
response.raise_for_status()
......@@ -29,6 +32,9 @@ def check_state(interface):
def set_state(new_state):
"""
Sets announced state
"""
if new_state not in ("up", "down", "admin"):
raise ValueError("Invalid new state: {}".format(new_state))
subprocess.call(["/usr/local/bin/bfdd-control", "session", "all", "state", new_state])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment