From 150ae0c46506a53f6bd3da20825dda9fedeae1a2 2020-05-07 22:39:09 From: Branko Majic Date: 2020-05-07 22:39:09 Subject: [PATCH] MAR-149: Sort dictionaries in all templates in order to have predicatable order while iterating them (resolves idempotence issues in such cases). --- diff --git a/roles/php_website/templates/fpm_site.conf.j2 b/roles/php_website/templates/fpm_site.conf.j2 index 6b9be0f2ed94218f2ff379f77f2b13e55061bbb2..aba20ebf478857f99ea8d814014f9b53924e428b 100644 --- a/roles/php_website/templates/fpm_site.conf.j2 +++ b/roles/php_website/templates/fpm_site.conf.j2 @@ -27,6 +27,6 @@ chdir = / ; to log errors in site-specific log file. catch_workers_output = yes -{% for var, val in additional_fpm_config.items() %} +{% for var, val in additional_fpm_config | dictsort %} {{ var }} = {{ val }} {% endfor %} diff --git a/roles/wsgi_website/templates/environment.sh.j2 b/roles/wsgi_website/templates/environment.sh.j2 index 917e9e9d403b859376f73a1f73386bb18d7e8056..5e021a8856e3a522aa90d4a4fd562b31a4f58ebd 100644 --- a/roles/wsgi_website/templates/environment.sh.j2 +++ b/roles/wsgi_website/templates/environment.sh.j2 @@ -1,3 +1,3 @@ -{% for var, val in environment_variables.items() %} +{% for var, val in environment_variables | dictsort %} export {{ var }}='{{ val }}' {% endfor %} diff --git a/roles/wsgi_website/templates/nginx_site.j2 b/roles/wsgi_website/templates/nginx_site.j2 index cd5865d0d0893023b31c51289e4a59f2ab173c31..361af0e1a948200036a994b49f3f290c9622134f 100644 --- a/roles/wsgi_website/templates/nginx_site.j2 +++ b/roles/wsgi_website/templates/nginx_site.j2 @@ -59,7 +59,7 @@ server { proxy_set_header Host $http_host; proxy_redirect off; - {% for header, value in proxy_headers.items() -%} + {% for header, value in proxy_headers | dictsort -%} proxy_set_header {{ header }} {{ value }}; {% endfor -%} diff --git a/roles/wsgi_website/templates/systemd_wsgi_website.service.j2 b/roles/wsgi_website/templates/systemd_wsgi_website.service.j2 index 73fe8bf895e9f50fba53419239984f36300c64bd..3d50abb1df68548c2a11cf531d7bfc2a76f72a55 100644 --- a/roles/wsgi_website/templates/systemd_wsgi_website.service.j2 +++ b/roles/wsgi_website/templates/systemd_wsgi_website.service.j2 @@ -9,7 +9,7 @@ Group={{ user }} WorkingDirectory={{ home }}/code ExecStart={{ home }}/virtualenv/bin/gunicorn --bind unix:/run/wsgi/{{ fqdn }}.sock {% if use_paste %}--paste {{home}}/code/{{ wsgi_application }}{% else %}{{ wsgi_application }}{% endif %} -{% for var, val in environment_variables.items() %} +{% for var, val in environment_variables | dictsort %} Environment="{{ var }}={{ val }}" {% endfor %}