diff --git a/roles/kiwix/templates/iiab-make-kiwix-lib b/roles/kiwix/templates/iiab-make-kiwix-lib index 083b87116..e69271949 100644 --- a/roles/kiwix/templates/iiab-make-kiwix-lib +++ b/roles/kiwix/templates/iiab-make-kiwix-lib @@ -19,10 +19,16 @@ if flock -n -e 200; then : # write to {{ kiwix_library_xml }}.tmp to minimize kiwix down # zim map could be out of sync for a few seconds # using new version that does deltas - cp $KIWIXLIB $KIWIXLIB.tmp - /usr/bin/iiab-make-kiwix-lib.py + if [ -f $KIWIXLIB ]; then + cp $KIWIXLIB $KIWIXLIB.tmp + /usr/bin/iiab-make-kiwix-lib.py + else + /usr/bin/iiab-make-kiwix-lib.py -f # force rebuild of library.xml + fi {{ systemctl_program }} stop kiwix-serve - rm $KIWIXLIB + if [ -f $KIWIXLIB ]; then + rm $KIWIXLIB + fi mv $KIWIXLIB.tmp $KIWIXLIB {{ systemctl_program }} start kiwix-serve else diff --git a/roles/pylibs/templates/iiab_lib.py b/roles/pylibs/templates/iiab_lib.py index 84dee97e3..ef9da7e82 100644 --- a/roles/pylibs/templates/iiab_lib.py +++ b/roles/pylibs/templates/iiab_lib.py @@ -85,8 +85,9 @@ def read_library_xml(lib_xml_file, kiwix_exclude_attr=["favicon"]): # duplicated attributes[attr] = child.attrib[attr] # copy if not id or in exclusion list zims_installed[zim_id] = attributes path_to_id_map[child.attrib['path']] = zim_id - except IOError: + except: # though I try how can I carry on zims_installed = {} + path_to_id_map = {} return zims_installed, path_to_id_map def rem_libr_xml(zim_id, kiwix_library_xml):