NAS-139830 / 26.0.0-BETA.1 / Refactor auth.login_ex (#18223)
This commit shifts the auth.login_ex method so that it calls into
various helper methods in auth_/login_ex_imply.py. The helper methods
allow easier separation of sync vs async methods and consistent typing
for responses and arguments.
Various typing fixes are also applied.
A new auth.login_ex response `DENIED` is generated if user successfully
authenticates but has no API access.
NAS-139837 / 26.0.0-BETA.1 / Change import behavior for atomic_write (#18226)
This commit adjusts when we try to import atomic_write so that it occurs
once we've rewritten the python path.
```
root at truenas[~]# cat /var/log/truenas-installer-initrd-error.log
======================================================================
Timestamp: 2026-02-16T21:25:46.469672
truenas-initrd.py completed with exit code 1
Error output:
Traceback (most recent call last):
File "/tmp/tmpwl6etqoq/usr/local/bin/truenas-initrd.py", line 14, in <module>
from middlewared.utils.io import atomic_write
ImportError: cannot import name 'atomic_write' from 'middlewared.utils.io' (/usr/lib/python3/dist-packages/middlewared/utils/io.py)
======================================================================
```
NAS-139836 / 26.0.0-BETA.1 / remove fork+exec in etc_files/systemd.py (#18225)
I just recently pushed a fix here and noticed that we're forking and
exec'ing in the main event loop at least once but sometimes twice or
more depending on the services state. That's not good, let's use async
native coroutines to remove all fork+exec logic as well as the hack that
we added to ignore the sysv order.
Add two new coroutines in services_/base.py that allow querying a
systemd unit's state as well as allows a unit to be enabled/disabled.
NAS-139835 / 26.0.0-BETA.1 / fix KeyError crash in etc/systemd.py (#18224)
`is-enabled` verb to the `systemctl` can return all kinds of responses
and not just `enabled` or `disabled`. Prevent a KeyError crash from
occurring and instead log it as a warning.
Refactor auth.login_ex
This commit shifts the auth.login_ex method so that it calls into
various helper methods in auth_/login_ex_imply.py. The helper
methods allow easier separation of sync vs async methods and
consistent typing for responses and arguments.
Various typing fixes are also applied.
A new auth.login_ex response `DENIED` is generated if user
successfully authenticates but has no API access.