samba: test issue, not permitted to use sudo -C option
I recently upgraded this development system to bookworm. I was attempting to run the functional tests, but I noticed this error from test_views.py:
plinth/modules/samba/tests/test_functional.py ....... [ 58%]
plinth/modules/samba/tests/test_views.py .F... [100%]
================================================ FAILURES ================================================
______________________________________ test_enable_samba_share_view ______________________________________
rf = <django.test.client.RequestFactory object at 0x7f902737a150>
@pytest.mark.skipif(not setfacl_path.exists(), reason='setfacl not installed')
def test_enable_samba_share_view(rf):
"""Test that enabling share sends correct success message."""
form_data = {'filesystem_type': 'ext4', 'open_share': 'enable'}
mount_point = urllib.parse.quote('/')
response, messages = make_request(rf.post('', data=form_data), views.share,
mount_point=mount_point)
> assert list(messages)[0].message == 'Share enabled.'
E AssertionError: assert 'Error enabli...xit status 1.' == 'Share enabled.'
E - Share enabled.
E + Error enabling share: Command '['sudo', '--non-interactive', '--close-from', '16', '/usr/share/plinth/actions/actions', 'samba', 'add_share', '--write-fd', '15']' returned non-zero exit status 1.
plinth/modules/samba/tests/test_views.py:125: AssertionError
------------------------------------------- Captured log call --------------------------------------------
ERROR plinth.actions:actions.py:130 Error executing command - ['sudo', '--non-interactive', '--close-from', '16', '/usr/share/plinth/actions/actions', 'samba', 'add_share', '--write-fd', '15'], b'', b'sudo: you are not permitted to use the -C option\n'
ERROR plinth.modules.samba.views:views.py:105 Error enabling share
Traceback (most recent call last):
File "/home/james/salsa/freedombox-team/freedombox/plinth/modules/samba/views.py", line 102, in share
samba.add_share(mount_point, share_type, filesystem)
File "/home/james/salsa/freedombox-team/freedombox/plinth/modules/samba/__init__.py", line 123, in add_share
privileged.add_share(mount_point, share_type, windows_filesystem)
File "/home/james/salsa/freedombox-team/freedombox/plinth/actions.py", line 57, in wrapper
return _run_privileged_method_as_process(module_name, action_name,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/james/salsa/freedombox-team/freedombox/plinth/actions.py", line 116, in _run_privileged_method_as_process
return _wait_for_return(*wait_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/james/salsa/freedombox-team/freedombox/plinth/actions.py", line 132, in _wait_for_return
raise subprocess.CalledProcessError(proc.returncode, command)
subprocess.CalledProcessError: Command '['sudo', '--non-interactive', '--close-from', '16', '/usr/share/plinth/actions/actions', 'samba', 'add_share', '--write-fd', '15']' returned non-zero exit status 1.