init: workspace opencode sync
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import librouteros
|
||||
|
||||
api = librouteros.connect('192.168.100.2', 'mi4', 'm14', port=8728)
|
||||
|
||||
print("=== Fixing scheduler on-event scripts ===")
|
||||
for item in list(api('/system/scheduler/print')):
|
||||
name = item['name']
|
||||
on_event = item.get('on-event', '')
|
||||
if ':pic' not in on_event:
|
||||
continue
|
||||
fixed = on_event.replace(':pic', ':pick')
|
||||
count = on_event.count(':pic')
|
||||
api('/system/scheduler/set', **{'.id': item['.id'], 'on-event': fixed})
|
||||
print(f" {name}: fixed {count} :pic -> :pick")
|
||||
|
||||
print("\n=== Fixing hotspot profile on-login scripts ===")
|
||||
for item in list(api('/ip/hotspot/user/profile/print')):
|
||||
name = item['name']
|
||||
on_login = item.get('on-login', '')
|
||||
if ':pic' not in on_login:
|
||||
continue
|
||||
fixed = on_login.replace(':pic', ':pick')
|
||||
count = on_login.count(':pic')
|
||||
api('/ip/hotspot/user/profile/set', **{'.id': item['.id'], 'on-login': fixed})
|
||||
print(f" {name}: fixed {count} :pic -> :pick")
|
||||
|
||||
print("\n=== Verification ===")
|
||||
still_broken = False
|
||||
for item in list(api('/system/scheduler/print')):
|
||||
if ':pic' in item.get('on-event', ''):
|
||||
print(f" BROKEN: {item['name']} scheduler still has :pic!")
|
||||
still_broken = True
|
||||
for item in list(api('/ip/hotspot/user/profile/print')):
|
||||
if ':pic' in item.get('on-login', ''):
|
||||
print(f" BROKEN: {item['name']} profile on-login still has :pic!")
|
||||
still_broken = True
|
||||
if not still_broken:
|
||||
print(" ALL FIXED - no :pic remaining")
|
||||
|
||||
api.close()
|
||||
print("\nDONE")
|
||||
Reference in New Issue
Block a user