Skip to content

Commit

Permalink
Update ipverify_custom_action.py
Browse files Browse the repository at this point in the history
  • Loading branch information
phate999 committed Apr 25, 2024
1 parent ebcd562 commit fa26825
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions ipverify_custom_action/ipverify_custom_action.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# ipverify_custom_action - register function for callback on ipverify status change
# This example would use ipverify to ping a host over a VPN and the app will restart
# the VPN service if the ipverify test fails.
# This assumes the first ipverify test is the one we want to monitor.
#
# Log examples:
# 11:58:41 AM INFO ipverify_custom_action VPN Monitor Failed - Resetting Tunnel.
# 11:58:54 AM INFO ipverify_custom_action VPN Recovered.
# ipverify_uid is default uid for first ipverify test - modify as needed to match your test


from csclient import EventingCSClient
import time

ipverify_uid = '00000000-91a5-3a5b-ac9b-5ae6367d2d59'


def custom_action(path, value, *args):
if not value: # Test has failed
Expand All @@ -20,5 +21,6 @@ def custom_action(path, value, *args):

cp = EventingCSClient('ipverify_custom_action')
cp.log('Starting...')
ipverify_uid = cp.get('config/identities/ipverify/0/_id_')
cp.on('put', f'status/ipverify/{ipverify_uid}/pass', custom_action)
time.sleep(999999)

0 comments on commit fa26825

Please sign in to comment.