Bug 15714: Add get_loglevels to koha-functions.sh
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Mon, 1 Feb 2016 14:36:26 +0000 (15:36 +0100)
committerBrendan Gallagher <brendan@bywatersolutions.com>
Wed, 24 Feb 2016 03:38:17 +0000 (03:38 +0000)
Preparing for including different log levels in koha-start-zebra.
Note that the default response is none,fatal,warn; this is equal
to the options passed to zebrasrv in koha-start-zebra (for now).

Test plan:
[1] Run on the command line: source koha-functions.sh
[2] Type get_loglevels [your_instance]
    By default, you should see: none,fatal,warn
[3] Add this line to your koha-conf:
    <zebra_loglevels>how,are,you</zebra_loglevels>
[4] Run get_loglevels [your_instance] again.
    Remove the nonsense log levels again..

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
debian/scripts/koha-functions.sh

index 5ec633d..87a84a1 100755 (executable)
@@ -159,3 +159,15 @@ get_instances()
     find /etc/koha/sites -mindepth 1 -maxdepth 1\
                          -type d -printf '%f\n' | sort
 }
+
+get_loglevels()
+{
+    local instancename=$1
+    local retval=$(xmlstarlet sel -t -v 'yazgfs/config/zebra_loglevels' /etc/koha/sites/$instancename/koha-conf.xml)
+    if [ "$retval" != "" ]; then
+        echo "$retval"
+    else
+        echo "none,fatal,warn"
+    fi
+
+}