Skip to content

Commit 4d4f661

Browse files
committed
Ignore crtkeyca change events
These files are sometimes changed without any renewal. It's much better to generate crtkeyca files in batch, then touch a flag file to flush the nginx config reloader.
1 parent a191cda commit 4d4f661

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

nginx_config_reloader/settings.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@
1313
NGINX_PID_FILE = "/var/run/nginx.pid"
1414
ERROR_FILE = "nginx_error_output"
1515

16-
WATCH_IGNORE_FILES = (
16+
_BASE_IGNORE_FILES = (
1717
# glob patterns
1818
".*",
1919
"*~",
2020
"*.save",
2121
ERROR_FILE,
2222
)
23-
SYNC_IGNORE_FILES = WATCH_IGNORE_FILES + ("*.flag",)
23+
WATCH_IGNORE_FILES = _BASE_IGNORE_FILES + ("*.crtkeyca",)
24+
SYNC_IGNORE_FILES = _BASE_IGNORE_FILES + ("*.flag",)
2425
SYSLOG_SOCKET = "/dev/log"
2526

2627
# Using include or load_module is forbidden unless

tests/test_nginx_config_reloader.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,12 @@ def test_that_handle_event_does_not_need_reload_on_change_of_invisible_file(self
467467

468468
self.assertFalse(tm.dirty)
469469

470+
def test_that_handle_event_does_not_need_reload_on_change_of_crtkeyca_file(self):
471+
tm = self._get_nginx_config_reloader_instance()
472+
tm.handle_event(Event("certificate.crtkeyca"))
473+
474+
self.assertFalse(tm.dirty)
475+
470476
def test_remove_error_file_unlinks_the_error_file(self):
471477
mock_os = self.set_up_patch("nginx_config_reloader.os")
472478
mock_os.path.join.return_value = self.error_file

0 commit comments

Comments
 (0)