Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[freeboxos] Fix enabling/disabling of Mac OS file sharing #17203

Merged
merged 1 commit into from
Aug 4, 2024

Conversation

lolodomo
Copy link
Contributor

@lolodomo lolodomo commented Aug 3, 2024

Fix #17200

Signed-off-by: Laurent Garnier lg.hc@free.fr

Fix openhab#17200

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
@lolodomo lolodomo added the bug An unexpected problem or unintended behavior of an add-on label Aug 3, 2024
@lolodomo lolodomo requested a review from clinique as a code owner August 3, 2024 11:38
@lolodomo lolodomo added rebuild Triggers Jenkins PR build and removed rebuild Triggers Jenkins PR build labels Aug 3, 2024
@lsiepel
Copy link
Contributor

lsiepel commented Aug 3, 2024

Replace an enum with a string? I would opt to change the configuration parameter to have options in the xml, so the value can be chosen from the UI.

For file based config, I propose to add a check in the initialize method. This check would check if the enum.valueOf(config.parameter.topUpper()) throws an illegal argument exception and set the thing state to configuration_error accordingly.

string is also possible, but with a limited list I would really prefer enum.

@lolodomo
Copy link
Contributor Author

lolodomo commented Aug 3, 2024

This is only an API field that is returned by the API and just provided to the API when changing the config.
I could also remove it but @clinique option was to have a full DTO which makes also sense.

@lolodomo
Copy link
Contributor Author

lolodomo commented Aug 3, 2024

To be clear, we need to keep the raw value returned by the get API to then provide it when calling the set API.

@lolodomo
Copy link
Contributor Author

lolodomo commented Aug 3, 2024

@lsiepel
Copy link
Contributor

lsiepel commented Aug 3, 2024

Based on the text in the linked issue I thought it was the openHAB config. Nevertheless still prefer proper enum conversion, no magic strings in the code, but it ie much less important and certainly not blocking.

LGTM

@lolodomo
Copy link
Contributor Author

lolodomo commented Aug 3, 2024

API filed is a string.

@clinique
Copy link
Contributor

clinique commented Aug 3, 2024

Still I don't understand the purpose of removing the enum.

@lolodomo
Copy link
Contributor Author

lolodomo commented Aug 3, 2024

Still I don't understand the purpose of removing the enum.

The get API returns value "airport" in lowercase for the field server_type.
When using the set API, you have to use "airport" also. If the field is set with "AIRPORT", the API simply fails.
Due to the conversion to an enum, string "airport" is first converted to enum value AIRPORT when handling the get API response. When reused and serialized in the PUT request, the server_type field was set with "AIRPORT" and the API failed.

@clinique : is it clearer now ?

Edit: look at what you did in setStatus method.

@lsiepel lsiepel merged commit a2f54ca into openhab:main Aug 4, 2024
5 checks passed
@lsiepel lsiepel added this to the 4.3 milestone Aug 4, 2024
@lolodomo lolodomo deleted the freeboxos_fix_macosshare branch August 4, 2024 07:24
lolodomo added a commit to lolodomo/openhab-addons that referenced this pull request Aug 8, 2024
@lolodomo lolodomo added the patch A PR that has been cherry-picked to a patch release branch label Aug 8, 2024
lolodomo added a commit to lolodomo/openhab-addons that referenced this pull request Aug 18, 2024
Partial revert of openhab#17203

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
jlaur pushed a commit that referenced this pull request Aug 18, 2024
…ng) (#17284)

Partial revert of #17203

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
digitaldan pushed a commit to digitaldan/openhab-addons that referenced this pull request Aug 29, 2024
digitaldan pushed a commit to digitaldan/openhab-addons that referenced this pull request Aug 29, 2024
…ng) (openhab#17284)

Partial revert of openhab#17203

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
pgfeller pushed a commit to pgfeller/openhab-addons that referenced this pull request Sep 29, 2024
)

Fix openhab#17200

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Signed-off-by: Patrik Gfeller <patrik.gfeller@proton.me>
pgfeller pushed a commit to pgfeller/openhab-addons that referenced this pull request Sep 29, 2024
…ng) (openhab#17284)

Partial revert of openhab#17203

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Signed-off-by: Patrik Gfeller <patrik.gfeller@proton.me>
joni1993 pushed a commit to joni1993/openhab-addons that referenced this pull request Oct 15, 2024
joni1993 pushed a commit to joni1993/openhab-addons that referenced this pull request Oct 15, 2024
…ng) (openhab#17284)

Partial revert of openhab#17203

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
matchews pushed a commit to matchews/openhab-addons that referenced this pull request Oct 18, 2024
matchews pushed a commit to matchews/openhab-addons that referenced this pull request Oct 18, 2024
…ng) (openhab#17284)

Partial revert of openhab#17203

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of an add-on patch A PR that has been cherry-picked to a patch release branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[freeboxos] Mac OS file sharing enabling/disabling is failing
3 participants