\n'
echo -e '2) Run:'
echo -e ' cd /opt/iiab/iiab'
diff --git a/roles/openvpn/templates/iiab-support b/roles/openvpn/templates/iiab-support
new file mode 100644
index 000000000..fe294bb38
--- /dev/null
+++ b/roles/openvpn/templates/iiab-support
@@ -0,0 +1,106 @@
+#!/bin/bash
+
+# openvpn_handle is stored in 2 files on disk, one slightly stripped down (from
+# the other) due to Ansible. So we emulate Ansible's behavior, when reading from
+# (and later writing to) disk, removing outer cruft as explained on Lines 27-29:
+handle1=$(grep "^openvpn_handle:" /etc/iiab/local_vars.yml | sed -e "s/^openvpn_handle://; s/^\s*//; s/\s*$//; s/^\(['\"]\)\(.*\)\1$/\2/")
+echo -e "\n/etc/iiab/local_vars.yml source/master copy: $handle1"
+if [ -f /etc/iiab/openvpn_handle ]; then
+ handle2=$(cat /etc/iiab/openvpn_handle)
+ echo -e "/etc/iiab/openvpn_handle for openvpn daemon: $handle2\n"
+else
+ echo -e "/etc/iiab/openvpn_handle for openvpn daemon: [FILE DOESN'T YET EXIST]\n"
+fi
+
+echo -e "\e[1mPlease type a descriptive OpenVPN machine name (openvpn_handle) such as:\n"
+
+echo -e " cape-town-school-36-rpi-2019-05-31\n"
+
+echo -en "Or hit [Enter] to keep the existing name:\e[0m "
+read ans < /dev/tty
+
+#if [ "$ans" != "" ] || ( [ "$handle1" = "" ] && [ ! -f /etc/iiab/openvpn_handle ] ); then
+# -v (below) checks if var's defined: equivalent to file existence test above
+if [ "$ans" != "" ] || ( [ "$handle1" = "" ] && [ ! -v handle2 ] ); then
+ if grep -q '^openvpn_handle:' /etc/iiab/local_vars.yml; then
+ sed -i "s/^openvpn_handle:.*/openvpn_handle: $ans/" /etc/iiab/local_vars.yml
+ else
+ echo "openvpn_handle: $ans" >> /etc/iiab/local_vars.yml
+ fi
+
+ # BEHAVIOR JUST LIKE ANSIBLE'S: create /etc/iiab/openvpn_handle from the
+ # "^openvpn_handle:" line in /etc/iiab/local_vars.yml by (1) removing outer
+ # spacing IF NEC, then (2) removing 1 pair of matching outer quotes IF NEC:
+ ans=$(echo $ans | sed -e "s/^\s*//; s/\s*$//; s/^\(['\"]\)\(.*\)\1$/\2/")
+ echo $ans > /etc/iiab/openvpn_handle
+ echo -e "\n\e[1mSAVED: openvpn_handle recorded into both above files.\e[0m\n"
+elif [ "$handle1" != "$handle2" ]; then # Sloppily, but conveniently here,
+ # bash treats "$handle2" as "" when var undefined, catching all conflicts!
+ echo -e "\n\e[41mYou MUST specify an OpenVPN machine name (openvpn_handle) to resolve the above\e[0m"
+ echo -e "\e[41mnaming conflict. Please rerun to proceed.\e[0m\n"
+ exit 1
+else
+ echo -e "\n\e[1mWARNING: openvpn_handle remains unchanged in both above files.\e[0m\n"
+fi
+
+if grep -q '^openvpn_install: True' /etc/iiab/local_vars.yml; then
+ echo -e "Your IIAB installation appears normal, with OpenVPN already installed...\n"
+else
+ echo -e "Please wait a few minutes as IIAB Stage 1 (1-prep) & OpenVPN are installed...\n"
+ if grep -q '^openvpn_install:' /etc/iiab/local_vars.yml; then
+ sed -i "s/^openvpn_install:.*/openvpn_install: True/" /etc/iiab/local_vars.yml
+ else
+ echo "openvpn_install: True" >> /etc/iiab/local_vars.yml
+ fi
+ cd /opt/iiab/iiab
+ ./runrole 1-prep
+ echo
+fi
+
+echo -e "Now let's (re)enable OpenVPN...\n"
+if grep -q '^openvpn_enabled:' /etc/iiab/local_vars.yml; then
+ sed -i "s/^openvpn_enabled:.*/openvpn_enabled: True/" /etc/iiab/local_vars.yml
+else
+ echo "openvpn_enabled: True" >> /etc/iiab/local_vars.yml
+fi
+systemctl enable openvpn
+
+echo -e "\nNow let's restart OpenVPN..."
+#systemctl start openvpn
+systemctl restart openvpn
+
+echo -en "\n "
+for i in {16..40} ; do echo -en "\e[48;5;${i}m \e[0m" ; done
+echo -en " OpenVPN TIPS "
+for i in {40..16} ; do echo -en "\e[48;5;${i}m \e[0m" ; done
+
+echo -e "\n\n 1. Check your Internet connection: run 'ping 8.8.8.8' and 'ping mit.edu'"
+echo -e " 2. Check your OpenVPN connection: run 'ping 10.8.0.1'"
+echo -e " 3. Run 'ip a' and look for a 'tun0' IP address like 10.8.0.x"
+echo -e " 4. If necessary, run 'systemctl restart openvpn' which should"
+echo -e " run 'systemctl restart openvpn@xscenet' for you."
+echo -e " 5. Sometimes waiting a minute helps -- retry steps 2 and 3 to monitor."
+echo -e " 6. If in future you want to disable OpenVPN connections to-and-from your"
+echo -e " Internet-in-a-Box (IIAB) please run 'iiab-support-off' at that time."
+echo -e " 7. Read 'How can I remotely manage my Internet-in-a-Box?' at"
+echo -e " http://FAQ.IIAB.IO to learn about DIY remote support alternatives"
+echo -e " like ngrok, serveo, remot3.it and TeamViewer.\n"
+
+echo -en " "
+for i in {16..40} ; do echo -en "\e[48;5;${i}m \e[0m" ; done
+echo -en " OpenVPN TIPS "
+for i in {40..16} ; do echo -en "\e[48;5;${i}m \e[0m" ; done
+
+echo -e "\n\nNow let's wait 15 seconds, as OpenVPN handshake sometimes needs that (or more!)"
+sleep 15
+
+echo -en "\nYour OpenVPN machine name (openvpn_handle) is: \e[32m"
+cat /etc/iiab/openvpn_handle
+echo -en "\e[0m"
+
+vpnip=$(ip a | grep tun0$ | awk '{print $2}')
+if [ "$vpnip" != "" ]; then
+ echo -e "\nYour OpenVPN IP address (which can change) is: \e[32m$vpnip\e[0m\n"
+else
+ echo -e "\n \e[41m ERROR: OpenVPN IP address not ready - PLEASE TRY THE ABOVE TIPS \e[0m\n"
+fi
diff --git a/roles/osm-vector-maps/defaults/main.yml b/roles/osm-vector-maps/defaults/main.yml
new file mode 100644
index 000000000..71404b928
--- /dev/null
+++ b/roles/osm-vector-maps/defaults/main.yml
@@ -0,0 +1,8 @@
+# osm_vector_maps_install: True
+# osm_vector_maps_enabled: True
+
+# iiab_map_url : http://download.iiab.io/content/OSM/vector-tiles/maplist/hidden
+# vector_map_path: "{{ content_base }}/www/osm-vector-maps"
+
+# All above are set in: github.com/iiab/iiab/blob/master/vars/default_vars.yml
+# If nec, change them by editing /etc/iiab/local_vars.yml prior to installing!
diff --git a/roles/osm-vector/files/countries.json b/roles/osm-vector-maps/files/countries.json
similarity index 100%
rename from roles/osm-vector/files/countries.json
rename to roles/osm-vector-maps/files/countries.json
diff --git a/roles/osm-vector/files/en-map_test.json b/roles/osm-vector-maps/files/en-map_test.json
similarity index 100%
rename from roles/osm-vector/files/en-map_test.json
rename to roles/osm-vector-maps/files/en-map_test.json
diff --git a/roles/osm-vector/files/osm_functions.js b/roles/osm-vector-maps/files/map_functions.js
similarity index 79%
rename from roles/osm-vector/files/osm_functions.js
rename to roles/osm-vector-maps/files/map_functions.js
index 819b76ee1..1de34793d 100644
--- a/roles/osm-vector/files/osm_functions.js
+++ b/roles/osm-vector-maps/files/map_functions.js
@@ -1,16 +1,16 @@
-// osm_functions.js -- (non authoritative see below) src = iiab/roles/files/
+// map_functions.js -- (non authoritative see below) src = iiab/roles/files/
// copyright 2019 George Hunt
-// CAUTION -- this file is duplicate to admin-console/console/files/js/osm_fuctions.js -- please think of admin-console as authoritative
+// CAUTION -- this file is duplicate to admin-console/console/files/js/map_functions.js -- please think of admin-console as authoritative
// Placed here in duplicate to ease debugging, and simplify dependences
var regionGeojson = {};
var regionList = [];
var regionInstalled = [];
var commonAssetsDir = '/common/assets/';
-var mapAssetsDir = '/osm-vector/maplist/assets/';
+var mapAssetsDir = '/osm-vector-maps/maplist/assets/';
var iiab_config_dir = '/etc/iiab/';
var onChangeFunc = "setSize";
-var osmCatalog = {};
+var mapCatalog = {};
// following 2 lines an experiment to see if test page and console can be common
//var jquery = require("./assets/jquery.min");
@@ -19,7 +19,7 @@ var osmCatalog = {};
function getOsmStat(){
// called during the init
console.log('in getOsmStat');
- readOsmCatalog( true ); // we want checkboxes
+ readMapCatalog( true ); // we want checkboxes
readOsmIdx();
}
@@ -27,25 +27,25 @@ function readOsmIdx(){
//consoleLog ("in readOsmIdx");
var resp = $.ajax({
type: 'GET',
- url: consoleJsonDir + 'osm-vector-idx.json',
+ url: consoleJsonDir + 'osm-vector-maps-idx.json',
dataType: 'json'
})
.done(function( data ) {
- osmInstalled = data['regions'];
+ mapInstalled = data['regions'];
regionInstalled = [];
for (region in data['regions']) {
if (data['regions'].hasOwnProperty(region)) {
regionInstalled.push(region);
}
}
- //consoleLog(osmInstalled + '');
+ //consoleLog(mapInstalled + '');
})
.fail(jsonErrhandler);
return resp;
}
-function readOsmCatalog(checkbox){
+function readMapCatalog(checkbox){
checkbox = checkbox || true;
console.log ("in readOsmCalalog");
regionList = [];
@@ -56,11 +56,11 @@ function readOsmCatalog(checkbox){
})
.done(function( data ) {
regionJson = data;
- osmCatalog = regionJson['regions'];
- for(var key in osmCatalog){
- //console.log(key + ' ' + osmCatalog[key]['title']);
- osmCatalog[key]['name'] = key;
- regionList.push(osmCatalog[key]);
+ mapCatalog = regionJson['regions'];
+ for(var key in mapCatalog){
+ //console.log(key + ' ' + mapCatalog[key]['title']);
+ mapCatalog[key]['name'] = key;
+ regionList.push(mapCatalog[key]);
}
})
.fail(jsonErrhandler);
@@ -120,13 +120,13 @@ function genRegionItem(region,checkbox) {
function instOsmItem(name) {
var command = "INST-OSM-VECT-SET";
var cmd_args = {};
- cmd_args['osm_vect_id'] = name;
+ cmd_args['map_vect_id'] = name;
cmd = command + " " + JSON.stringify(cmd_args);
sendCmdSrvCmd(cmd, genericCmdHandler);
- osmDownloading.push(name);
- if ( osmWip.indexOf(name) != -1 )
- osmWip.push(osmCatalog[name]);
- console.log('osmWip: ' + osmWip);
+ mapDownloading.push(name);
+ if ( mapWip.indexOf(name) != -1 )
+ mapWip.push(mapCatalog[name]);
+ console.log('mapWip: ' + mapWip);
return true;
}
@@ -161,19 +161,19 @@ function updateOsmSpace(cb){
}
function updateOsmSpaceUtil(region, checked){
- var size = parseInt(osmCatalog[region].size);
+ var size = parseInt(mapCatalog[region].size);
var modIdx = selectedOsmItems.indexOf(region);
if (checked){
if (regionInstalled.indexOf(region) == -1){ // only update if not already installed mods
- sysStorage.osm_selected_size += size;
+ sysStorage.map_selected_size += size;
selectedOsmItems.push(region);
}
}
else {
if (modIdx != -1){
- sysStorage.osm_selected_size -= size;
+ sysStorage.map_selected_size -= size;
selectedOsmItems.splice(modIdx, 1);
}
}
@@ -188,29 +188,29 @@ function totalSpace(){
$( ".extract" ).each(function(ind,elem){
var data = JSON.parse($(this).attr('data-region'));
var region = data.name;
- var size = parseInt(osmCatalog[region]['size']);
+ var size = parseInt(mapCatalog[region]['size']);
var chk = $( this ).find(':checkbox').prop("checked") == true;
if (chk && typeof size !== 'undefined')
sum += size;
});
var ksize = sum / 1000;
- $( "#osmDiskSpace" ).html(readableSize(ksize));
+ $( "#mapDiskSpace" ).html(readableSize(ksize));
}
$( '#instOsmRegion').on('click', function(evnt){
- readOsmCatalog();
- osm.render();
+ readMapCatalog();
+ map.render();
});
*/
function renderOsm(){
console.log('in renderOsm');
- window.map.setTarget($("#osm-container")[0]);
+ window.map.setTarget($("#map-container")[0]);
window.map.render();
renderRegionList(true);
}
function initOsm(){
var dummy = 0;
- sysStorage.osm_selected_size = 0;
- $.when(readOsmCatalog(true)).then(renderRegionList);
+ sysStorage.map_selected_size = 0;
+ $.when(readMapCatalog(true)).then(renderRegionList);
}
diff --git a/roles/osm-vector-maps/files/test-index.redirect b/roles/osm-vector-maps/files/test-index.redirect
new file mode 100644
index 000000000..9ad3694cc
--- /dev/null
+++ b/roles/osm-vector-maps/files/test-index.redirect
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/roles/osm-vector-maps/tasks/main.yml b/roles/osm-vector-maps/tasks/main.yml
new file mode 100644
index 000000000..a16962f8b
--- /dev/null
+++ b/roles/osm-vector-maps/tasks/main.yml
@@ -0,0 +1,85 @@
+- name: Make sure the osm-vector-maps directory exists
+ file:
+ path: '{{ vector_map_path }}/maplist/assets'
+ state: directory
+ owner: '{{ apache_user }}'
+ group: '{{ apache_user }}'
+ mode: '0755'
+
+- name: Fetch the catalog for osm maps
+ get_url:
+ url: "{{ iiab_map_url }}/assets/regions.json"
+ dest: '{{ vector_map_path }}/maplist/assets/'
+
+- name: Create a link to osm catalog in /common/assets
+ file:
+ src: "{{ vector_map_path }}/maplist/assets/regions.json"
+ dest: "{{ doc_root }}/common/assets/regions.json"
+ state: link
+
+- name: Fetch the javascript bundle with openlayers for test page
+ get_url:
+ url: "{{ iiab_map_url }}/../main.js"
+ dest: '{{ vector_map_path }}/maplist/'
+
+- name: Fetch the index.html for test page
+ template:
+ src: "index.html"
+ dest: '{{ vector_map_path }}/maplist/index.html'
+
+# Bboxes (bounding boxes) are currently square. But geofabrik has non-rectangular bboxes.
+# So bring the bounding box definition from cloud (bboxes.geojson is big)
+- name: Fetch the bounding box description for osm maps
+ get_url:
+ url: "{{ iiab_map_url }}/assets/bboxes.geojson"
+ dest: '{{ vector_map_path }}/maplist/assets/'
+
+- name: Install python-geojson package, that helps with geojson
+ package:
+ name: python-geojson
+ state: present
+
+- name: Install the script to update osm catalog
+ template:
+ src: iiab-update-map
+ dest: /usr/bin/iiab-update-map
+ mode: "0755"
+
+# This depends on iiab-admin-console which is not yet installed
+#- name: Run the script that does osm-vector-maps housekeeping
+# shell: /usr/bin/iiab-update-map
+
+- name: Copy the Countries geojson to assets
+ copy:
+ src: countries.json
+ dest: '{{ vector_map_path }}/maplist/assets'
+
+# It is too complicated to use a single file for both iiab and admin-console
+- name: Copy the duplicated javascript to assets
+ copy:
+ src: map_functions.js
+ dest: '{{ vector_map_path }}/maplist/assets'
+
+- name: Install /etc/{{ apache_config_dir }}/osm-vector-maps.conf from template
+ template:
+ src: osm-vector-maps.conf
+ dest: "/etc/{{ apache_config_dir }}/osm-vector-maps.conf"
+
+- name: Create symlink osm-vector-maps.conf from sites-enabled to sites-available (debuntu, not nec for redhat)
+ file:
+ src: /etc/apache2/sites-available/osm-vector-maps.conf
+ path: /etc/apache2/sites-enabled/osm-vector-maps.conf
+ state: link
+ when: osm_vector_maps_enabled and is_debuntu
+
+- name: Remove symlink /etc/apache2/sites-enabled/osm-vector-maps.conf (debuntu)
+ file:
+ path: /etc/apache2/sites-enabled/osm-vector-maps.conf
+ state: absent
+ when: not osm_vector_maps_enabled and is_debuntu
+
+- name: Copy the redirect to the test page -- delete this if more than one map
+ copy:
+ src: test-index.redirect
+ dest: "{{ vector_map_path }}/index.html"
+
diff --git a/roles/osm-vector/templates/iiab-update-osm b/roles/osm-vector-maps/templates/iiab-update-map
similarity index 76%
rename from roles/osm-vector/templates/iiab-update-osm
rename to roles/osm-vector-maps/templates/iiab-update-map
index 8d8758e21..0e312d705 100755
--- a/roles/osm-vector/templates/iiab-update-osm
+++ b/roles/osm-vector-maps/templates/iiab-update-map
@@ -1,5 +1,5 @@
#!/usr/bin/env python
-# Scan the osm-vector directory, update the osm-vector-idx.json, add menu-defs
+# Scan the osm-vector-maps directory, update the osm-vector-maps-idx.json, add menu-defs
from geojson import Feature, Point, FeatureCollection, Polygon
import geojson
@@ -8,6 +8,7 @@ import os
import sys
import fnmatch
import re
+from datetime import date
IIAB_PATH='/etc/iiab'
if not IIAB_PATH in sys.path:
@@ -25,30 +26,34 @@ else:
doc_root = get_iiab_env('WWWROOT')
menuDefs = doc_root + "/js-menu/menu-files/menu-defs/"
-osm_vector_idx_dir = doc_root + "/common/assets"
-#map_doc_root = '{{ osm_vector_path }}'
-map_doc_root = '/library/www/osm-vector'
+vector_map_idx_dir = doc_root + "/common/assets"
+#map_doc_root = '{{ vector_map_path }}'
+map_doc_root = '/library/www/osm-vector-maps'
# map_catalog will be global, assumed always available
map_catalog = {}
map_menu_def_list = []
+previous_idx = {} # track new regions so we don't thrash on adding to menu
def main():
global map_menu_def_list
+ global previous_idx
+
get_map_catalog()
#print(json.dumps(map_catalog,indent=2))
-
+
map_menu_def_list = get_menu_def_names()
print(json.dumps(map_menu_def_list,indent=2))
+ read_vector_map_idx()
+
installed_maps = get_installed_regions()
print(installed_maps)
- write_osm_vector_idx(installed_maps)
+ write_vector_map_idx(installed_maps)
# 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" }
@@ -58,13 +63,13 @@ def main():
else:
item = map_catalog['regions'][region]
menu_ref = item['perma_ref']
- if not (region in map_menu_def_list):
+ if not (menu_ref in map_menu_def_list):
print('creating menu def for %s'%item['perma_ref'])
create_menu_def(region,item['perma_ref'] + '.json')
- if fetch_menu_json_value('autoupdate_menu'):
+ # if autoupdate allowed and this is a new region then add to home menu
+ if fetch_menu_json_value('autoupdate_menu') and item['perma_ref'] not in previous_idx:
print('autoudate of menu items is enabled:%s. Adding %s'%(\
fetch_menu_json_value('autoupdate_menu'),region,))
- # verify this menu def is on home page
menus.update_menu_json(menu_ref)
def get_map_catalog():
@@ -76,7 +81,7 @@ def get_map_catalog():
#print(json.dumps(map_catalog,indent=2))
def get_menu_def_names(intended_use='map'):
- menu_def_list =[]
+ menu_def_list =[]
os.chdir(menuDefs)
for filename in os.listdir('.'):
if fnmatch.fnmatch(filename, '*.json'):
@@ -89,9 +94,9 @@ def get_menu_def_names(intended_use='map'):
print(readstr)
if data.get('intended_use','') != intended_use:
continue
- map_name = data.get('name','')
+ map_name = data.get('map_name','')
if map_name != '':
- menu_def_list.append(data['name'])
+ menu_def_list.append(map_name)
return menu_def_list
def get_installed_regions():
@@ -99,15 +104,24 @@ 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:
installed.append('maplist')
return installed
-def write_osm_vector_idx(installed_maps):
- map_dict ={}
+def read_vector_map_idx():
+ global previous_idx
+ try: # will fail first time
+ with open(vector_map_idx_dir + '/vector-map-idx.json','r') as idx:
+ str = idx.read()
+ previous_idx = json.loads(str)
+ except:
+ pass
+
+def write_vector_map_idx(installed_maps):
+ map_dict ={}
idx_dict = {}
for fname in installed_maps:
region = extract_region_from_filename(fname)
@@ -117,7 +131,7 @@ def write_osm_vector_idx(installed_maps):
# Create the idx file in format required bo js-menu system
item = map_dict['perma_ref']
- idx_dict[item] = {}
+ idx_dict[item] = {}
idx_dict[item]['file_name'] = os.path.basename(map_dict['url'][:-4])
idx_dict[item]['menu_item'] = map_dict['perma_ref']
idx_dict[item]['size'] = map_dict['size']
@@ -125,8 +139,8 @@ def write_osm_vector_idx(installed_maps):
idx_dict[item]['region'] = region
idx_dict[item]['language'] = map_dict['perma_ref'][:2]
- with open(osm_vector_idx_dir + '/osm_version_idx.json','w') as idx:
- idx.write(json.dumps(idx_dict,indent=2))
+ with open(vector_map_idx_dir + '/vector-map-idx.json','w') as idx:
+ idx.write(json.dumps(idx_dict,indent=2))
def create_menu_def(region,default_name,intended_use='map'):
item = map_catalog['regions'][region]
@@ -145,11 +159,13 @@ def create_menu_def(region,default_name,intended_use='map'):
menuDef["menu_item_name"] = default_name
menuDef["title"] = "OpenStreetMap: 18 Levels of Zoom for " + item.get('title','ERROR') + ''
menuDef["map_name"] = item['perma_ref']
- menuDef["file_name"] = lang + '-osm-omt_' + region + '_' + \
- os.path.basename(item['url'])[:-4]
+ # the following is in the idx json
+ #menuDef["file_name"] = lang + '-osm-omt_' + region + '_' + os.path.basename(item['url'])[:-4]
menuDef["description"] = 'Resolution of the Whole World to 5 KM. OpenStreetMap data for ' + item.get('title','') + ' with details down to 5 Meters
'
menuDef["extra_html"] = ""
- menuDef["automatically_generated"] = "true"
+ #menuDef["automatically_generated"] = "true"
+ menuDef["change_ref"] = "generated"
+ menuDef["change_date"] = str(date.today())
if not os.path.isfile(menuDefs + default_name): # logic to here can still overwrite existing menu def
print("creating %s"%menuDefs + default_name)
with open(menuDefs + default_name,'w') as menufile:
@@ -175,15 +191,14 @@ 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)
-
+ # 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")
+
if __name__ == '__main__':
if console_installed:
main()
diff --git a/roles/osm-vector/templates/index.html b/roles/osm-vector-maps/templates/index.html
similarity index 89%
rename from roles/osm-vector/templates/index.html
rename to roles/osm-vector-maps/templates/index.html
index ee7592eea..62615ae84 100644
--- a/roles/osm-vector/templates/index.html
+++ b/roles/osm-vector-maps/templates/index.html
@@ -46,12 +46,12 @@
return (bytes / Math.pow(1024, e)).toFixed(2) + " " + s[e];
}
-
+
-