# HG changeset patch # User Arnaud Campeas[arnaud.campeas@pythonian.fr] # Date 1717513349 -7200 # Tue Jun 04 17:02:29 2024 +0200 # Node ID c5ba5229f00f2145a133091ff8ae538d26004fb7 # Parent 01324708b33b21e0b946d8f5d51ef061419072d1 schedule/step: correct bug when the user is given to .prepare We make argument passing between prepared call and its actual invocation more clear. While doing so we note that the `domain` was dispatched to the wrong place. diff --git a/rework/monitor.py b/rework/monitor.py --- a/rework/monitor.py +++ b/rework/monitor.py @@ -139,11 +139,18 @@ def __repr__(self): return f'\n{self.defs}>' - def schedule(self, rule, *args): + def schedule(self, rule, opname, domain, rawinputdata, hostid, metadata): self.rulemap.append( ( rule, - lambda: api.schedule(self.engine, *args) + lambda: api.schedule( + self.engine, + opname=opname, + domain=domain, + rawinputdata=rawinputdata, + hostid=hostid, + metadata=metadata + ) ) ) @@ -194,9 +201,16 @@ self.rulemap = [] self.runnable = [] self.logger.info(f'sched: starting with {len(defs)} definitions') - for idx, (operation, rule, inputdata, hostid, meta) in enumerate(defs): + for idx, (operation, rule, rawinputdata, hostid, meta) in enumerate(defs): self.logger.info(f'{idx} {operation} {rule} {hostid} {meta}') - self.schedule(rule, operation, self.domain, inputdata, hostid, meta) + self.schedule( + rule, + opname=operation, + domain=self.domain, + rawinputdata=rawinputdata, + hostid=hostid, + metadata=meta + ) self.defs = defs self.run_scheduled() diff --git a/tests/test_schedule.py b/tests/test_schedule.py --- a/tests/test_schedule.py +++ b/tests/test_schedule.py @@ -19,4 +19,4 @@ "\n[parameters: {\'name\': \'basic\', \'modname\': {\'user\': \'WEBUI\'}}]" ) - assert error in printed[-1] + assert error not in printed[-1]