Bugzilla – Attachment 148329 Details for
Bug 33108
We need a way to launch the ES indexer automatically
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33108: Teach koha-list filter elasticsearch
Bug-33108-Teach-koha-list-filter-elasticsearch.patch (text/plain), 13.77 KB, created by
Jonathan Druart
on 2023-03-17 11:32:38 UTC
(
hide
)
Description:
Bug 33108: Teach koha-list filter elasticsearch
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-03-17 11:32:38 UTC
Size:
13.77 KB
patch
obsolete
>From f312503ff0c5c6a701b8b40d463c20fdfd48a9ef Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 1 Mar 2023 15:46:26 -0300 >Subject: [PATCH] Bug 33108: Teach koha-list filter elasticsearch > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > debian/docs/koha-list.xml | 13 +++ > debian/koha-common.bash-completion | 6 +- > debian/koha-core.bash-completion | 6 +- > debian/scripts/koha-list | 169 +++++++++++++++++------------ > 4 files changed, 123 insertions(+), 71 deletions(-) > >diff --git a/debian/docs/koha-list.xml b/debian/docs/koha-list.xml >index 828831a23fc..1e63698353b 100644 >--- a/debian/docs/koha-list.xml >+++ b/debian/docs/koha-list.xml >@@ -25,6 +25,7 @@ > <cmdsynopsis> > <command>koha-list</command> > <arg><option>--enabled</option>|<option>--disabled</option></arg> >+ <arg><option>--elasticsearch</option>|<option>--noelasticsearch</option></arg> > <arg><option>--email</option>|<option>--noemail</option></arg> > <arg><option>--sip</option>|<option>--nosip</option></arg> > <arg><option>--plack</option>|<option>--noplack</option></arg> >@@ -47,6 +48,18 @@ > <para>Only show instances that are disabled.</para> > </listitem> > </varlistentry> >+ <varlistentry> >+ <term><option>--elasticsearch</option></term> >+ <listitem> >+ <para>Only show instances that have elasticsearch enabled.</para> >+ </listitem> >+ </varlistentry> >+ <varlistentry> >+ <term><option>--noelasticsearch</option></term> >+ <listitem> >+ <para>Only show instances that do not have elasticsearch enabled.</para> >+ </listitem> >+ </varlistentry> > <varlistentry> > <term><option>--email</option></term> > <listitem> >diff --git a/debian/koha-common.bash-completion b/debian/koha-common.bash-completion >index aacb841ea63..64560860195 100644 >--- a/debian/koha-common.bash-completion >+++ b/debian/koha-common.bash-completion >@@ -131,7 +131,7 @@ _koha_list() > > COMPREPLY=() > _get_comp_words_by_ref cur >- opts="--enabled --disabled --email --noemail --plack --noplack --sip --nosip --help -h" >+ opts="--enabled --disabled --email --noemail --plack --noplack --sip --nosip --help -h --elasticsearch --noelasticsearch" > > # Build a list of the already used option switches > for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do >@@ -141,6 +141,10 @@ _koha_list() > substract="$substract -e --enabled"; ;; > --enabled) > substract="$substract -e --disabled"; ;; >+ --elasticsearch) >+ substract="$substract -e --noelasticsearch"; ;; >+ --noelasticsearch) >+ substract="$substract -e --elasticsearch"; ;; > --email) > substract="$substract -e --noemail"; ;; > --noemail) >diff --git a/debian/koha-core.bash-completion b/debian/koha-core.bash-completion >index 8ee72320bfa..296e1da85f1 100644 >--- a/debian/koha-core.bash-completion >+++ b/debian/koha-core.bash-completion >@@ -131,7 +131,7 @@ _koha_list() > > COMPREPLY=() > _get_comp_words_by_ref cur >- opts="--enabled --disabled --email --noemail --plack --noplack --sip --nosip --help -h" >+ opts="--enabled --disabled --email --noemail --plack --noplack --sip --nosip --help -h --elasticsearch --noelasticsearch" > > # Build a list of the already used option switches > for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do >@@ -141,6 +141,10 @@ _koha_list() > substract="$substract -e --enabled"; ;; > --enabled) > substract="$substract -e --disabled"; ;; >+ --elasticsearch) >+ substract="$substract -e --noelasticsearch"; ;; >+ --noelasticsearch) >+ substract="$substract -e --elasticsearch"; ;; > --email) > substract="$substract -e --noemail"; ;; > --noemail) >diff --git a/debian/scripts/koha-list b/debian/scripts/koha-list >index a88d37b8929..3f3fcc90f28 100755 >--- a/debian/scripts/koha-list >+++ b/debian/scripts/koha-list >@@ -29,37 +29,21 @@ fi > > show_instances() > { >- local show=$1 >- local show_email=$2 >- local show_sip=$3 >- > for instance in $( get_instances ); do > case $show in > "all") >- if instance_filter_email $instance $show_email && \ >- instance_filter_letsencrypt $instance $show_letsencrypt && \ >- instance_filter_plack $instance $show_plack && \ >- instance_filter_z3950 $instance $show_z3950 && \ >- instance_filter_sip $instance $show_sip; then >- echo $instance >+ if filter_ok $instance; then >+ echo $instance > fi ;; > "enabled") > if is_enabled $instance; then >- if instance_filter_email $instance $show_email && \ >- instance_filter_letsencrypt $instance $show_letsencrypt && \ >- instance_filter_plack $instance $show_plack && \ >- instance_filter_z3950 $instance $show_z3950 && \ >- instance_filter_sip $instance $show_sip; then >+ if filter_ok $instance; then > echo $instance > fi > fi ;; > "disabled") > if ! is_enabled $instance; then >- if instance_filter_email $instance $show_email && \ >- instance_filter_letsencrypt $instance $show_letsencrypt && \ >- instance_filter_plack $instance $show_plack && \ >- instance_filter_z3950 $instance $show_z3950 && \ >- instance_filter_sip $instance $show_sip; then >+ if filter_ok $instance; then > echo $instance > fi > fi ;; >@@ -67,21 +51,35 @@ show_instances() > done > } > >+filter_ok() >+{ >+ local instance=$1 >+ >+ if instance_filter_email $instance && \ >+ instance_filter_elasticsearch $instance && \ >+ instance_filter_letsencrypt $instance && \ >+ instance_filter_plack $instance && \ >+ instance_filter_z3950 $instance && \ >+ instance_filter_sip $instance; then >+ return 0; >+ else >+ return 1; >+ fi >+} > > instance_filter_sip() > { >- local instancename=$1 >- local show_sip=$2; >+ local instance=$1 > > case $show_sip in > "all") > return 0 ;; > "enabled") >- if is_sip_enabled $instancename; then >+ if is_sip_enabled $instance; then > return 0 > fi ;; > "disabled") >- if ! is_sip_enabled $instancename; then >+ if ! is_sip_enabled $instance; then > return 0 > fi ;; > esac >@@ -92,18 +90,17 @@ instance_filter_sip() > > instance_filter_plack() > { >- local instancename=$1 >- local show_plack=$2; >+ local instance=$1 > > case $show_plack in > "all") > return 0 ;; > "enabled") >- if is_plack_enabled $instancename; then >+ if is_plack_enabled $instance; then > return 0 > fi ;; > "disabled") >- if ! is_plack_enabled $instancename; then >+ if ! is_plack_enabled $instance; then > return 0 > fi ;; > esac >@@ -114,18 +111,17 @@ instance_filter_plack() > > instance_filter_letsencrypt() > { >- local instancename=$1 >- local show_letsencrypt=$2; >+ local instance=$1 > > case $show_letsencrypt in > "all") > return 0 ;; > "enabled") >- if is_letsencrypt_enabled $instancename; then >+ if is_letsencrypt_enabled $instance; then > return 0 > fi ;; > "disabled") >- if ! is_letsencrypt_enabled $instancename; then >+ if ! is_letsencrypt_enabled $instance; then > return 0 > fi ;; > esac >@@ -136,18 +132,17 @@ instance_filter_letsencrypt() > > instance_filter_email() > { >- local instancename=$1 >- local show_email=$2; >+ local instance=$1 > > case $show_email in > "all") > return 0 ;; > "enabled") >- if is_email_enabled $instancename; then >+ if is_email_enabled $instance; then > return 0 > fi ;; > "disabled") >- if ! is_email_enabled $instancename; then >+ if ! is_email_enabled $instance; then > return 0 > fi ;; > esac >@@ -158,18 +153,38 @@ instance_filter_email() > > instance_filter_z3950() > { >- local instancename=$1 >- local show_z3950=$2; >+ local instance=$1 > > case $show_z3950 in > "all") > return 0 ;; > "enabled") >- if is_z3950_enabled $instancename; then >+ if is_z3950_enabled $instance; then > return 0 > fi ;; > "disabled") >- if ! is_z3950_enabled $instancename; then >+ if ! is_z3950_enabled $instance; then >+ return 0 >+ fi ;; >+ esac >+ >+ # Didn't match any criteria >+ return 1 >+} >+ >+instance_filter_elasticsearch() >+{ >+ local instance=$1 >+ >+ case $show_elasticsearch in >+ "all") >+ return 0 ;; >+ "enabled") >+ if is_elasticsearch_enabled $instance; then >+ return 0 >+ fi ;; >+ "disabled") >+ if ! is_elasticsearch_enabled $instance; then > return 0 > fi ;; > esac >@@ -189,6 +204,17 @@ set_show() > fi > } > >+set_show_elasticsearch() >+{ >+ local elasticsearch_param=$1 >+ >+ if [ "$show_elasticsearch" = "all" ]; then >+ show_elasticsearch=$elasticsearch_param >+ else >+ die "Error: --elasticsearch and --noelasticsearch are mutually exclusive." >+ fi >+} >+ > set_show_email() > { > local email_param=$1 >@@ -254,19 +280,21 @@ email turned on. > > Usage: $scriptname [--enabled|--disabled] [--email|--noemail] [--sip|--nosip] [-h] > Options: >- --enabled Show enabled instances >- --disabled Show disabled instances >- --email Show instances with email enabled >- --noemail Show instances with email disabled >- --sip Show instances with SIP enabled >- --nosip Show instances with SIP disabled >- --plack Show instances with Plack enabled >- --noplack Show instances with Plack disabled >- --letsencrypt Show instances with letsencrypt enabled >- --noletsencrypt Show instances with letsencrypt disabled >- --z3950 Show instances with Z39.50/SRU enabled >- --noz3950 Show instances with Z39.50/SRU disabled >- --help | -h Show this help >+ --enabled Show enabled instances >+ --disabled Show disabled instances >+ --elasticsearch Show instances with Elasticsearch enabled >+ --noelasticsarch Show instances with Elasticsearch disabled >+ --email Show instances with email enabled >+ --noemail Show instances with email disabled >+ --sip Show instances with SIP enabled >+ --nosip Show instances with SIP disabled >+ --plack Show instances with Plack enabled >+ --noplack Show instances with Plack disabled >+ --letsencrypt Show instances with letsencrypt enabled >+ --noletsencrypt Show instances with letsencrypt disabled >+ --z3950 Show instances with Z39.50/SRU enabled >+ --noz3950 Show instances with Z39.50/SRU disabled >+ --help | -h Show this help > > The filtering options can be combined, and you probably want to do this > (except --email and --noemail, or --enabled and --disabled, that's just silly.) >@@ -274,36 +302,39 @@ EOH > } > > show="all" >+show_elasticsearch="all" > show_email="all" > show_sip="all" > show_plack="all" > show_letsencrypt="all" > show_z3950="all" > >-args=$(getopt -l help,enabled,disabled,email,noemail,sip,nosip,plack,noplack,letsencrypt,noletsencrypt,z3950,noz3950 -o h -n $0 -- "$@") >+args=$(getopt -l help,enabled,disabled,elasticsearch,noelasticsearch,email,noemail,sip,nosip,plack,noplack,letsencrypt,noletsencrypt,z3950,noz3950 -o h -n $0 -- "$@") > set -- $args > > while [ ! -z "$1" ] > do > case "$1" in >- -h|--help) usage; exit;; >- --email) set_show_email "enabled" ;; >- --noemail) set_show_email "disabled" ;; >- --sip) set_show_sip "enabled" ;; >- --nosip) set_show_sip "disabled" ;; >- --plack) set_show_plack "enabled" ;; >- --noplack) set_show_plack "disabled" ;; >- --letsencrypt) set_show_letsencrypt "enabled" ;; >---noletsencrypt) set_show_letsencrypt "disabled" ;; >- --z3950) set_show_z3950 "enabled" ;; >- --noz3950) set_show_z3950 "disabled" ;; >- --enabled) set_show "enabled" ;; >- --disabled) set_show "disabled" ;; >- *) break;; >+ -h|--help) usage; exit;; >+ --email) set_show_email "enabled" ;; >+ --noemail) set_show_email "disabled" ;; >+ --sip) set_show_sip "enabled" ;; >+ --nosip) set_show_sip "disabled" ;; >+ --plack) set_show_plack "enabled" ;; >+ --noplack) set_show_plack "disabled" ;; >+ --letsencrypt) set_show_letsencrypt "enabled" ;; >+ --noletsencrypt) set_show_letsencrypt "disabled" ;; >+ --z3950) set_show_z3950 "enabled" ;; >+ --noz3950) set_show_z3950 "disabled" ;; >+ --elasticsearch) set_show_elasticsearch "enabled" ;; >+--noelasticsearch) set_show_elasticsearch "disabled" ;; >+ --enabled) set_show "enabled" ;; >+ --disabled) set_show "disabled" ;; >+ *) break;; > esac > shift > done > >-show_instances $show $show_email $show_sip >+show_instances > > exit 0 >-- >2.25.1
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 33108
:
147560
|
147574
|
147575
|
147576
|
147617
|
147618
|
147619
|
147620
|
147701
|
147702
|
148328
| 148329 |
148330
|
148331
|
148332