From 483924aa4480901b48acb2d09511be03bd2af101 Mon Sep 17 00:00:00 2001
From: Arthur Le Bars <arthur.le-bars@sb-roscoff.fr>
Date: Tue, 20 Apr 2021 18:54:53 +0200
Subject: [PATCH] removed obsolete code, jinja2 templating options in script

---
 gga_init.py                                | 7 +------
 templates/galaxy_nginx.conf.j2             | 1 -
 templates/gspecies_compose_template.yml.j2 | 1 -
 templates/traefik_compose_template.yml.j2  | 1 -
 4 files changed, 1 insertion(+), 9 deletions(-)

diff --git a/gga_init.py b/gga_init.py
index 46e104a..19aa31d 100755
--- a/gga_init.py
+++ b/gga_init.py
@@ -83,11 +83,6 @@ class DeploySpeciesStack(speciesData.SpeciesData):
         except Exception as exc:
             logging.critical("Could not copy nginx configuration file for %s" % self.full_name)
             logging.critical(exc)            
-        #     with open(os.path.abspath("./nginx/conf/default.conf"), 'w') as conf:
-        #         conf.write("server {\n\tlisten 80;\n\tserver_name ~.;\n\tlocation /download/ {\n\t\talias /project_data/; \n\t\tautoindex on;\n\t}\n}")  # The species nginx conf
-        # except OSError as exc:
-        #     logging.critical("Cannot write NginX conf file")
-        #     sys.exit(exc)
 
         # Return to main directory
         os.chdir(self.main_dir)
@@ -111,7 +106,7 @@ class DeploySpeciesStack(speciesData.SpeciesData):
 
         # Jinja2 templating, handled using the python "jinja2" module
         file_loader = FileSystemLoader(self.script_dir + "/templates")
-        env = Environment(loader=file_loader)
+        env = Environment(loader=file_loader, trim_blocks=True, lstrip_blocks=True)
 
         # We need a dict holding all key (variables) - values that needs to be replaced in the template as our rendering dict
         # To do so we need both input file vars and config vars
diff --git a/templates/galaxy_nginx.conf.j2 b/templates/galaxy_nginx.conf.j2
index 5d05b1f..7920bef 100644
--- a/templates/galaxy_nginx.conf.j2
+++ b/templates/galaxy_nginx.conf.j2
@@ -1,4 +1,3 @@
-#jinja2: lstrip_blocks: “True”, trim_blocks: "True"
 uwsgi_param  QUERY_STRING       $query_string;
 uwsgi_param  REQUEST_METHOD     $request_method;
 uwsgi_param  CONTENT_TYPE       $content_type;
diff --git a/templates/gspecies_compose_template.yml.j2 b/templates/gspecies_compose_template.yml.j2
index 93f92fe..d897fa2 100644
--- a/templates/gspecies_compose_template.yml.j2
+++ b/templates/gspecies_compose_template.yml.j2
@@ -1,4 +1,3 @@
-#jinja2: lstrip_blocks: “True”, trim_blocks: "True"
 # ./docker_data is created and filled with persistent data that should be backuped
 version: '3.7'
 services:
diff --git a/templates/traefik_compose_template.yml.j2 b/templates/traefik_compose_template.yml.j2
index 5a70edf..6157cc2 100644
--- a/templates/traefik_compose_template.yml.j2
+++ b/templates/traefik_compose_template.yml.j2
@@ -1,4 +1,3 @@
-#jinja2: lstrip_blocks: “True”, trim_blocks: "True"
 version: '3.7'
 services:
   traefik:
-- 
GitLab