]> git.ipfire.org Git - people/stevee/network.git/commitdiff
zone: new function zone_config_id_is_valid
authorJonatan Schlag <jonatan.schlag@ipfire.org>
Wed, 5 Jul 2017 14:19:47 +0000 (16:19 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 5 Jul 2017 15:10:05 +0000 (17:10 +0200)
This function is needed to implement the id feature
described in #11405

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/functions/functions.zone

index b44d3b5edfe20d569e19563ca5badbb4cf510a14..fcc7bfa31e6c261f13fa465998dc15df3efeccab 100644 (file)
@@ -1048,6 +1048,19 @@ zone_config_hook_is_configured() {
        return ${EXIT_FALSE}
 }
 
+zone_config_id_is_valid() {
+       # This function checks if a given id is valid for a zone
+       # Return True when yes and false when no
+
+       assert [ $# -eq 2 ]
+       local zone=${1}
+       local id=${2}
+
+       local zone_path=$(zone_dir ${zone})
+
+       [ -f ${zone_path}/configs/*.${id} ];
+}
+
 zone_has_ip() {
        device_has_ip $@
 }