diff options
author | Christian Hesse <mail@eworm.de> | 2020-03-03 13:32:00 +0100 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2020-03-03 13:32:00 +0100 |
commit | 628ae1bd7098a4a898bf3fef0c202ae735014bec (patch) | |
tree | 13951ca4552be51c4621a60c5d1ed4dca9843af5 | |
parent | 4ccdec602ed668d50212177f31cea5bdf2b20ed2 (diff) |
bridge-port-to-default: use $ParseKeyValueStore...change-13
... and unbreak last commit removing delay (69352c90).
This requires a change in configuration syntax. Change this...
comment="default:br-local, alt:br-guest"
to...
comment="default=br-local, alt=br-guest"
-rw-r--r-- | bridge-port-to-default | 8 | ||||
-rw-r--r-- | global-config | 2 | ||||
-rw-r--r-- | global-config-overlay | 2 | ||||
-rw-r--r-- | global-config.changes | 1 | ||||
-rw-r--r-- | global-functions | 2 |
5 files changed, 8 insertions, 7 deletions
diff --git a/bridge-port-to-default b/bridge-port-to-default index 5b3af53..bc6b4b1 100644 --- a/bridge-port-to-default +++ b/bridge-port-to-default @@ -7,12 +7,12 @@ :global BridgePortTo; :global LogPrintExit; +:global ParseKeyValueStore; -:foreach BridgePort in=[ / interface bridge port find where comment!="" ] do={ +:foreach BridgePort in=[ / interface bridge port find where comment~"." ] do={ :local BridgePortVal [ / interface bridge port get $BridgePort ]; - :foreach Comment in=[ :toarray ($BridgePortVal->"comment") ] do={ - :if ([ :pick $Comment 0 $Len ] = ($BridgePortTo . ":")) do={ - :local BridgeDefault [ :pick $Comment $Len [ :len $Comment ] ]; + :foreach Config,BridgeDefault in=[ $ParseKeyValueStore ($BridgePortVal->"comment") ] do={ + :if ($Config = $BridgePortTo) do={ :if ($BridgeDefault = "dhcp-client") do={ :if ($BridgePortVal->"disabled" = false) do={ $LogPrintExit info ("Disabling bridge port for interface " . $BridgePortVal->"interface" . ", enabling dhcp client.") false; diff --git a/global-config b/global-config index a55a9d6..22fbf87 100644 --- a/global-config +++ b/global-config @@ -6,7 +6,7 @@ # Make sure all configuration properties are up to date and this # value is in sync with value in script 'global-functions'! -:global GlobalConfigVersion 12; +:global GlobalConfigVersion 13; # This is used for DNS and backup file. :global Domain "example.com"; diff --git a/global-config-overlay b/global-config-overlay index e2c8909..b6a983f 100644 --- a/global-config-overlay +++ b/global-config-overlay @@ -7,7 +7,7 @@ # Make sure all configuration properties are up to date and this # value is in sync with value in script 'global-functions'! # Comment or remove to disable change notifications. -:global GlobalConfigVersion 12; +:global GlobalConfigVersion 13; # The global-config script is updated by script-updates, # global-config-overlay becomes an overlay for your changes. diff --git a/global-config.changes b/global-config.changes index a22f3b4..6df7cfd 100644 --- a/global-config.changes +++ b/global-config.changes @@ -15,4 +15,5 @@ 10="make health threshold for voltage configurable"; 11="introduced function '\$ScriptInstallUpdate' to install new and update existing scripts"; 12="removed '\$ScriptUpdatesConfigChangesIgnore', comment '\$GlobalConfigVersion' in 'global-config-overlay' to disable change notifications"; + 13="configuration for script 'bridge-port-to-default' changed with new syntax in comment"; }; diff --git a/global-functions b/global-functions index cc8ca20..8acc351 100644 --- a/global-functions +++ b/global-functions @@ -6,7 +6,7 @@ # global functions # expected configuration version -:global ExpectedConfigVersion 12; +:global ExpectedConfigVersion 13; # global variables not to be changed by user :global Identity [ / system identity get name ]; |