diff --git a/archrepo.ini b/archrepo.ini index 282e0f1..3489200 100644 --- a/archrepo.ini +++ b/archrepo.ini @@ -28,3 +28,6 @@ wait-time: 3 notification-type: simple-udp notification-address: 127.0.0.1:9900 notification-secret: JiUHuGY987G76djItfOskOj + +# If for any reason, you don't want actual database creation or update: +#without-db: true diff --git a/repomon.py b/repomon.py index 27e1825..49adaae 100755 --- a/repomon.py +++ b/repomon.py @@ -57,6 +57,7 @@ class RepoMan: self._command_add = config.get('command-add', 'repo-add') self._command_remove = config.get('command-remove', 'repo-remove') self._wait_time = config.getint('wait-time', 10) + self._without_db = config.getboolean('without-db', False) notification_type = config.get('notification-type', 'null') if notification_type != 'null': @@ -110,12 +111,22 @@ class RepoMan: def _do_add(self, toadd): if toadd: files, callbacks = zip(*toadd) - self._do_cmd(self._command_add, files, callbacks) + if self._without_db: + self._do_callbacks(callbacks) + else: + self._do_cmd(self._command_add, files, callbacks) def _do_remove(self, toremove): if toremove: files, callbacks = zip(*toremove) - self._do_cmd(self._command_remove, files, callbacks) + if self._without_db: + self._do_callbacks(callbacks) + else: + self._do_cmd(self._command_remove, files, callbacks) + + def _do_callbacks(self, callbacks): + for cb in callbacks: + cb() def add_action(self, action): logger.info('Adding action %r to db %r', action, self._db_name)