lease-script: drop differentiation of assign / deassign...

... not that we have early locking.
This commit is contained in:
Christian Hesse 2021-07-15 12:47:05 +02:00
parent 9509371690
commit 8e2c783068
9 changed files with 12 additions and 15 deletions

View file

@ -6,7 +6,7 @@
# collect wireless mac adresses in access list # collect wireless mac adresses in access list
# https://git.eworm.de/cgit/routeros-scripts/about/doc/collect-wireless-mac.md # https://git.eworm.de/cgit/routeros-scripts/about/doc/collect-wireless-mac.md
# #
# provides: lease-script, assign, order=40 # provides: lease-script, order=40
# #
# !! Do not edit this file, it is generated from template! # !! Do not edit this file, it is generated from template!

View file

@ -6,7 +6,7 @@
# collect wireless mac adresses in access list # collect wireless mac adresses in access list
# https://git.eworm.de/cgit/routeros-scripts/about/doc/collect-wireless-mac.md # https://git.eworm.de/cgit/routeros-scripts/about/doc/collect-wireless-mac.md
# #
# provides: lease-script, assign, order=40 # provides: lease-script, order=40
# #
# !! Do not edit this file, it is generated from template! # !! Do not edit this file, it is generated from template!

View file

@ -6,7 +6,7 @@
# collect wireless mac adresses in access list # collect wireless mac adresses in access list
# https://git.eworm.de/cgit/routeros-scripts/about/doc/collect-wireless-mac.md # https://git.eworm.de/cgit/routeros-scripts/about/doc/collect-wireless-mac.md
# #
# provides: lease-script, assign, order=40 # provides: lease-script, order=40
# #
# !! This is just a template! Replace '%PATH%' with 'caps-man' # !! This is just a template! Replace '%PATH%' with 'caps-man'
# !! or 'interface wireless'! # !! or 'interface wireless'!

View file

@ -3,7 +3,7 @@
# Copyright (c) 2013-2021 Christian Hesse <mail@eworm.de> # Copyright (c) 2013-2021 Christian Hesse <mail@eworm.de>
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md # https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
# #
# provides: lease-script, assign, order=60 # provides: lease-script, order=60
# #
# update dhcp-server lease comment with infos from access-list # update dhcp-server lease comment with infos from access-list
# https://git.eworm.de/cgit/routeros-scripts/about/doc/dhcp-lease-comment.md # https://git.eworm.de/cgit/routeros-scripts/about/doc/dhcp-lease-comment.md

View file

@ -3,7 +3,7 @@
# Copyright (c) 2013-2021 Christian Hesse <mail@eworm.de> # Copyright (c) 2013-2021 Christian Hesse <mail@eworm.de>
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md # https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
# #
# provides: lease-script, assign, order=60 # provides: lease-script, order=60
# #
# update dhcp-server lease comment with infos from access-list # update dhcp-server lease comment with infos from access-list
# https://git.eworm.de/cgit/routeros-scripts/about/doc/dhcp-lease-comment.md # https://git.eworm.de/cgit/routeros-scripts/about/doc/dhcp-lease-comment.md

View file

@ -3,7 +3,7 @@
# Copyright (c) 2013-2021 Christian Hesse <mail@eworm.de> # Copyright (c) 2013-2021 Christian Hesse <mail@eworm.de>
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md # https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
# #
# provides: lease-script, assign, order=60 # provides: lease-script, order=60
# #
# update dhcp-server lease comment with infos from access-list # update dhcp-server lease comment with infos from access-list
# https://git.eworm.de/cgit/routeros-scripts/about/doc/dhcp-lease-comment.md # https://git.eworm.de/cgit/routeros-scripts/about/doc/dhcp-lease-comment.md

View file

@ -3,7 +3,7 @@
# Copyright (c) 2013-2021 Christian Hesse <mail@eworm.de> # Copyright (c) 2013-2021 Christian Hesse <mail@eworm.de>
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md # https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
# #
# provides: lease-script, assign, deassign, order=20 # provides: lease-script, order=20
# #
# check DHCP leases and add/remove/update DNS entries # check DHCP leases and add/remove/update DNS entries
# https://git.eworm.de/cgit/routeros-scripts/about/doc/dhcp-to-dns.md # https://git.eworm.de/cgit/routeros-scripts/about/doc/dhcp-to-dns.md

View file

@ -3,7 +3,7 @@
# Copyright (c) 2021 Christian Hesse <mail@eworm.de> # Copyright (c) 2021 Christian Hesse <mail@eworm.de>
# https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md # https://git.eworm.de/cgit/routeros-scripts/about/COPYING.md
# #
# provides: lease-script, assign, order=80 # provides: lease-script, order=80
# #
# manage and clean up private WPA passphrase after hotspot login # manage and clean up private WPA passphrase after hotspot login
# https://git.eworm.de/cgit/routeros-scripts/about/doc/hotspot-to-wpa.md # https://git.eworm.de/cgit/routeros-scripts/about/doc/hotspot-to-wpa.md

View file

@ -28,11 +28,10 @@ $ScriptLock $0 false 10;
$LogPrintExit2 debug $0 ("More invocations are waiting, exiting early.") true; $LogPrintExit2 debug $0 ("More invocations are waiting, exiting early.") true;
} }
:local State ([ $IfThenElse ($leaseBound = 0) "de" "" ] . "assign"); $LogPrintExit2 debug $0 ("DHCP Server " . $leaseServerName . " " . [ $IfThenElse ($leaseBound = 0) \
:local RunOrder [ :toarray "" ]; "de" "" ] . "assigned lease " . $leaseActIP . " to " . $leaseActMAC) false;
$LogPrintExit2 debug $0 ("DHCP Server " . $leaseServerName . " " . \ :local RunOrder [ :toarray "" ];
$State . "ed lease " . $leaseActIP . " to " . $leaseActMAC) false;
:foreach Script in=[ / system script find where source~("\n# provides: lease-script, ") ] do={ :foreach Script in=[ / system script find where source~("\n# provides: lease-script, ") ] do={
:local Name [ / system script get $Script name ]; :local Name [ / system script get $Script name ];
@ -42,9 +41,7 @@ $LogPrintExit2 debug $0 ("DHCP Server " . $leaseServerName . " " . \
:set Store [ :pick $Store 0 [ :find $Store "\n" ] ]; :set Store [ :pick $Store 0 [ :find $Store "\n" ] ];
:set Store [ $ParseKeyValueStore $Store ]; :set Store [ $ParseKeyValueStore $Store ];
:if (($Store->$State) = true) do={
:set ($RunOrder->($Store->"order")) $Name; :set ($RunOrder->($Store->"order")) $Name;
}
} }
:foreach Order,Script in=$RunOrder do={ :foreach Order,Script in=$RunOrder do={