From abc8fb8947d87b92faaed3a23cc663235c796cb9 Mon Sep 17 00:00:00 2001 From: George Hunt Date: Fri, 17 May 2019 19:09:53 -0700 Subject: [PATCH 1/8] replace extract_region_from_filename- use re --- roles/osm-vector-maps/templates/iiab-update-map | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/roles/osm-vector-maps/templates/iiab-update-map b/roles/osm-vector-maps/templates/iiab-update-map index 3d72bba62..837bc9e85 100755 --- a/roles/osm-vector-maps/templates/iiab-update-map +++ b/roles/osm-vector-maps/templates/iiab-update-map @@ -192,14 +192,11 @@ def fetch_menu_json_value(key): return data.get(key,'') def extract_region_from_filename(fname): - substitutions = { "north": "north_america",\ - "central": "central_america",\ - "southeast": "southeast_asia", - "south": "south_america" } - # wish I had used - as separator between key and date - nibble = fname.split('_')[0] - nibble = substitutions.get(nibble,nibble) - return(nibble) + nibble = re.search(r"^.._osm_..._(.*)_[0-9]{4}",fname) + if not nibble: + return("maplist") + resp = nibble.group(1) + return(resp) if __name__ == '__main__': if console_installed: From 7eae142a62aed1954cb02e27a3e4e4fbfacb0a02 Mon Sep 17 00:00:00 2001 From: George Hunt Date: Fri, 17 May 2019 21:53:57 -0700 Subject: [PATCH 2/8] use regular expressions to break apart filename --- roles/osm-vector-maps/templates/iiab-update-map | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/roles/osm-vector-maps/templates/iiab-update-map b/roles/osm-vector-maps/templates/iiab-update-map index 837bc9e85..278352cfd 100755 --- a/roles/osm-vector-maps/templates/iiab-update-map +++ b/roles/osm-vector-maps/templates/iiab-update-map @@ -54,7 +54,6 @@ def main(): # For installed regions, check that a menu def exists, and it's on home page for fname in installed_maps: region = extract_region_from_filename(fname) - print('checking for %s region'%region) if region == 'maplist': # it is the splash page, display only if no others menu_ref = 'en-map_test' item = { "perma_ref" : "en-map_test" } @@ -128,6 +127,7 @@ def write_vector_map_idx(installed_maps): region = extract_region_from_filename(fname) if map == 'maplist': continue # not a real region map_dict = map_catalog['regions'].get(region,'') + print('check for %s in %s'%(region,map_dict)) if map_dict == '': continue # Create the idx file in format required bo js-menu system @@ -192,11 +192,13 @@ def fetch_menu_json_value(key): return data.get(key,'') def extract_region_from_filename(fname): - nibble = re.search(r"^.._osm_..._(.*)_[0-9]{4}",fname) - if not nibble: + # find the index of the date + nibble = re.search(r"\d{4}-\d{2}-\d{2}",fname) + if nibble: + fname = fname[:nibble.start()-1] + return fname + else: return("maplist") - resp = nibble.group(1) - return(resp) if __name__ == '__main__': if console_installed: From ff9cbf68f2cc6988ca158cf37a020c8c825aa515 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 19 May 2019 13:27:47 -0400 Subject: [PATCH 3/8] Move osm-vector-maps install to 7-edu-apps stage ? --- roles/4-server-options/tasks/main.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/roles/4-server-options/tasks/main.yml b/roles/4-server-options/tasks/main.yml index 8974085e3..4c56b0572 100644 --- a/roles/4-server-options/tasks/main.yml +++ b/roles/4-server-options/tasks/main.yml @@ -13,12 +13,6 @@ when: named_install tags: base, named, network, domain -- name: Installing vector map test page - include_role: - name: osm-vector-maps - when: osm_vector_maps_install - tags: base, map - - name: Installing captive portal include_tasks: roles/captive-portal/tasks/main.yml when: captive_portal_install From 2e8a1afb3dbf84ef6be54c459670a5b641e0448a Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 19 May 2019 13:29:19 -0400 Subject: [PATCH 4/8] Moving osm-vector-maps install from 4-server-options? --- roles/7-edu-apps/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/7-edu-apps/tasks/main.yml b/roles/7-edu-apps/tasks/main.yml index 4d3db3278..30b1ac489 100644 --- a/roles/7-edu-apps/tasks/main.yml +++ b/roles/7-edu-apps/tasks/main.yml @@ -27,7 +27,7 @@ when: moodle_install tags: olpc, moodle -- name: OSM_VECTOR_MAPS +- name: OSM-VECTOR-MAPS include_role: name: osm-vector-maps when: osm_vector_maps_install From 6abc8e0d5bdd6eadf0595a5cd80583c46eacc8b1 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 19 May 2019 13:35:31 -0400 Subject: [PATCH 5/8] Ansible tags osm & maps (it was 3 tags, now it's 2!) --- roles/7-edu-apps/tasks/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/roles/7-edu-apps/tasks/main.yml b/roles/7-edu-apps/tasks/main.yml index 30b1ac489..6acb282d9 100644 --- a/roles/7-edu-apps/tasks/main.yml +++ b/roles/7-edu-apps/tasks/main.yml @@ -31,14 +31,14 @@ include_role: name: osm-vector-maps when: osm_vector_maps_install - tags: osm + tags: osm, maps # UNMAINTAINED - name: OSM include_role: name: osm when: osm_install is defined and osm_install - tags: osm + tags: osm, maps # UNMAINTAINED - name: PATHAGAR From 72a7fead217bb9aa4ff9ccb507a2453a237a1f30 Mon Sep 17 00:00:00 2001 From: A Holt Date: Sun, 19 May 2019 19:25:03 -0400 Subject: [PATCH 6/8] kiwix-tools 1.2.0 -> 1.2.1 --- roles/kiwix/defaults/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/roles/kiwix/defaults/main.yml b/roles/kiwix/defaults/main.yml index e9fbd0f7d..b4832ab97 100644 --- a/roles/kiwix/defaults/main.yml +++ b/roles/kiwix/defaults/main.yml @@ -10,9 +10,9 @@ # Which kiwix-tools to download from http://download.iiab.io/packages/ # As obtained from http://download.kiwix.org/release/kiwix-tools/ or http://download.kiwix.org/nightly/ -kiwix_version_armhf: "kiwix-tools_linux-armhf-1.2.0" -kiwix_version_linux64: "kiwix-tools_linux-x86_64-1.2.0" -kiwix_version_i686: "kiwix-tools_linux-i586-1.2.0" +kiwix_version_armhf: "kiwix-tools_linux-armhf-1.2.1" +kiwix_version_linux64: "kiwix-tools_linux-x86_64-1.2.1" +kiwix_version_i686: "kiwix-tools_linux-i586-1.2.1" # kiwix_src_file_i686: "kiwix-linux-i686.tar.bz2" # v0.9 for i686 published May 2014 ("use it to test legacy ZIM content") # v0.10 for i686 published Oct 2016 ("experimental") REPLACED IN EARLY 2018, thx to Matthieu Gautier: From a5088f063d1e171d57cdd99f7bf4d56031ac1eef Mon Sep 17 00:00:00 2001 From: George Hunt Date: Sun, 19 May 2019 17:07:01 -0700 Subject: [PATCH 7/8] permit omt and sat to be used in filename --- roles/osm-vector-maps/templates/iiab-update-map | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/roles/osm-vector-maps/templates/iiab-update-map b/roles/osm-vector-maps/templates/iiab-update-map index 837bc9e85..d38bb0b7d 100755 --- a/roles/osm-vector-maps/templates/iiab-update-map +++ b/roles/osm-vector-maps/templates/iiab-update-map @@ -105,7 +105,7 @@ def get_installed_regions(): os.chdir(map_doc_root) for filename in os.listdir('.'): if fnmatch.fnmatch(filename, '??-osm-omt*'): - region = re.sub(r'^..-osm-omt_(.*)',r'\1',filename) + region = re.sub(r'^..-osm-..._(.*)',r'\1',filename) installed.append(region) # add the splash page if no other maps are present if len(installed) == 0: From 9a899b43141af853a12bcb8ae30ed21f88237e16 Mon Sep 17 00:00:00 2001 From: George Hunt Date: Sun, 19 May 2019 17:12:49 -0700 Subject: [PATCH 8/8] remove debug print statement --- roles/osm-vector-maps/templates/iiab-update-map | 1 - 1 file changed, 1 deletion(-) diff --git a/roles/osm-vector-maps/templates/iiab-update-map b/roles/osm-vector-maps/templates/iiab-update-map index e80d869ae..0e312d705 100755 --- a/roles/osm-vector-maps/templates/iiab-update-map +++ b/roles/osm-vector-maps/templates/iiab-update-map @@ -127,7 +127,6 @@ def write_vector_map_idx(installed_maps): region = extract_region_from_filename(fname) if map == 'maplist': continue # not a real region map_dict = map_catalog['regions'].get(region,'') - print('check for %s in %s'%(region,map_dict)) if map_dict == '': continue # Create the idx file in format required bo js-menu system