mirror of
https://github.com/lilydjwg/archrepo2.git
synced 2025-03-10 12:02:43 +00:00
add without-db config: not actually update databases
This commit is contained in:
parent
dfce1b8bd2
commit
dd26517106
2 changed files with 16 additions and 2 deletions
|
@ -28,3 +28,6 @@ wait-time: 3
|
||||||
notification-type: simple-udp
|
notification-type: simple-udp
|
||||||
notification-address: 127.0.0.1:9900
|
notification-address: 127.0.0.1:9900
|
||||||
notification-secret: JiUHuGY987G76djItfOskOj
|
notification-secret: JiUHuGY987G76djItfOskOj
|
||||||
|
|
||||||
|
# If for any reason, you don't want actual database creation or update:
|
||||||
|
#without-db: true
|
||||||
|
|
15
repomon.py
15
repomon.py
|
@ -57,6 +57,7 @@ class RepoMan:
|
||||||
self._command_add = config.get('command-add', 'repo-add')
|
self._command_add = config.get('command-add', 'repo-add')
|
||||||
self._command_remove = config.get('command-remove', 'repo-remove')
|
self._command_remove = config.get('command-remove', 'repo-remove')
|
||||||
self._wait_time = config.getint('wait-time', 10)
|
self._wait_time = config.getint('wait-time', 10)
|
||||||
|
self._without_db = config.getboolean('without-db', False)
|
||||||
|
|
||||||
notification_type = config.get('notification-type', 'null')
|
notification_type = config.get('notification-type', 'null')
|
||||||
if notification_type != 'null':
|
if notification_type != 'null':
|
||||||
|
@ -110,12 +111,22 @@ class RepoMan:
|
||||||
def _do_add(self, toadd):
|
def _do_add(self, toadd):
|
||||||
if toadd:
|
if toadd:
|
||||||
files, callbacks = zip(*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):
|
def _do_remove(self, toremove):
|
||||||
if toremove:
|
if toremove:
|
||||||
files, callbacks = zip(*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):
|
def add_action(self, action):
|
||||||
logger.info('Adding action %r to db %r', action, self._db_name)
|
logger.info('Adding action %r to db %r', action, self._db_name)
|
||||||
|
|
Loading…
Add table
Reference in a new issue