Bugzilla – Attachment 60109 Details for
Bug 16749
Additional fixes for debian scripts
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16749: Adjust xmlstarlet calls in koha-functions
Bug-16749-Adjust-xmlstarlet-calls-in-koha-function.patch (text/plain), 3.08 KB, created by
Marcel de Rooy
on 2017-02-10 11:19:01 UTC
(
hide
)
Description:
Bug 16749: Adjust xmlstarlet calls in koha-functions
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2017-02-10 11:19:01 UTC
Size:
3.08 KB
patch
obsolete
>From 6f3fa38344e0f15062064b27ebb8c63d9581ee67 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Fri, 10 Feb 2017 09:37:13 +0100 >Subject: [PATCH] Bug 16749: Adjust xmlstarlet calls in koha-functions >Content-Type: text/plain; charset=utf-8 > >In various scripts we use xmlstarlet to extract values from koha-conf. >If we call xmlstarlet on non-existing entries in koha-conf, this may >however result in silently failing scripts. >A function run_safe_xmlstarlet is added for situations where the entry >might not be there. No need to use it everywhere rightaway. > >This patch only adjusts koha-functions and modifies the xmlstarlet calls >for dev_install and zebra_loglevels. > >Test plan: >[1] Apply the patch for koha-plack too. >[2] Copy koha-functions.sh and koha-plack from clone to default locations. >[3] Start and stop koha-plack while you have dev_install in koha-conf. > Verify with ps aux|grep plack. >[4] Rename dev_install to nodev_install and start/stop koha-plack. > Verify with ps aux|grep plack. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Tested on a Debian VM and with a Windows kohadevbox :) >--- > debian/scripts/koha-functions.sh | 26 +++++++++++++++++++------- > 1 file changed, 19 insertions(+), 7 deletions(-) > >diff --git a/debian/scripts/koha-functions.sh b/debian/scripts/koha-functions.sh >index 167998e..30b64cd 100755 >--- a/debian/scripts/koha-functions.sh >+++ b/debian/scripts/koha-functions.sh >@@ -222,16 +222,14 @@ adjust_paths_dev_install() > # corresponding tag in koha-conf.xml > > local instancename=$1 >- local dev_install >- >- if [ -e /etc/koha/sites/$instancename/koha-conf.xml ]; then >- dev_install=$(xmlstarlet sel -t -v 'yazgfs/config/dev_install' /etc/koha/sites/$instancename/koha-conf.xml) >- fi >+ local dev_install=$(run_safe_xmlstarlet $instancename dev_install) > > if [ "$dev_install" != "" ]; then > DEV_INSTALL=1 > KOHA_HOME=$dev_install > PERL5LIB=$dev_install >+ else >+ DEV_INSTALL=0 > fi > } > >@@ -244,13 +242,12 @@ get_instances() > get_loglevels() > { > local instancename=$1 >- local retval=$(xmlstarlet sel -t -v 'yazgfs/config/zebra_loglevels' /etc/koha/sites/$instancename/koha-conf.xml) >+ local retval=$(run_safe_xmlstarlet $instancename zebra_loglevels) > if [ "$retval" != "" ]; then > echo "$retval" > else > echo "none,fatal,warn" > fi >- > } > > get_tmpdir() >@@ -272,3 +269,18 @@ get_tmpdir() > fi > echo $(dirname $retval) > } >+ >+run_safe_xmlstarlet() >+{ >+ # When running xmlstarlet and the expr is not found, the script may fail >+ # silently under certain conditions. For instance, script koha-plack >+ # failed under kohadevbox/jessie. Until we resolve that, this function >+ # does a grep first (assuming a unique tag). >+ local instancename=$1 >+ local myexpr=$2 >+ if [ -e /etc/koha/sites/$instancename/koha-conf.xml ] && grep -q "<$myexpr>" /etc/koha/sites/$instancename/koha-conf.xml; then >+ echo $(xmlstarlet sel -t -v "yazgfs/config/$myexpr" /etc/koha/sites/$instancename/koha-conf.xml) >+ return 0 >+ fi >+ return 1 >+} >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 16749
:
52561
|
55490
|
60064
|
60103
|
60106
|
60109
|
60110
|
60111
|
60112
|
60113
|
60114
|
60125
|
60126
|
60129
|
60130
|
60131
|
60132
|
60139
|
60140
|
60193
|
60194
|
60195
|
60196
|
60197
|
60335
|
60340
|
60343
|
60344
|
60345
|
60346
|
60347
|
60348
|
60349
|
60350