From c5d9d74884e5dc5e330930acc30aee639dcada08 Mon Sep 17 00:00:00 2001
From: Adar Nimrod <nimrod@shore.co.il>
Date: Sun, 23 Apr 2017 06:12:24 +0300
Subject: [PATCH] - Log to syslog only if the version supports it.

---
 templates/nginx/conf.d/log.conf | 2 ++
 tests/test_nginx.py             | 9 ---------
 2 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/templates/nginx/conf.d/log.conf b/templates/nginx/conf.d/log.conf
index 8acb1c0..9ea3732 100644
--- a/templates/nginx/conf.d/log.conf
+++ b/templates/nginx/conf.d/log.conf
@@ -1,2 +1,4 @@
+{% if nginx["version"]|version_compare("1.7.11", ">=") %}
 access_log {{ nginx_access_log }};
 error_log {{ nginx_error_log }};
+{% endif %}
diff --git a/tests/test_nginx.py b/tests/test_nginx.py
index b941d2e..f9fe736 100644
--- a/tests/test_nginx.py
+++ b/tests/test_nginx.py
@@ -23,15 +23,6 @@ def test_nginx_include_directive(File, directive):
     assert directive in File('/etc/nginx/nginx.conf').content_string
 
 
-log_directives = ['access_log syslog:server=127.0.0.1;',
-                  'error_log syslog:server=127.0.0.1;']
-
-
-@pytest.mark.parametrize('directive', log_directives)
-def test_nginx_log_directive(File, directive):
-    assert directive in File('/etc/nginx/conf.d/log.conf').content_string
-
-
 def test_nginx_config(File, Command, Sudo):
     with Sudo():
         assert Command('nginx -t').rc == 0
-- 
GitLab