From 033a0a74e279f7d2cd72c57f9cedb42d529672f0 Mon Sep 17 00:00:00 2001 From: Alejandro Sobko Date: Thu, 25 Apr 2019 17:15:34 -0300 Subject: [PATCH 1/5] Agrego archivo JSON con la info de unidades disponibles --- base_portal/roles/portal/tasks/configure.yml | 5 + .../portal/templates/ckan/production.ini.j2 | 1 + .../roles/portal/templates/ckan/units.json.j2 | 98 +++++++++++++++++++ 3 files changed, 104 insertions(+) create mode 100644 base_portal/roles/portal/templates/ckan/units.json.j2 diff --git a/base_portal/roles/portal/tasks/configure.yml b/base_portal/roles/portal/tasks/configure.yml index 1ac5153..66894b2 100644 --- a/base_portal/roles/portal/tasks/configure.yml +++ b/base_portal/roles/portal/tasks/configure.yml @@ -27,6 +27,11 @@ src: ckan/licenses.json.j2 dest: "{{ CKAN_DIST_CONFIG }}/licenses.json" +- name: Add units JSON file + template: + src: ckan/units.json.j2 + dest: "{{ CKAN_DIST_CONFIG }}/units.json" + - name: Configure supervisor template: src: ckan/supervisor-ckan-worker.conf.j2 diff --git a/base_portal/roles/portal/templates/ckan/production.ini.j2 b/base_portal/roles/portal/templates/ckan/production.ini.j2 index 1fa1ed9..f0fbabd 100644 --- a/base_portal/roles/portal/templates/ckan/production.ini.j2 +++ b/base_portal/roles/portal/templates/ckan/production.ini.j2 @@ -134,6 +134,7 @@ ckan.display_timezone = server #ckan.recaptcha.privatekey = licenses_group_url = file:///var/lib/ckan/theme_config/licenses.json # ckan.template_footer_end = +units_url = file:///var/lib/ckan/theme_config/units.json ## Internationalisation Settings diff --git a/base_portal/roles/portal/templates/ckan/units.json.j2 b/base_portal/roles/portal/templates/ckan/units.json.j2 new file mode 100644 index 0000000..a71ebc9 --- /dev/null +++ b/base_portal/roles/portal/templates/ckan/units.json.j2 @@ -0,0 +1,98 @@ +[ +"ARS corrientes", +"ARS", +"ARS/USD", +"Australes", +"Automóviles", +"Becas", +"Beneficiarios", +"Cabezas", +"Cantidad de pasajeros", +"Centavos de dólar por kilogramo", +"Coeficiente", +"Empresas", +"GWh", +"Grados centígrados", +"Habitantes", +"Hectáreas", +"Kbbl/d", +"M3", +"MW", +"Metros cúbicos", +"Metros", +"Miles de M2", +"Miles de USD CIF", +"Miles de USD FOB", +"Miles de UTEq", +"Miles de cabezas", +"Miles de dólares FOB", +"Miles de hectolitros", +"Miles de litros", +"Miles de litros", +"Miles de llamadas", +"Miles de líneas", +"Miles de metros cúbicos", +"Miles de minutos", +"Miles de pasajeros", +"Miles de pasajes", +"Miles de personas", +"Miles de teléfonos", +"Miles de toneladas", +"Miles de unidades", +"Miles de vehículos", +"Millones de Litros", +"Millones de USD corrientes", +"Millones de USD de 2004", +"Millones de USD", +"Millones de cabezas", +"Millones de dólares de 1993", +"Millones de metros cúbicos", +"Millones de paquetes", +"Millones de pesos a precios de 1993", +"Millones de pesos a precios de 2004", +"Millones de pesos corrientes", +"Millones de pesos", +"Millones de unidades", +"Paquetes de 20 unidades", +"Pasajeros", +"Pasajes", +"Personas por sala", +"Personas", +"Porcentaje de hogares", +"Porcentaje de población", +"Porcentaje del PBI", +"Porcentaje del total de exportaciones", +"Porcentaje", +"Pozos", +"Prestaciones", +"Puestos de trabajo", +"Reales por dólar", +"Reales", +"Salas", +"Tasa", +"Toneladas", +"USD corrientes", +"USD corrientes", +"USD por tonelada", +"USD", +"USD/GBP", +"USD/KG", +"USD/M3", +"USD/millón de BTU", +"Unidades", +"Variación interanual", +"Variación intermensual" +"Variación mensual", +"Variación porcentual", +"Índice 17 Diciembre 2015 = 100", +"Índice 1993 = 100", +"Índice 1997 = 100", +"Índice 1999 = 100", +"Índice 2004 = 100", +"Índice 2005 = 100", +"Índice 2012 = 100", +"Índice Abril 2008 = 100", +"Índice Diciembre 2001 = 100", +"Índice Diciembre 2016 = 100", +"Índice Noviembre 2015 = 100", +] From 0bccb6b29f724b4e3def2f6d78d24f41fc9501b2 Mon Sep 17 00:00:00 2001 From: Alejandro Sobko Date: Mon, 29 Apr 2019 15:12:47 -0300 Subject: [PATCH 2/5] Agrego migracion --- base_portal/roles/portal/tasks/configure.yml | 1 + .../config/updates/0008_specify_units_json_path.sh.j2 | 11 +++++++++++ 2 files changed, 12 insertions(+) create mode 100644 base_portal/roles/portal/templates/scripts/config/updates/0008_specify_units_json_path.sh.j2 diff --git a/base_portal/roles/portal/tasks/configure.yml b/base_portal/roles/portal/tasks/configure.yml index 66894b2..d362215 100644 --- a/base_portal/roles/portal/tasks/configure.yml +++ b/base_portal/roles/portal/tasks/configure.yml @@ -99,6 +99,7 @@ - 0005_add_series_api_uri_default_value.sh - 0006_remove_harvest_and_datajson_plugins.sh - 0007_specify_licenses_json_path.sh + - 0008_specify_units_json_path.sh - name: Add tests scripts template: diff --git a/base_portal/roles/portal/templates/scripts/config/updates/0008_specify_units_json_path.sh.j2 b/base_portal/roles/portal/templates/scripts/config/updates/0008_specify_units_json_path.sh.j2 new file mode 100644 index 0000000..504c9cc --- /dev/null +++ b/base_portal/roles/portal/templates/scripts/config/updates/0008_specify_units_json_path.sh.j2 @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +config_file="{{ CKAN_CONFIG }}/{{ CKAN_CONFIG_FILE }}"; +units_json_path=/app/roles/portal/templates/ckan/units.json.j2 +units_json_final_path={{ CKAN_DIST_CONFIG }}/units.json + +config_line=$(grep -n '#units_url' /etc/ckan/default/production.ini | awk -F ":" '{print $1}') +if ! [[ -z $config_line ]] ; then + cp $units_json_path $units_json_final_path + sed -i "${config_line}s|.*|units_url = file:///var/lib/ckan/theme_config/units.json|" $config_file +fi From e063fdb8cb382279bf941485e463ca55a160bb60 Mon Sep 17 00:00:00 2001 From: Alejandro Sobko Date: Thu, 2 May 2019 10:43:44 -0300 Subject: [PATCH 3/5] =?UTF-8?q?Cambio=20script=20de=20migraci=C3=B3n=20par?= =?UTF-8?q?a=20units=5Furl?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/updates/0008_specify_units_json_path.sh.j2 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/base_portal/roles/portal/templates/scripts/config/updates/0008_specify_units_json_path.sh.j2 b/base_portal/roles/portal/templates/scripts/config/updates/0008_specify_units_json_path.sh.j2 index 504c9cc..c5f4043 100644 --- a/base_portal/roles/portal/templates/scripts/config/updates/0008_specify_units_json_path.sh.j2 +++ b/base_portal/roles/portal/templates/scripts/config/updates/0008_specify_units_json_path.sh.j2 @@ -1,11 +1,12 @@ #!/usr/bin/env bash -config_file="{{ CKAN_CONFIG }}/{{ CKAN_CONFIG_FILE }}"; units_json_path=/app/roles/portal/templates/ckan/units.json.j2 units_json_final_path={{ CKAN_DIST_CONFIG }}/units.json +config_file="{{ CKAN_CONFIG }}/{{ CKAN_CONFIG_FILE }}"; -config_line=$(grep -n '#units_url' /etc/ckan/default/production.ini | awk -F ":" '{print $1}') -if ! [[ -z $config_line ]] ; then +if ! grep -q "units_url" "$config_file"; then + var=$(grep -n '\[app:main\]' $config_file | awk -F ":" '{print $1}') + let "var=var+1" + sed -i "${var}i units_url = file:///var/lib/ckan/theme_config/units.json" $config_file cp $units_json_path $units_json_final_path - sed -i "${config_line}s|.*|units_url = file:///var/lib/ckan/theme_config/units.json|" $config_file fi From 69c903c7505dd436c0df80dafaf2f02b55a20735 Mon Sep 17 00:00:00 2001 From: Alejandro Sobko Date: Thu, 2 May 2019 14:21:23 -0300 Subject: [PATCH 4/5] Fix units.json --- base_portal/roles/portal/templates/ckan/units.json.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/base_portal/roles/portal/templates/ckan/units.json.j2 b/base_portal/roles/portal/templates/ckan/units.json.j2 index a71ebc9..aacc068 100644 --- a/base_portal/roles/portal/templates/ckan/units.json.j2 +++ b/base_portal/roles/portal/templates/ckan/units.json.j2 @@ -81,7 +81,7 @@ "USD/millón de BTU", "Unidades", "Variación interanual", -"Variación intermensual" +"Variación intermensual", "Variación mensual", "Variación porcentual", "Índice 17 Diciembre 2015 = 100", @@ -94,5 +94,5 @@ "Índice Abril 2008 = 100", "Índice Diciembre 2001 = 100", "Índice Diciembre 2016 = 100", -"Índice Noviembre 2015 = 100", +"Índice Noviembre 2015 = 100" ] From 5b5fd12a2fa80a61acb6c31216b398ff01ac58a0 Mon Sep 17 00:00:00 2001 From: Alejandro Sobko Date: Thu, 2 May 2019 14:43:16 -0300 Subject: [PATCH 5/5] Cambio path por variable de ansible --- base_portal/roles/portal/templates/ckan/production.ini.j2 | 2 +- .../scripts/config/updates/0008_specify_units_json_path.sh.j2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/base_portal/roles/portal/templates/ckan/production.ini.j2 b/base_portal/roles/portal/templates/ckan/production.ini.j2 index f0fbabd..21b3e2c 100644 --- a/base_portal/roles/portal/templates/ckan/production.ini.j2 +++ b/base_portal/roles/portal/templates/ckan/production.ini.j2 @@ -134,7 +134,7 @@ ckan.display_timezone = server #ckan.recaptcha.privatekey = licenses_group_url = file:///var/lib/ckan/theme_config/licenses.json # ckan.template_footer_end = -units_url = file:///var/lib/ckan/theme_config/units.json +units_url = {{ CKAN_DIST_CONFIG }}/units.json ## Internationalisation Settings diff --git a/base_portal/roles/portal/templates/scripts/config/updates/0008_specify_units_json_path.sh.j2 b/base_portal/roles/portal/templates/scripts/config/updates/0008_specify_units_json_path.sh.j2 index c5f4043..d4d2c7b 100644 --- a/base_portal/roles/portal/templates/scripts/config/updates/0008_specify_units_json_path.sh.j2 +++ b/base_portal/roles/portal/templates/scripts/config/updates/0008_specify_units_json_path.sh.j2 @@ -7,6 +7,6 @@ config_file="{{ CKAN_CONFIG }}/{{ CKAN_CONFIG_FILE }}"; if ! grep -q "units_url" "$config_file"; then var=$(grep -n '\[app:main\]' $config_file | awk -F ":" '{print $1}') let "var=var+1" - sed -i "${var}i units_url = file:///var/lib/ckan/theme_config/units.json" $config_file + sed -i "${var}i units_url = $units_json_final_path" $config_file cp $units_json_path $units_json_final_path fi