NethServer / dev

NethServer issue tracker
https://github.com/NethServer/dev/issues
63 stars 20 forks source link

nethsecurity-controller: invalid `config.env` after "Save" on cluster interface #6952

Closed edospadoni closed 1 week ago

edospadoni commented 1 week ago

Steps to reproduce

Expected behavior

Actual behavior

Components

ns8-nethsecurity-controller:0.0.21

edospadoni commented 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.

stephdl commented 1 week ago

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'
stephdl commented 1 week ago

QA

install ghcr.io/nethserver/nethsecurity-controller:0.0.22-dev.2

no expected errors when you configure the module several times

edospadoni commented 1 week ago

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.

stephdl commented 1 week ago

released as ghcr.io/nethserver/nethsecurity-controller:0.0.22