Closed edospadoni closed 1 week ago
It seems like this action: https://github.com/NethServer/ns8-nethsecurity-controller/blob/main/imageroot/actions/configure-module/20configure#L109 always accepts api_password
field from the UI request.
If the field does not exists in the request, the action leads to unexpected behavior and does not correctly create the config.env
file.
On the second "Save", the field api_password
is missing in the request.
evidence
Jun 18 15:28:15 R3.rocky9-3.org agent@nethsecurity-controller1[1745]: Traceback (most recent call last):
Jun 18 15:28:15 R3.rocky9-3.org agent@nethsecurity-controller1[1745]: File "/home/nethsecurity-controller1/.config/actions/configure-module/20configure", line 109, in <module>
Jun 18 15:28:15 R3.rocky9-3.org agent@nethsecurity-controller1[1745]: env.write(f'ADMIN_PASSWORD={request["api_password"]}\n')
Jun 18 15:28:15 R3.rocky9-3.org agent@nethsecurity-controller1[1745]: ~~~~~~~^^^^^^^^^^^^^^^^
Jun 18 15:28:15 R3.rocky9-3.org agent@nethsecurity-controller1[1745]: KeyError: 'api_password'
QA
install ghcr.io/nethserver/nethsecurity-controller:0.0.22-dev.2
no expected errors when you configure the module several times
Verified. With ghcr.io/nethserver/nethsecurity-controller:0.0.22-dev.2
no errors occurs after multiple saves. The config.env
file is always valid.
released as ghcr.io/nethserver/nethsecurity-controller:0.0.22
Steps to reproduce
config.env
is valid, under/home/nethsecurity-controller<MODULE_ID>/.config/state/config.env
Expected behavior
config.env
under/home/nethsecurity-controller<MODULE_ID>/.config/state/config.env
should be valid like the first configurationActual behavior
config.env
is corrupted. onlyADMIN_USER
env is set and the others variables is missingComponents
ns8-nethsecurity-controller:0.0.21