Bug 50974 - not possible to deactivate default options with current API
not possible to deactivate default options with current API
Status: VERIFIED FIXED
Product: Components
Classification: Unclassified
Component: udm-rest-api-client
unspecified
Other Linux
: P5 normal (vote)
: ---
Assigned To: Daniel Tröder
Ole Schwiegert
:
Depends on: 52723
Blocks: 52659 52727
  Show dependency treegraph
 
Reported: 2020-03-18 13:31 CET by Daniel Tröder
Modified: 2021-02-17 10:08 CET (History)
3 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 4: Minor Usability: Impairs usability in secondary scenarios
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Tröder univentionstaff 2020-03-18 13:31:35 CET
Removing an entry of the "options" list of an object will not deactivate the option in UCS, if it is "on" by default.

The shares/share option "nfs" is on by default. If an object is created with:

------------------------------------------------------------------
async with UDM(**udm_kwargs) as udm:
    mod = udm.get("shares/share")
    obj = await mod.new()
    obj.options = ["samba"]
    obj.props.name = "foo"
    obj.props.host = "file.example.com"
    obj.props.path = f"/home/shares/foo"
    await obj.save()
------------------------------------------------------------------

obj will then have: obj.options = ["samba", "nfs"]

The UDM REST API expects an object: {"samba": true, "nfs": false}
When only {"samba": true} is submitted, "nfs" will always be activated.
Comment 1 Daniel Tröder univentionstaff 2021-01-30 01:57:40 CET
Fixed with:

[master] cbb26c1 Bug #50974: API change: 'options' is dict now

This is a *breaking* API change: the UDM objects 'options' attribute is now a dict. It was a list before.

All checks passed, documentation is published:
* https://travis-ci.com/univention/python-udm-rest-api-client/
* https://codecov.io/gh/univention/python-udm-rest-api-client/
* https://readthedocs.org/projects/udm-rest-client/builds/
Comment 3 Ole Schwiegert univentionstaff 2021-02-03 08:33:16 CET
Installled udm rest client locally on my machine for testing. Openapi update ran against singleserver with default school installation.

Options are correctly parsed: OK
Options are now dicts: OK
changing options and disabling default options works: OK
Tests,CodeCov: OK
PyPI: OK

Docs: REOPEN

Currently the only way to see that a breaking change was introduced in 0.5.0 is to check the history. Though this was only a minor version change and thus breaking changes are not to be expected. I would wish for some kind of documentation for the options in the actual doc (outside history) and maybe we should think about releasing v 1.0 at some point as the software is afaik in productive use.
Comment 4 Daniel Tröder univentionstaff 2021-02-03 11:28:20 CET
I added a section on options with a visible notice about the API change: https://udm-rest-client.readthedocs.io/en/latest/usage.html#options

The version was raised to 1.0.0 and packages published to PyPI.
The Github actions are now fixed as well: https://github.com/univention/python-udm-rest-api-client/actions
Comment 5 Daniel Tröder univentionstaff 2021-02-10 18:15:17 CET
OpenAPI generator 5.0.0 is now used and the JAR checksum is checked:

[master 98e8caa] Bug #50974: version 1.0.1, update openapi-generator to 5.0.0, verify checksum
Comment 6 Daniel Tröder univentionstaff 2021-02-11 11:03:15 CET
Version 1.0.1 is now used by the Kelvin API version 1.3.0.
Comment 7 Ole Schwiegert univentionstaff 2021-02-17 10:08:14 CET
Updated version is installed in Kelvin and works. Documentation, automated tests and CI works like a charm