diff --git a/configure.mk b/configure.mk index 9134f2da..58ca8d50 100755 --- a/configure.mk +++ b/configure.mk @@ -80,7 +80,7 @@ ifneq ($(MAKECMDGOALS),clean) # -------- # $(call add_substitution, PACKAGE_NAME, hades) -$(call add_substitution, PACKAGE_VERSION, 0.5.0) +$(call add_substitution, PACKAGE_VERSION, 0.5.1) $(call add_substitution, PACKAGE_DESCRIPTION, Distributed AG DSN RADIUS MAC authentication. Site node agent and captive portal) $(call add_substitution, PACKAGE_AUTHOR, Sebastian Schrader) $(call add_substitution, PACKAGE_AUTHOR_EMAIL, sebastian.schrader@agdsn.de) diff --git a/debian/changelog b/debian/changelog index 5642a612..d3c69277 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +hades (0.5.1) bullseye; urgency=high + + * Fix bug breaking any RPC method call (GH-119) + + -- Mon, 19 Sep 2022 13:51:20 +0000 + hades (0.5.0) bullseye; urgency=low * Upgrade to Debian bullseye (GH-94, GH-99, GH-103, GH-113) diff --git a/src/hades/agent/tasks.py b/src/hades/agent/tasks.py index 0ac86364..870572f4 100644 --- a/src/hades/agent/tasks.py +++ b/src/hades/agent/tasks.py @@ -72,7 +72,7 @@ def wrap( (cls,), { 'name': name, - 'run': f, + 'run': staticmethod(f), '_decorated': True, '__doc__': f.__doc__, '__module__': f.__module__, diff --git a/tests/test_agent_rpc.py b/tests/test_agent_rpc.py new file mode 100644 index 00000000..44d6815e --- /dev/null +++ b/tests/test_agent_rpc.py @@ -0,0 +1,33 @@ +import pytest +from celery.utils.threads import LocalStack + +from hades.agent.tasks import RPCTask, rpc_task + + +@pytest.fixture(autouse=True, scope="session") +def celery_request_context(): + RPCTask.request_stack = LocalStack() + + +def test_rpc_task_nullary(): + @rpc_task() + def const5() -> int: + return 5 + + assert const5() == 5 + + +def test_rpc_task_unary(): + @rpc_task() + def add1(i: int) -> int: + return i + 1 + + assert add1(1) == 2 + + +def test_rpc_task_unary_kwonly(): + @rpc_task() + def add1(*, i: int) -> int: + return i + 1 + + assert add1(i=1) == 2