From 894c71e8db4b19e9e946d76a9faa597959122e71 Mon Sep 17 00:00:00 2001 From: Arvid Requate Date: Thu, 9 May 2019 20:44:01 +0200 Subject: [PATCH] Make S4-Connector wake up when changes are incoming from UCS --- services/univention-s4-connector/debian/control | 3 ++- .../modules/univention/s4connector/s4/main.py | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/services/univention-s4-connector/debian/control b/services/univention-s4-connector/debian/control index 935dbe8085..4fa6517067 100644 --- a/services/univention-s4-connector/debian/control +++ b/services/univention-s4-connector/debian/control @@ -17,7 +17,8 @@ Depends: ${misc:Depends}, ${python:Depends}, python-univention-heimdal (>= 4.0.2-2), python-univention-directory-manager (>= 13.0.21-28), python-pyasn1-modules, - python-pysqlite2 + python-pysqlite2, + python-inotifyx Provides: ${python:Provides} Description: UCS - Modules for connector sychronisation This package contains the modules that implement the diff --git a/services/univention-s4-connector/modules/univention/s4connector/s4/main.py b/services/univention-s4-connector/modules/univention/s4connector/s4/main.py index 78710c6fc3..f961c6da77 100755 --- a/services/univention-s4-connector/modules/univention/s4connector/s4/main.py +++ b/services/univention-s4-connector/modules/univention/s4connector/s4/main.py @@ -44,6 +44,7 @@ import traceback import univention import univention.s4connector import univention.s4connector.s4 +import inotifyx from univention.config_registry import ConfigRegistry @@ -199,6 +200,8 @@ def connect(): retry_rejected = 0 connected = True + inotify_fd = inotifyx.init() + inotifyx.add_watch(inotify_fd, s4.listener_dir, inotifyx.IN_MOVED_TO) while connected: print time.ctime() # Aenderungen pollen @@ -252,7 +255,10 @@ def connect(): print '- sleep %s seconds (%s/%s until resync) -' % (poll_sleep, retry_rejected, baseconfig_retry_rejected) sys.stdout.flush() - time.sleep(poll_sleep) + events = inotifyx.get_events(inotify_fd, poll_sleep) + if events: + print '- Inotify reported changes from UCS' + os.close(inotify_fd) s4.close_debug() -- 2.11.0