DRAFT: Add support for the OCSP/CRL refresh wrapper REST API #403
101 tests run, 45 passed, 1 skipped, 55 failed.
Annotations
Check failure on line 24 in .mypy_cache/3.11/tests/test_auth.data.json
github-actions / JUnit report (local)
test_auth.test_valid_user_mtls
failed on setup with "rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)"
Raw output
+ Exception Group Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/db/people.py", line 78, in create_with_cert
| bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/public.py", line 55, in get_bundle
| await refresh_ocsp()
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 45, in refresh_ocsp
| async with asyncio.TaskGroup() as tgr:
| File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/taskgroups.py", line 145, in __aexit__
| raise me from None
| ExceptionGroup: unhandled errors in a TaskGroup (2 sub-exceptions)
+-+---------------- 1 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/refresh raised Server disconnected
+---------------- 2 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 40, in dump_crlfiles
| await post_ocsprest(f"{ocsprest_base()}/api/v1/dump_crl")
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/dump_crl raised Server disconnected
+------------------------------------
The above exception was the direct cause of the following exception:
ginosession = None
@pytest_asyncio.fixture(scope="session")
async def two_users(ginosession: None) -> Tuple[Person, Person]:
"""First one is normal, second is admin"""
_ = ginosession
> normal = await Person.create_with_cert("TestNormalUser")
tests/test_auth.py:24:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'TestNormalUser'
extra = None
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
newperson.certfile.write_text(bundlepem)
await newperson.create_pfx()
except Exception as exc:
LOGGER.exception("Something went wrong, doing cleanup")
shutil.rmtree(certspath)
remaining = list(certspath.rglob("*"))
LOGGER.debug("Remaining files: {}".format(remaining))
> raise BackendError(str(exc)) from exc
E rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)
src/rasenmaeher_api/db/people.py:86: BackendError
Check failure on line 24 in .mypy_cache/3.11/tests/test_auth.data.json
github-actions / JUnit report (local)
test_auth.test_valid_user_jwt
failed on setup with "rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)"
Raw output
+ Exception Group Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/db/people.py", line 78, in create_with_cert
| bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/public.py", line 55, in get_bundle
| await refresh_ocsp()
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 45, in refresh_ocsp
| async with asyncio.TaskGroup() as tgr:
| File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/taskgroups.py", line 145, in __aexit__
| raise me from None
| ExceptionGroup: unhandled errors in a TaskGroup (2 sub-exceptions)
+-+---------------- 1 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/refresh raised Server disconnected
+---------------- 2 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 40, in dump_crlfiles
| await post_ocsprest(f"{ocsprest_base()}/api/v1/dump_crl")
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/dump_crl raised Server disconnected
+------------------------------------
The above exception was the direct cause of the following exception:
ginosession = None
@pytest_asyncio.fixture(scope="session")
async def two_users(ginosession: None) -> Tuple[Person, Person]:
"""First one is normal, second is admin"""
_ = ginosession
> normal = await Person.create_with_cert("TestNormalUser")
tests/test_auth.py:24:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'TestNormalUser'
extra = None
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
newperson.certfile.write_text(bundlepem)
await newperson.create_pfx()
except Exception as exc:
LOGGER.exception("Something went wrong, doing cleanup")
shutil.rmtree(certspath)
remaining = list(certspath.rglob("*"))
LOGGER.debug("Remaining files: {}".format(remaining))
> raise BackendError(str(exc)) from exc
E rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)
src/rasenmaeher_api/db/people.py:86: BackendError
Check failure on line 24 in .mypy_cache/3.11/tests/test_auth.data.json
github-actions / JUnit report (local)
test_auth.test_valid_admin_mtls
failed on setup with "rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)"
Raw output
+ Exception Group Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/db/people.py", line 78, in create_with_cert
| bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/public.py", line 55, in get_bundle
| await refresh_ocsp()
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 45, in refresh_ocsp
| async with asyncio.TaskGroup() as tgr:
| File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/taskgroups.py", line 145, in __aexit__
| raise me from None
| ExceptionGroup: unhandled errors in a TaskGroup (2 sub-exceptions)
+-+---------------- 1 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/refresh raised Server disconnected
+---------------- 2 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 40, in dump_crlfiles
| await post_ocsprest(f"{ocsprest_base()}/api/v1/dump_crl")
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/dump_crl raised Server disconnected
+------------------------------------
The above exception was the direct cause of the following exception:
ginosession = None
@pytest_asyncio.fixture(scope="session")
async def two_users(ginosession: None) -> Tuple[Person, Person]:
"""First one is normal, second is admin"""
_ = ginosession
> normal = await Person.create_with_cert("TestNormalUser")
tests/test_auth.py:24:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'TestNormalUser'
extra = None
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
newperson.certfile.write_text(bundlepem)
await newperson.create_pfx()
except Exception as exc:
LOGGER.exception("Something went wrong, doing cleanup")
shutil.rmtree(certspath)
remaining = list(certspath.rglob("*"))
LOGGER.debug("Remaining files: {}".format(remaining))
> raise BackendError(str(exc)) from exc
E rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)
src/rasenmaeher_api/db/people.py:86: BackendError
Check failure on line 24 in .mypy_cache/3.11/tests/test_auth.data.json
github-actions / JUnit report (local)
test_auth.test_valid_admin_jwt
failed on setup with "rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)"
Raw output
+ Exception Group Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/db/people.py", line 78, in create_with_cert
| bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/public.py", line 55, in get_bundle
| await refresh_ocsp()
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 45, in refresh_ocsp
| async with asyncio.TaskGroup() as tgr:
| File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/taskgroups.py", line 145, in __aexit__
| raise me from None
| ExceptionGroup: unhandled errors in a TaskGroup (2 sub-exceptions)
+-+---------------- 1 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/refresh raised Server disconnected
+---------------- 2 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 40, in dump_crlfiles
| await post_ocsprest(f"{ocsprest_base()}/api/v1/dump_crl")
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/dump_crl raised Server disconnected
+------------------------------------
The above exception was the direct cause of the following exception:
ginosession = None
@pytest_asyncio.fixture(scope="session")
async def two_users(ginosession: None) -> Tuple[Person, Person]:
"""First one is normal, second is admin"""
_ = ginosession
> normal = await Person.create_with_cert("TestNormalUser")
tests/test_auth.py:24:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'TestNormalUser'
extra = None
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
newperson.certfile.write_text(bundlepem)
await newperson.create_pfx()
except Exception as exc:
LOGGER.exception("Something went wrong, doing cleanup")
shutil.rmtree(certspath)
remaining = list(certspath.rglob("*"))
LOGGER.debug("Remaining files: {}".format(remaining))
> raise BackendError(str(exc)) from exc
E rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)
src/rasenmaeher_api/db/people.py:86: BackendError
Check failure on line 33 in .mypy_cache/3.11/tests/test_cfssl.data.json
github-actions / JUnit report (local)
test_cfssl.test_get_crl
failed on setup with "rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)"
Raw output
+ Exception Group Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/db/people.py", line 78, in create_with_cert
| bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/public.py", line 55, in get_bundle
| await refresh_ocsp()
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 45, in refresh_ocsp
| async with asyncio.TaskGroup() as tgr:
| File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/taskgroups.py", line 145, in __aexit__
| raise me from None
| ExceptionGroup: unhandled errors in a TaskGroup (2 sub-exceptions)
+-+---------------- 1 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/refresh raised Server disconnected
+---------------- 2 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 40, in dump_crlfiles
| await post_ocsprest(f"{ocsprest_base()}/api/v1/dump_crl")
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/dump_crl raised Server disconnected
+------------------------------------
The above exception was the direct cause of the following exception:
ginosession = None
@pytest_asyncio.fixture(scope="session")
async def one_revoked_cert(ginosession: None) -> None:
"""Make sure we have at least one revoked cert"""
_ = ginosession
# We have to make actual certs to be able to revoke them
> person = await Person.create_with_cert(str(uuid.uuid4()))
tests/test_cfssl.py:33:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'rasenmaeher_api.db.people.Person'>
callsign = '0e2963cf-65a8-46c8-8d39-c7ccc7af9cda', extra = None
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
newperson.certfile.write_text(bundlepem)
await newperson.create_pfx()
except Exception as exc:
LOGGER.exception("Something went wrong, doing cleanup")
shutil.rmtree(certspath)
remaining = list(certspath.rglob("*"))
LOGGER.debug("Remaining files: {}".format(remaining))
> raise BackendError(str(exc)) from exc
E rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)
src/rasenmaeher_api/db/people.py:86: BackendError
Check failure on line 33 in .mypy_cache/3.11/tests/test_cfssl.data.json
github-actions / JUnit report (local)
test_cfssl.test_crl_route
failed on setup with "rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)"
Raw output
+ Exception Group Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/db/people.py", line 78, in create_with_cert
| bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/public.py", line 55, in get_bundle
| await refresh_ocsp()
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 45, in refresh_ocsp
| async with asyncio.TaskGroup() as tgr:
| File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/taskgroups.py", line 145, in __aexit__
| raise me from None
| ExceptionGroup: unhandled errors in a TaskGroup (2 sub-exceptions)
+-+---------------- 1 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/refresh raised Server disconnected
+---------------- 2 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 40, in dump_crlfiles
| await post_ocsprest(f"{ocsprest_base()}/api/v1/dump_crl")
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/dump_crl raised Server disconnected
+------------------------------------
The above exception was the direct cause of the following exception:
ginosession = None
@pytest_asyncio.fixture(scope="session")
async def one_revoked_cert(ginosession: None) -> None:
"""Make sure we have at least one revoked cert"""
_ = ginosession
# We have to make actual certs to be able to revoke them
> person = await Person.create_with_cert(str(uuid.uuid4()))
tests/test_cfssl.py:33:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'rasenmaeher_api.db.people.Person'>
callsign = '0e2963cf-65a8-46c8-8d39-c7ccc7af9cda', extra = None
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
newperson.certfile.write_text(bundlepem)
await newperson.create_pfx()
except Exception as exc:
LOGGER.exception("Something went wrong, doing cleanup")
shutil.rmtree(certspath)
remaining = list(certspath.rglob("*"))
LOGGER.debug("Remaining files: {}".format(remaining))
> raise BackendError(str(exc)) from exc
E rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)
src/rasenmaeher_api/db/people.py:86: BackendError
Check failure on line 168 in .mypy_cache/3.11/tests/test_db.data.json
github-actions / JUnit report (local)
test_db.test_enrollments_crud
rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)
Raw output
+ Exception Group Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/db/people.py", line 78, in create_with_cert
| bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/public.py", line 55, in get_bundle
| await refresh_ocsp()
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 45, in refresh_ocsp
| async with asyncio.TaskGroup() as tgr:
| File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/taskgroups.py", line 145, in __aexit__
| raise me from None
| ExceptionGroup: unhandled errors in a TaskGroup (2 sub-exceptions)
+-+---------------- 1 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/refresh raised Server disconnected
+---------------- 2 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 40, in dump_crlfiles
| await post_ocsprest(f"{ocsprest_base()}/api/v1/dump_crl")
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/dump_crl raised Server disconnected
+------------------------------------
The above exception was the direct cause of the following exception:
ginosession = None
@pytest.mark.asyncio
async def test_enrollments_crud(ginosession: None) -> None:
"""Test the db abstraction enrollments"""
_ = ginosession
# Done this way to avoid the cost of the certificate workflow, you should never do this outside of unittests
person = Person(callsign="MEGAMAN00a", certspath=str(uuid.uuid4()))
await person.create()
# refresh
person = await Person.by_callsign("MEGAMAN00a")
obj = await Enrollment.create_for_callsign("PORA22b")
assert obj.approvecode
assert obj.callsign == "PORA22b"
assert obj.state == EnrollmentState.PENDING
obj2 = await Enrollment.by_approvecode(obj.approvecode)
assert obj2.callsign == obj.callsign
obj3 = await Enrollment.by_callsign(obj.callsign)
assert obj3.callsign == obj.callsign
await Enrollment.by_pk_or_callsign("PORA22b")
await Enrollment.by_pk_or_callsign(str(obj.pk))
await Enrollment.by_pk_or_callsign(uuid_to_b64(obj.pk))
await Enrollment.by_pk_or_callsign(obj.pk)
old_code = str(obj.approvecode)
new_code = await obj.reset_approvecode()
assert old_code != new_code
new_new_code = await Enrollment.reset_approvecode4callsign("PORA22b")
assert new_new_code != new_code
with pytest.raises(CallsignReserved):
await Enrollment.create_for_callsign("PORA22b")
with pytest.raises(ForbiddenOperation):
await obj2.delete()
await obj.reject(person)
obj4 = await Enrollment.by_pk(uuid_to_b64(obj.pk))
assert obj4.decided_on
assert obj4.decided_by == person.pk
assert obj4.state == EnrollmentState.REJECTED
obj5 = await Enrollment.create_for_callsign("ERAPPROVTEST01a")
> person2 = await obj5.approve(person)
tests/test_db.py:168:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
src/rasenmaeher_api/db/enrollments.py:163: in approve
person = await Person.create_with_cert(self.callsign, extra=self.extra)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'ERAPPROVTEST01a'
extra = None
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
newperson.certfile.write_text(bundlepem)
await newperson.create_pfx()
except Exception as exc:
LOGGER.exception("Something went wrong, doing cleanup")
shutil.rmtree(certspath)
remaining = list(certspath.rglob("*"))
LOGGER.debug("Remaining files: {}".format(remaining))
> raise BackendError(str(exc)) from exc
E rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)
src/rasenmaeher_api/db/people.py:86: BackendError
Check failure on line 327 in .mypy_cache/3.11/tests/test_db.data.json
github-actions / JUnit report (local)
test_db.test_person_with_cert
rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)
Raw output
+ Exception Group Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/db/people.py", line 78, in create_with_cert
| bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/public.py", line 55, in get_bundle
| await refresh_ocsp()
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 45, in refresh_ocsp
| async with asyncio.TaskGroup() as tgr:
| File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/taskgroups.py", line 145, in __aexit__
| raise me from None
| ExceptionGroup: unhandled errors in a TaskGroup (2 sub-exceptions)
+-+---------------- 1 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/refresh raised Server disconnected
+---------------- 2 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 40, in dump_crlfiles
| await post_ocsprest(f"{ocsprest_base()}/api/v1/dump_crl")
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/dump_crl raised Server disconnected
+------------------------------------
The above exception was the direct cause of the following exception:
ginosession = None
@pytest.mark.asyncio
async def test_person_with_cert(ginosession: None) -> None:
"""Test the cert creation with the classmethod (and revocation)"""
_ = ginosession
await mtls_init()
> person = await Person.create_with_cert("BINGO01a", {"kissa": "puuma"})
tests/test_db.py:327:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'BINGO01a'
extra = {'kissa': 'puuma'}
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
newperson.certfile.write_text(bundlepem)
await newperson.create_pfx()
except Exception as exc:
LOGGER.exception("Something went wrong, doing cleanup")
shutil.rmtree(certspath)
remaining = list(certspath.rglob("*"))
LOGGER.debug("Remaining files: {}".format(remaining))
> raise BackendError(str(exc)) from exc
E rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)
src/rasenmaeher_api/db/people.py:86: BackendError
Check failure on line 368 in .mypy_cache/3.11/tests/test_db.data.json
github-actions / JUnit report (local)
test_db.test_person_with_cert_duplicatename
rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)
Raw output
+ Exception Group Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/db/people.py", line 78, in create_with_cert
| bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/public.py", line 55, in get_bundle
| await refresh_ocsp()
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 45, in refresh_ocsp
| async with asyncio.TaskGroup() as tgr:
| File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/taskgroups.py", line 145, in __aexit__
| raise me from None
| ExceptionGroup: unhandled errors in a TaskGroup (2 sub-exceptions)
+-+---------------- 1 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/refresh raised Server disconnected
+---------------- 2 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 40, in dump_crlfiles
| await post_ocsprest(f"{ocsprest_base()}/api/v1/dump_crl")
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/dump_crl raised Server disconnected
+------------------------------------
The above exception was the direct cause of the following exception:
ginosession = None
@pytest.mark.asyncio
async def test_person_with_cert_duplicatename(ginosession: None) -> None:
"""Test the cert creation with the classmethod but reserved callsign"""
_ = ginosession
await mtls_init()
callsign = "RUOSKA23a"
peoplepath = Path(switchme_to_singleton_call.persistent_data_dir) / "private" / "people"
> person = await Person.create_with_cert(callsign)
tests/test_db.py:368:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'RUOSKA23a'
extra = None
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
newperson.certfile.write_text(bundlepem)
await newperson.create_pfx()
except Exception as exc:
LOGGER.exception("Something went wrong, doing cleanup")
shutil.rmtree(certspath)
remaining = list(certspath.rglob("*"))
LOGGER.debug("Remaining files: {}".format(remaining))
> raise BackendError(str(exc)) from exc
E rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)
src/rasenmaeher_api/db/people.py:86: BackendError
Check failure on line 385 in .mypy_cache/3.11/tests/test_db.data.json
github-actions / JUnit report (local)
test_db.test_pfx_parse
rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)
Raw output
+ Exception Group Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/db/people.py", line 78, in create_with_cert
| bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/public.py", line 55, in get_bundle
| await refresh_ocsp()
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 45, in refresh_ocsp
| async with asyncio.TaskGroup() as tgr:
| File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/taskgroups.py", line 145, in __aexit__
| raise me from None
| ExceptionGroup: unhandled errors in a TaskGroup (2 sub-exceptions)
+-+---------------- 1 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/refresh raised Server disconnected
+---------------- 2 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 40, in dump_crlfiles
| await post_ocsprest(f"{ocsprest_base()}/api/v1/dump_crl")
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/dump_crl raised Server disconnected
+------------------------------------
The above exception was the direct cause of the following exception:
ginosession = None
@pytest.mark.asyncio
async def test_pfx_parse(ginosession: None) -> None:
"""Test that the PFX file gets done"""
_ = ginosession
await mtls_init()
> person = await Person.create_with_cert("PFXMAN01a")
tests/test_db.py:385:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'PFXMAN01a'
extra = None
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
newperson.certfile.write_text(bundlepem)
await newperson.create_pfx()
except Exception as exc:
LOGGER.exception("Something went wrong, doing cleanup")
shutil.rmtree(certspath)
remaining = list(certspath.rglob("*"))
LOGGER.debug("Remaining files: {}".format(remaining))
> raise BackendError(str(exc)) from exc
E rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)
src/rasenmaeher_api/db/people.py:86: BackendError
Check failure on line 1 in .mypy_cache/3.11/tests/test_enrollment.data.json
github-actions / JUnit report (local)
test_enrollment.test_enroll_verif_code[tilauspalvelu_jwt_admin_client0]
failed on setup with "rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)"
Raw output
+ Exception Group Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/db/people.py", line 78, in create_with_cert
| bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/public.py", line 55, in get_bundle
| await refresh_ocsp()
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 45, in refresh_ocsp
| async with asyncio.TaskGroup() as tgr:
| File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/taskgroups.py", line 145, in __aexit__
| raise me from None
| ExceptionGroup: unhandled errors in a TaskGroup (2 sub-exceptions)
+-+---------------- 1 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/refresh raised Server disconnected
+---------------- 2 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 40, in dump_crlfiles
| await post_ocsprest(f"{ocsprest_base()}/api/v1/dump_crl")
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/dump_crl raised Server disconnected
+------------------------------------
The above exception was the direct cause of the following exception:
request = <SubRequest 'test_user_secrets' for <Coroutine test_enroll_verif_code[tilauspalvelu_jwt_admin_client0]>>
kwargs = {'session_env_config': None}
setup = <function _wrap_async_fixture.<locals>._async_fixture_wrapper.<locals>.setup at 0x7fd0cacf0360>
@functools.wraps(fixture)
def _async_fixture_wrapper(request: SubRequest, **kwargs: Any):
func = _perhaps_rebind_fixture_func(
fixture, request.instance, fixturedef.unittest
)
event_loop = kwargs.pop(event_loop_fixture_id)
async def setup():
res = await func(
**_add_kwargs(func, kwargs, event_loop_fixture_id, event_loop, request)
)
return res
> return event_loop.run_until_complete(setup())
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:359:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:653: in run_until_complete
return future.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:354: in setup
res = await func(
tests/conftest.py:52: in test_user_secrets
return await create_test_users()
src/rasenmaeher_api/testhelpers.py:21: in create_test_users
_anon_user = await Person.create_with_cert(callsign="anon_admin", extra={})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
newperson.certfile.write_text(bundlepem)
await newperson.create_pfx()
except Exception as exc:
LOGGER.exception("Something went wrong, doing cleanup")
shutil.rmtree(certspath)
remaining = list(certspath.rglob("*"))
LOGGER.debug("Remaining files: {}".format(remaining))
> raise BackendError(str(exc)) from exc
E rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)
src/rasenmaeher_api/db/people.py:86: BackendError
Check failure on line 1 in .mypy_cache/3.11/tests/test_enrollment.data.json
github-actions / JUnit report (local)
test_enrollment.test_enroll_show_verif_code[tilauspalvelu_jwt_admin_client0]
failed on setup with "rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)"
Raw output
+ Exception Group Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/db/people.py", line 78, in create_with_cert
| bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/public.py", line 55, in get_bundle
| await refresh_ocsp()
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 45, in refresh_ocsp
| async with asyncio.TaskGroup() as tgr:
| File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/taskgroups.py", line 145, in __aexit__
| raise me from None
| ExceptionGroup: unhandled errors in a TaskGroup (2 sub-exceptions)
+-+---------------- 1 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/refresh raised Server disconnected
+---------------- 2 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 40, in dump_crlfiles
| await post_ocsprest(f"{ocsprest_base()}/api/v1/dump_crl")
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/dump_crl raised Server disconnected
+------------------------------------
The above exception was the direct cause of the following exception:
request = <SubRequest 'test_user_secrets' for <Coroutine test_enroll_verif_code[tilauspalvelu_jwt_admin_client0]>>
kwargs = {'session_env_config': None}
setup = <function _wrap_async_fixture.<locals>._async_fixture_wrapper.<locals>.setup at 0x7fd0cacf0360>
@functools.wraps(fixture)
def _async_fixture_wrapper(request: SubRequest, **kwargs: Any):
func = _perhaps_rebind_fixture_func(
fixture, request.instance, fixturedef.unittest
)
event_loop = kwargs.pop(event_loop_fixture_id)
async def setup():
res = await func(
**_add_kwargs(func, kwargs, event_loop_fixture_id, event_loop, request)
)
return res
> return event_loop.run_until_complete(setup())
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:359:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:653: in run_until_complete
return future.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:354: in setup
res = await func(
tests/conftest.py:52: in test_user_secrets
return await create_test_users()
src/rasenmaeher_api/testhelpers.py:21: in create_test_users
_anon_user = await Person.create_with_cert(callsign="anon_admin", extra={})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
newperson.certfile.write_text(bundlepem)
await newperson.create_pfx()
except Exception as exc:
LOGGER.exception("Something went wrong, doing cleanup")
shutil.rmtree(certspath)
remaining = list(certspath.rglob("*"))
LOGGER.debug("Remaining files: {}".format(remaining))
> raise BackendError(str(exc)) from exc
E rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)
src/rasenmaeher_api/db/people.py:86: BackendError
Check failure on line 1 in .mypy_cache/3.11/tests/test_enrollment.data.json
github-actions / JUnit report (local)
test_enrollment.test_enroll_show_verifcode_bad_code[tilauspalvelu_jwt_admin_client0]
failed on setup with "rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)"
Raw output
+ Exception Group Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/db/people.py", line 78, in create_with_cert
| bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/public.py", line 55, in get_bundle
| await refresh_ocsp()
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 45, in refresh_ocsp
| async with asyncio.TaskGroup() as tgr:
| File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/taskgroups.py", line 145, in __aexit__
| raise me from None
| ExceptionGroup: unhandled errors in a TaskGroup (2 sub-exceptions)
+-+---------------- 1 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/refresh raised Server disconnected
+---------------- 2 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 40, in dump_crlfiles
| await post_ocsprest(f"{ocsprest_base()}/api/v1/dump_crl")
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/dump_crl raised Server disconnected
+------------------------------------
The above exception was the direct cause of the following exception:
request = <SubRequest 'test_user_secrets' for <Coroutine test_enroll_verif_code[tilauspalvelu_jwt_admin_client0]>>
kwargs = {'session_env_config': None}
setup = <function _wrap_async_fixture.<locals>._async_fixture_wrapper.<locals>.setup at 0x7fd0cacf0360>
@functools.wraps(fixture)
def _async_fixture_wrapper(request: SubRequest, **kwargs: Any):
func = _perhaps_rebind_fixture_func(
fixture, request.instance, fixturedef.unittest
)
event_loop = kwargs.pop(event_loop_fixture_id)
async def setup():
res = await func(
**_add_kwargs(func, kwargs, event_loop_fixture_id, event_loop, request)
)
return res
> return event_loop.run_until_complete(setup())
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:359:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:653: in run_until_complete
return future.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:354: in setup
res = await func(
tests/conftest.py:52: in test_user_secrets
return await create_test_users()
src/rasenmaeher_api/testhelpers.py:21: in create_test_users
_anon_user = await Person.create_with_cert(callsign="anon_admin", extra={})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
newperson.certfile.write_text(bundlepem)
await newperson.create_pfx()
except Exception as exc:
LOGGER.exception("Something went wrong, doing cleanup")
shutil.rmtree(certspath)
remaining = list(certspath.rglob("*"))
LOGGER.debug("Remaining files: {}".format(remaining))
> raise BackendError(str(exc)) from exc
E rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)
src/rasenmaeher_api/db/people.py:86: BackendError
Check failure on line 1 in .mypy_cache/3.11/tests/test_enrollment.data.json
github-actions / JUnit report (local)
test_enrollment.test_post_init[tilauspalvelu_jwt_admin_client0]
failed on setup with "rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)"
Raw output
+ Exception Group Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/db/people.py", line 78, in create_with_cert
| bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/public.py", line 55, in get_bundle
| await refresh_ocsp()
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 45, in refresh_ocsp
| async with asyncio.TaskGroup() as tgr:
| File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/taskgroups.py", line 145, in __aexit__
| raise me from None
| ExceptionGroup: unhandled errors in a TaskGroup (2 sub-exceptions)
+-+---------------- 1 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/refresh raised Server disconnected
+---------------- 2 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 40, in dump_crlfiles
| await post_ocsprest(f"{ocsprest_base()}/api/v1/dump_crl")
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/dump_crl raised Server disconnected
+------------------------------------
The above exception was the direct cause of the following exception:
request = <SubRequest 'test_user_secrets' for <Coroutine test_enroll_verif_code[tilauspalvelu_jwt_admin_client0]>>
kwargs = {'session_env_config': None}
setup = <function _wrap_async_fixture.<locals>._async_fixture_wrapper.<locals>.setup at 0x7fd0cacf0360>
@functools.wraps(fixture)
def _async_fixture_wrapper(request: SubRequest, **kwargs: Any):
func = _perhaps_rebind_fixture_func(
fixture, request.instance, fixturedef.unittest
)
event_loop = kwargs.pop(event_loop_fixture_id)
async def setup():
res = await func(
**_add_kwargs(func, kwargs, event_loop_fixture_id, event_loop, request)
)
return res
> return event_loop.run_until_complete(setup())
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:359:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:653: in run_until_complete
return future.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:354: in setup
res = await func(
tests/conftest.py:52: in test_user_secrets
return await create_test_users()
src/rasenmaeher_api/testhelpers.py:21: in create_test_users
_anon_user = await Person.create_with_cert(callsign="anon_admin", extra={})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
newperson.certfile.write_text(bundlepem)
await newperson.create_pfx()
except Exception as exc:
LOGGER.exception("Something went wrong, doing cleanup")
shutil.rmtree(certspath)
remaining = list(certspath.rglob("*"))
LOGGER.debug("Remaining files: {}".format(remaining))
> raise BackendError(str(exc)) from exc
E rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)
src/rasenmaeher_api/db/people.py:86: BackendError
Check failure on line 1 in .mypy_cache/3.11/tests/test_enrollment.data.json
github-actions / JUnit report (local)
test_enrollment.test_promote_demote[tilauspalvelu_jwt_admin_client0]
failed on setup with "rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)"
Raw output
+ Exception Group Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/db/people.py", line 78, in create_with_cert
| bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/public.py", line 55, in get_bundle
| await refresh_ocsp()
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 45, in refresh_ocsp
| async with asyncio.TaskGroup() as tgr:
| File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/taskgroups.py", line 145, in __aexit__
| raise me from None
| ExceptionGroup: unhandled errors in a TaskGroup (2 sub-exceptions)
+-+---------------- 1 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/refresh raised Server disconnected
+---------------- 2 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 40, in dump_crlfiles
| await post_ocsprest(f"{ocsprest_base()}/api/v1/dump_crl")
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/dump_crl raised Server disconnected
+------------------------------------
The above exception was the direct cause of the following exception:
request = <SubRequest 'test_user_secrets' for <Coroutine test_enroll_verif_code[tilauspalvelu_jwt_admin_client0]>>
kwargs = {'session_env_config': None}
setup = <function _wrap_async_fixture.<locals>._async_fixture_wrapper.<locals>.setup at 0x7fd0cacf0360>
@functools.wraps(fixture)
def _async_fixture_wrapper(request: SubRequest, **kwargs: Any):
func = _perhaps_rebind_fixture_func(
fixture, request.instance, fixturedef.unittest
)
event_loop = kwargs.pop(event_loop_fixture_id)
async def setup():
res = await func(
**_add_kwargs(func, kwargs, event_loop_fixture_id, event_loop, request)
)
return res
> return event_loop.run_until_complete(setup())
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:359:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:653: in run_until_complete
return future.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:354: in setup
res = await func(
tests/conftest.py:52: in test_user_secrets
return await create_test_users()
src/rasenmaeher_api/testhelpers.py:21: in create_test_users
_anon_user = await Person.create_with_cert(callsign="anon_admin", extra={})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
newperson.certfile.write_text(bundlepem)
await newperson.create_pfx()
except Exception as exc:
LOGGER.exception("Something went wrong, doing cleanup")
shutil.rmtree(certspath)
remaining = list(certspath.rglob("*"))
LOGGER.debug("Remaining files: {}".format(remaining))
> raise BackendError(str(exc)) from exc
E rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)
src/rasenmaeher_api/db/people.py:86: BackendError
Check failure on line 1 in .mypy_cache/3.11/tests/test_enrollment.data.json
github-actions / JUnit report (local)
test_enrollment.test_lock[tilauspalvelu_jwt_admin_client0]
failed on setup with "rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)"
Raw output
+ Exception Group Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/db/people.py", line 78, in create_with_cert
| bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/public.py", line 55, in get_bundle
| await refresh_ocsp()
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 45, in refresh_ocsp
| async with asyncio.TaskGroup() as tgr:
| File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/taskgroups.py", line 145, in __aexit__
| raise me from None
| ExceptionGroup: unhandled errors in a TaskGroup (2 sub-exceptions)
+-+---------------- 1 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/refresh raised Server disconnected
+---------------- 2 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 40, in dump_crlfiles
| await post_ocsprest(f"{ocsprest_base()}/api/v1/dump_crl")
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/dump_crl raised Server disconnected
+------------------------------------
The above exception was the direct cause of the following exception:
request = <SubRequest 'test_user_secrets' for <Coroutine test_enroll_verif_code[tilauspalvelu_jwt_admin_client0]>>
kwargs = {'session_env_config': None}
setup = <function _wrap_async_fixture.<locals>._async_fixture_wrapper.<locals>.setup at 0x7fd0cacf0360>
@functools.wraps(fixture)
def _async_fixture_wrapper(request: SubRequest, **kwargs: Any):
func = _perhaps_rebind_fixture_func(
fixture, request.instance, fixturedef.unittest
)
event_loop = kwargs.pop(event_loop_fixture_id)
async def setup():
res = await func(
**_add_kwargs(func, kwargs, event_loop_fixture_id, event_loop, request)
)
return res
> return event_loop.run_until_complete(setup())
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:359:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:653: in run_until_complete
return future.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:354: in setup
res = await func(
tests/conftest.py:52: in test_user_secrets
return await create_test_users()
src/rasenmaeher_api/testhelpers.py:21: in create_test_users
_anon_user = await Person.create_with_cert(callsign="anon_admin", extra={})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
newperson.certfile.write_text(bundlepem)
await newperson.create_pfx()
except Exception as exc:
LOGGER.exception("Something went wrong, doing cleanup")
shutil.rmtree(certspath)
remaining = list(certspath.rglob("*"))
LOGGER.debug("Remaining files: {}".format(remaining))
> raise BackendError(str(exc)) from exc
E rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)
src/rasenmaeher_api/db/people.py:86: BackendError
Check failure on line 1 in .mypy_cache/3.11/tests/test_enrollment.data.json
github-actions / JUnit report (local)
test_enrollment.test_accept[tilauspalvelu_jwt_admin_client0]
failed on setup with "rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)"
Raw output
+ Exception Group Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/db/people.py", line 78, in create_with_cert
| bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/public.py", line 55, in get_bundle
| await refresh_ocsp()
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 45, in refresh_ocsp
| async with asyncio.TaskGroup() as tgr:
| File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/taskgroups.py", line 145, in __aexit__
| raise me from None
| ExceptionGroup: unhandled errors in a TaskGroup (2 sub-exceptions)
+-+---------------- 1 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/refresh raised Server disconnected
+---------------- 2 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 40, in dump_crlfiles
| await post_ocsprest(f"{ocsprest_base()}/api/v1/dump_crl")
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/dump_crl raised Server disconnected
+------------------------------------
The above exception was the direct cause of the following exception:
request = <SubRequest 'test_user_secrets' for <Coroutine test_enroll_verif_code[tilauspalvelu_jwt_admin_client0]>>
kwargs = {'session_env_config': None}
setup = <function _wrap_async_fixture.<locals>._async_fixture_wrapper.<locals>.setup at 0x7fd0cacf0360>
@functools.wraps(fixture)
def _async_fixture_wrapper(request: SubRequest, **kwargs: Any):
func = _perhaps_rebind_fixture_func(
fixture, request.instance, fixturedef.unittest
)
event_loop = kwargs.pop(event_loop_fixture_id)
async def setup():
res = await func(
**_add_kwargs(func, kwargs, event_loop_fixture_id, event_loop, request)
)
return res
> return event_loop.run_until_complete(setup())
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:359:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:653: in run_until_complete
return future.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:354: in setup
res = await func(
tests/conftest.py:52: in test_user_secrets
return await create_test_users()
src/rasenmaeher_api/testhelpers.py:21: in create_test_users
_anon_user = await Person.create_with_cert(callsign="anon_admin", extra={})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
newperson.certfile.write_text(bundlepem)
await newperson.create_pfx()
except Exception as exc:
LOGGER.exception("Something went wrong, doing cleanup")
shutil.rmtree(certspath)
remaining = list(certspath.rglob("*"))
LOGGER.debug("Remaining files: {}".format(remaining))
> raise BackendError(str(exc)) from exc
E rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)
src/rasenmaeher_api/db/people.py:86: BackendError
Check failure on line 1 in .mypy_cache/3.11/tests/test_enrollment.data.json
github-actions / JUnit report (local)
test_enrollment.test_accept_no_such_user[tilauspalvelu_jwt_admin_client0]
failed on setup with "rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)"
Raw output
+ Exception Group Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/db/people.py", line 78, in create_with_cert
| bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/public.py", line 55, in get_bundle
| await refresh_ocsp()
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 45, in refresh_ocsp
| async with asyncio.TaskGroup() as tgr:
| File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/taskgroups.py", line 145, in __aexit__
| raise me from None
| ExceptionGroup: unhandled errors in a TaskGroup (2 sub-exceptions)
+-+---------------- 1 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/refresh raised Server disconnected
+---------------- 2 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 40, in dump_crlfiles
| await post_ocsprest(f"{ocsprest_base()}/api/v1/dump_crl")
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/dump_crl raised Server disconnected
+------------------------------------
The above exception was the direct cause of the following exception:
request = <SubRequest 'test_user_secrets' for <Coroutine test_enroll_verif_code[tilauspalvelu_jwt_admin_client0]>>
kwargs = {'session_env_config': None}
setup = <function _wrap_async_fixture.<locals>._async_fixture_wrapper.<locals>.setup at 0x7fd0cacf0360>
@functools.wraps(fixture)
def _async_fixture_wrapper(request: SubRequest, **kwargs: Any):
func = _perhaps_rebind_fixture_func(
fixture, request.instance, fixturedef.unittest
)
event_loop = kwargs.pop(event_loop_fixture_id)
async def setup():
res = await func(
**_add_kwargs(func, kwargs, event_loop_fixture_id, event_loop, request)
)
return res
> return event_loop.run_until_complete(setup())
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:359:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:653: in run_until_complete
return future.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:354: in setup
res = await func(
tests/conftest.py:52: in test_user_secrets
return await create_test_users()
src/rasenmaeher_api/testhelpers.py:21: in create_test_users
_anon_user = await Person.create_with_cert(callsign="anon_admin", extra={})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
newperson.certfile.write_text(bundlepem)
await newperson.create_pfx()
except Exception as exc:
LOGGER.exception("Something went wrong, doing cleanup")
shutil.rmtree(certspath)
remaining = list(certspath.rglob("*"))
LOGGER.debug("Remaining files: {}".format(remaining))
> raise BackendError(str(exc)) from exc
E rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)
src/rasenmaeher_api/db/people.py:86: BackendError
Check failure on line 1 in .mypy_cache/3.11/tests/test_enrollment.data.json
github-actions / JUnit report (local)
test_enrollment.test_invitecode_create[tilauspalvelu_jwt_admin_client0]
failed on setup with "rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)"
Raw output
+ Exception Group Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/db/people.py", line 78, in create_with_cert
| bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/public.py", line 55, in get_bundle
| await refresh_ocsp()
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 45, in refresh_ocsp
| async with asyncio.TaskGroup() as tgr:
| File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/taskgroups.py", line 145, in __aexit__
| raise me from None
| ExceptionGroup: unhandled errors in a TaskGroup (2 sub-exceptions)
+-+---------------- 1 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/refresh raised Server disconnected
+---------------- 2 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 40, in dump_crlfiles
| await post_ocsprest(f"{ocsprest_base()}/api/v1/dump_crl")
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/dump_crl raised Server disconnected
+------------------------------------
The above exception was the direct cause of the following exception:
request = <SubRequest 'test_user_secrets' for <Coroutine test_enroll_verif_code[tilauspalvelu_jwt_admin_client0]>>
kwargs = {'session_env_config': None}
setup = <function _wrap_async_fixture.<locals>._async_fixture_wrapper.<locals>.setup at 0x7fd0cacf0360>
@functools.wraps(fixture)
def _async_fixture_wrapper(request: SubRequest, **kwargs: Any):
func = _perhaps_rebind_fixture_func(
fixture, request.instance, fixturedef.unittest
)
event_loop = kwargs.pop(event_loop_fixture_id)
async def setup():
res = await func(
**_add_kwargs(func, kwargs, event_loop_fixture_id, event_loop, request)
)
return res
> return event_loop.run_until_complete(setup())
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:359:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:653: in run_until_complete
return future.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:354: in setup
res = await func(
tests/conftest.py:52: in test_user_secrets
return await create_test_users()
src/rasenmaeher_api/testhelpers.py:21: in create_test_users
_anon_user = await Person.create_with_cert(callsign="anon_admin", extra={})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
newperson.certfile.write_text(bundlepem)
await newperson.create_pfx()
except Exception as exc:
LOGGER.exception("Something went wrong, doing cleanup")
shutil.rmtree(certspath)
remaining = list(certspath.rglob("*"))
LOGGER.debug("Remaining files: {}".format(remaining))
> raise BackendError(str(exc)) from exc
E rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)
src/rasenmaeher_api/db/people.py:86: BackendError
Check failure on line 1 in .mypy_cache/3.11/tests/test_enrollment.data.json
github-actions / JUnit report (local)
test_enrollment.test_invitecode_dectivate[tilauspalvelu_jwt_admin_client0]
failed on setup with "rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)"
Raw output
+ Exception Group Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/db/people.py", line 78, in create_with_cert
| bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/public.py", line 55, in get_bundle
| await refresh_ocsp()
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 45, in refresh_ocsp
| async with asyncio.TaskGroup() as tgr:
| File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/taskgroups.py", line 145, in __aexit__
| raise me from None
| ExceptionGroup: unhandled errors in a TaskGroup (2 sub-exceptions)
+-+---------------- 1 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/refresh raised Server disconnected
+---------------- 2 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 40, in dump_crlfiles
| await post_ocsprest(f"{ocsprest_base()}/api/v1/dump_crl")
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/dump_crl raised Server disconnected
+------------------------------------
The above exception was the direct cause of the following exception:
request = <SubRequest 'test_user_secrets' for <Coroutine test_enroll_verif_code[tilauspalvelu_jwt_admin_client0]>>
kwargs = {'session_env_config': None}
setup = <function _wrap_async_fixture.<locals>._async_fixture_wrapper.<locals>.setup at 0x7fd0cacf0360>
@functools.wraps(fixture)
def _async_fixture_wrapper(request: SubRequest, **kwargs: Any):
func = _perhaps_rebind_fixture_func(
fixture, request.instance, fixturedef.unittest
)
event_loop = kwargs.pop(event_loop_fixture_id)
async def setup():
res = await func(
**_add_kwargs(func, kwargs, event_loop_fixture_id, event_loop, request)
)
return res
> return event_loop.run_until_complete(setup())
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:359:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:653: in run_until_complete
return future.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:354: in setup
res = await func(
tests/conftest.py:52: in test_user_secrets
return await create_test_users()
src/rasenmaeher_api/testhelpers.py:21: in create_test_users
_anon_user = await Person.create_with_cert(callsign="anon_admin", extra={})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
newperson.certfile.write_text(bundlepem)
await newperson.create_pfx()
except Exception as exc:
LOGGER.exception("Something went wrong, doing cleanup")
shutil.rmtree(certspath)
remaining = list(certspath.rglob("*"))
LOGGER.debug("Remaining files: {}".format(remaining))
> raise BackendError(str(exc)) from exc
E rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)
src/rasenmaeher_api/db/people.py:86: BackendError
Check failure on line 1 in .mypy_cache/3.11/tests/test_enrollment.data.json
github-actions / JUnit report (local)
test_enrollment.test_invitecode_activate[tilauspalvelu_jwt_admin_client0]
failed on setup with "rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)"
Raw output
+ Exception Group Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/db/people.py", line 78, in create_with_cert
| bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/public.py", line 55, in get_bundle
| await refresh_ocsp()
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 45, in refresh_ocsp
| async with asyncio.TaskGroup() as tgr:
| File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/taskgroups.py", line 145, in __aexit__
| raise me from None
| ExceptionGroup: unhandled errors in a TaskGroup (2 sub-exceptions)
+-+---------------- 1 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/refresh raised Server disconnected
+---------------- 2 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 40, in dump_crlfiles
| await post_ocsprest(f"{ocsprest_base()}/api/v1/dump_crl")
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/dump_crl raised Server disconnected
+------------------------------------
The above exception was the direct cause of the following exception:
request = <SubRequest 'test_user_secrets' for <Coroutine test_enroll_verif_code[tilauspalvelu_jwt_admin_client0]>>
kwargs = {'session_env_config': None}
setup = <function _wrap_async_fixture.<locals>._async_fixture_wrapper.<locals>.setup at 0x7fd0cacf0360>
@functools.wraps(fixture)
def _async_fixture_wrapper(request: SubRequest, **kwargs: Any):
func = _perhaps_rebind_fixture_func(
fixture, request.instance, fixturedef.unittest
)
event_loop = kwargs.pop(event_loop_fixture_id)
async def setup():
res = await func(
**_add_kwargs(func, kwargs, event_loop_fixture_id, event_loop, request)
)
return res
> return event_loop.run_until_complete(setup())
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:359:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:653: in run_until_complete
return future.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:354: in setup
res = await func(
tests/conftest.py:52: in test_user_secrets
return await create_test_users()
src/rasenmaeher_api/testhelpers.py:21: in create_test_users
_anon_user = await Person.create_with_cert(callsign="anon_admin", extra={})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
newperson.certfile.write_text(bundlepem)
await newperson.create_pfx()
except Exception as exc:
LOGGER.exception("Something went wrong, doing cleanup")
shutil.rmtree(certspath)
remaining = list(certspath.rglob("*"))
LOGGER.debug("Remaining files: {}".format(remaining))
> raise BackendError(str(exc)) from exc
E rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)
src/rasenmaeher_api/db/people.py:86: BackendError
Check failure on line 1 in .mypy_cache/3.11/tests/test_enrollment.data.json
github-actions / JUnit report (local)
test_enrollment.test_show_verifcode_no_permission
failed on setup with "rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)"
Raw output
+ Exception Group Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/db/people.py", line 78, in create_with_cert
| bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/public.py", line 55, in get_bundle
| await refresh_ocsp()
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 45, in refresh_ocsp
| async with asyncio.TaskGroup() as tgr:
| File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/taskgroups.py", line 145, in __aexit__
| raise me from None
| ExceptionGroup: unhandled errors in a TaskGroup (2 sub-exceptions)
+-+---------------- 1 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/refresh raised Server disconnected
+---------------- 2 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 40, in dump_crlfiles
| await post_ocsprest(f"{ocsprest_base()}/api/v1/dump_crl")
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/dump_crl raised Server disconnected
+------------------------------------
The above exception was the direct cause of the following exception:
request = <SubRequest 'test_user_secrets' for <Coroutine test_enroll_verif_code[tilauspalvelu_jwt_admin_client0]>>
kwargs = {'session_env_config': None}
setup = <function _wrap_async_fixture.<locals>._async_fixture_wrapper.<locals>.setup at 0x7fd0cacf0360>
@functools.wraps(fixture)
def _async_fixture_wrapper(request: SubRequest, **kwargs: Any):
func = _perhaps_rebind_fixture_func(
fixture, request.instance, fixturedef.unittest
)
event_loop = kwargs.pop(event_loop_fixture_id)
async def setup():
res = await func(
**_add_kwargs(func, kwargs, event_loop_fixture_id, event_loop, request)
)
return res
> return event_loop.run_until_complete(setup())
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:359:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:653: in run_until_complete
return future.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:354: in setup
res = await func(
tests/conftest.py:52: in test_user_secrets
return await create_test_users()
src/rasenmaeher_api/testhelpers.py:21: in create_test_users
_anon_user = await Person.create_with_cert(callsign="anon_admin", extra={})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
newperson.certfile.write_text(bundlepem)
await newperson.create_pfx()
except Exception as exc:
LOGGER.exception("Something went wrong, doing cleanup")
shutil.rmtree(certspath)
remaining = list(certspath.rglob("*"))
LOGGER.debug("Remaining files: {}".format(remaining))
> raise BackendError(str(exc)) from exc
E rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)
src/rasenmaeher_api/db/people.py:86: BackendError
Check failure on line 1 in .mypy_cache/3.11/tests/test_enrollment.data.json
github-actions / JUnit report (local)
test_enrollment.test_have_i_been_accepted_yes
failed on setup with "rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)"
Raw output
+ Exception Group Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/db/people.py", line 78, in create_with_cert
| bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/public.py", line 55, in get_bundle
| await refresh_ocsp()
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 45, in refresh_ocsp
| async with asyncio.TaskGroup() as tgr:
| File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/taskgroups.py", line 145, in __aexit__
| raise me from None
| ExceptionGroup: unhandled errors in a TaskGroup (2 sub-exceptions)
+-+---------------- 1 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/refresh raised Server disconnected
+---------------- 2 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 40, in dump_crlfiles
| await post_ocsprest(f"{ocsprest_base()}/api/v1/dump_crl")
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/dump_crl raised Server disconnected
+------------------------------------
The above exception was the direct cause of the following exception:
request = <SubRequest 'test_user_secrets' for <Coroutine test_enroll_verif_code[tilauspalvelu_jwt_admin_client0]>>
kwargs = {'session_env_config': None}
setup = <function _wrap_async_fixture.<locals>._async_fixture_wrapper.<locals>.setup at 0x7fd0cacf0360>
@functools.wraps(fixture)
def _async_fixture_wrapper(request: SubRequest, **kwargs: Any):
func = _perhaps_rebind_fixture_func(
fixture, request.instance, fixturedef.unittest
)
event_loop = kwargs.pop(event_loop_fixture_id)
async def setup():
res = await func(
**_add_kwargs(func, kwargs, event_loop_fixture_id, event_loop, request)
)
return res
> return event_loop.run_until_complete(setup())
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:359:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:653: in run_until_complete
return future.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:354: in setup
res = await func(
tests/conftest.py:52: in test_user_secrets
return await create_test_users()
src/rasenmaeher_api/testhelpers.py:21: in create_test_users
_anon_user = await Person.create_with_cert(callsign="anon_admin", extra={})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
newperson.certfile.write_text(bundlepem)
await newperson.create_pfx()
except Exception as exc:
LOGGER.exception("Something went wrong, doing cleanup")
shutil.rmtree(certspath)
remaining = list(certspath.rglob("*"))
LOGGER.debug("Remaining files: {}".format(remaining))
> raise BackendError(str(exc)) from exc
E rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)
src/rasenmaeher_api/db/people.py:86: BackendError
Check failure on line 1 in .mypy_cache/3.11/tests/test_enrollment.data.json
github-actions / JUnit report (local)
test_enrollment.test_have_i_been_accepted_no
failed on setup with "rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)"
Raw output
+ Exception Group Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/db/people.py", line 78, in create_with_cert
| bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/public.py", line 55, in get_bundle
| await refresh_ocsp()
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 45, in refresh_ocsp
| async with asyncio.TaskGroup() as tgr:
| File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/taskgroups.py", line 145, in __aexit__
| raise me from None
| ExceptionGroup: unhandled errors in a TaskGroup (2 sub-exceptions)
+-+---------------- 1 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/refresh raised Server disconnected
+---------------- 2 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 40, in dump_crlfiles
| await post_ocsprest(f"{ocsprest_base()}/api/v1/dump_crl")
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/dump_crl raised Server disconnected
+------------------------------------
The above exception was the direct cause of the following exception:
request = <SubRequest 'test_user_secrets' for <Coroutine test_enroll_verif_code[tilauspalvelu_jwt_admin_client0]>>
kwargs = {'session_env_config': None}
setup = <function _wrap_async_fixture.<locals>._async_fixture_wrapper.<locals>.setup at 0x7fd0cacf0360>
@functools.wraps(fixture)
def _async_fixture_wrapper(request: SubRequest, **kwargs: Any):
func = _perhaps_rebind_fixture_func(
fixture, request.instance, fixturedef.unittest
)
event_loop = kwargs.pop(event_loop_fixture_id)
async def setup():
res = await func(
**_add_kwargs(func, kwargs, event_loop_fixture_id, event_loop, request)
)
return res
> return event_loop.run_until_complete(setup())
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:359:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:653: in run_until_complete
return future.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:354: in setup
res = await func(
tests/conftest.py:52: in test_user_secrets
return await create_test_users()
src/rasenmaeher_api/testhelpers.py:21: in create_test_users
_anon_user = await Person.create_with_cert(callsign="anon_admin", extra={})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
newperson.certfile.write_text(bundlepem)
await newperson.create_pfx()
except Exception as exc:
LOGGER.exception("Something went wrong, doing cleanup")
shutil.rmtree(certspath)
remaining = list(certspath.rglob("*"))
LOGGER.debug("Remaining files: {}".format(remaining))
> raise BackendError(str(exc)) from exc
E rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)
src/rasenmaeher_api/db/people.py:86: BackendError
Check failure on line 1 in .mypy_cache/3.11/tests/test_enrollment.data.json
github-actions / JUnit report (local)
test_enrollment.test_status_koira
failed on setup with "rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)"
Raw output
+ Exception Group Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/db/people.py", line 78, in create_with_cert
| bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/public.py", line 55, in get_bundle
| await refresh_ocsp()
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 45, in refresh_ocsp
| async with asyncio.TaskGroup() as tgr:
| File "/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/taskgroups.py", line 145, in __aexit__
| raise me from None
| ExceptionGroup: unhandled errors in a TaskGroup (2 sub-exceptions)
+-+---------------- 1 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/refresh raised Server disconnected
+---------------- 2 ----------------
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 29, in post_ocsprest
| async with session.post(url, data=send_payload, timeout=timeout) as response:
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1194, in __aenter__
| self._resp = await self._coro
| ^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 605, in _request
| await resp.start(conn)
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 966, in start
| message, payload = await protocol.read() # type: ignore[union-attr]
| ^^^^^^^^^^^^^^^^^^^^^
| File "/home/runner/.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/aiohttp/streams.py", line 622, in read
| await self._waiter
| aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected
|
| The above exception was the direct cause of the following exception:
|
| Traceback (most recent call last):
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 40, in dump_crlfiles
| await post_ocsprest(f"{ocsprest_base()}/api/v1/dump_crl")
| File "/home/runner/work/python-rasenmaeher-api/python-rasenmaeher-api/src/rasenmaeher_api/cfssl/private.py", line 35, in post_ocsprest
| raise CFSSLError(f"{url} raised {str(exc)}") from exc
| rasenmaeher_api.cfssl.base.CFSSLError: http://127.0.0.1:7776/api/v1/dump_crl raised Server disconnected
+------------------------------------
The above exception was the direct cause of the following exception:
request = <SubRequest 'test_user_secrets' for <Coroutine test_enroll_verif_code[tilauspalvelu_jwt_admin_client0]>>
kwargs = {'session_env_config': None}
setup = <function _wrap_async_fixture.<locals>._async_fixture_wrapper.<locals>.setup at 0x7fd0cacf0360>
@functools.wraps(fixture)
def _async_fixture_wrapper(request: SubRequest, **kwargs: Any):
func = _perhaps_rebind_fixture_func(
fixture, request.instance, fixturedef.unittest
)
event_loop = kwargs.pop(event_loop_fixture_id)
async def setup():
res = await func(
**_add_kwargs(func, kwargs, event_loop_fixture_id, event_loop, request)
)
return res
> return event_loop.run_until_complete(setup())
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:359:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/hostedtoolcache/Python/3.11.7/x64/lib/python3.11/asyncio/base_events.py:653: in run_until_complete
return future.result()
../../../.cache/pypoetry/virtualenvs/rasenmaeher-api-jxRxA5GG-py3.11/lib/python3.11/site-packages/pytest_asyncio/plugin.py:354: in setup
res = await func(
tests/conftest.py:52: in test_user_secrets
return await create_test_users()
src/rasenmaeher_api/testhelpers.py:21: in create_test_users
_anon_user = await Person.create_with_cert(callsign="anon_admin", extra={})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'rasenmaeher_api.db.people.Person'>, callsign = 'anon_admin'
extra = {}
@classmethod
async def create_with_cert(cls, callsign: str, extra: Optional[Dict[str, Any]] = None) -> "Person":
"""Create the cert etc and save the person"""
cnf = RMSettings.singleton()
if callsign in cnf.valid_product_cns:
raise CallsignReserved("Using product CNs as callsigns is forbidden")
try:
await Person.by_callsign(callsign)
raise CallsignReserved()
except NotFound:
pass
async with db.acquire() as conn:
async with conn.transaction(): # do it in a transaction so if something fails we can roll back
puuid = uuid.uuid4()
certspath = Path(cnf.persistent_data_dir) / "private" / "people" / str(puuid)
certspath.mkdir(parents=True)
certspath.chmod(PRIVDIR_MODE)
try:
newperson = Person(pk=puuid, callsign=callsign, certspath=str(certspath), extra=extra)
await newperson.create()
ckp = await async_create_keypair(newperson.privkeyfile, newperson.pubkeyfile)
csrpem = await async_create_client_csr(
ckp, newperson.csrfile, newperson.certsubject, ocsp_uri=cnf.ocscp_responder
)
certpem = (await sign_csr(csrpem)).replace("\\n", "\n")
bundlepem = (await get_bundle(certpem)).replace("\\n", "\n")
newperson.certfile.write_text(bundlepem)
await newperson.create_pfx()
except Exception as exc:
LOGGER.exception("Something went wrong, doing cleanup")
shutil.rmtree(certspath)
remaining = list(certspath.rglob("*"))
LOGGER.debug("Remaining files: {}".format(remaining))
> raise BackendError(str(exc)) from exc
E rasenmaeher_api.db.errors.BackendError: unhandled errors in a TaskGroup (2 sub-exceptions)
src/rasenmaeher_api/db/people.py:86: BackendError