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

Improve marketplace add-on handling #4019

Merged
merged 1 commit into from
Jan 14, 2024
Merged

Improve marketplace add-on handling #4019

merged 1 commit into from
Jan 14, 2024

Conversation

J-N-K
Copy link
Member

@J-N-K J-N-K commented Jan 5, 2024

It has been reported several times that add-ons were not properly installed / missing after an upgrade or the installation of incompatible add-ons resulted in broken installations.

After an upgrade (or clean cache) the AddonHandlers try to re-install the add-ons from the download cache (<userdata>/marketplace). This happens without checking compatibility. This was needed before OH4, because the cache was the only source providing information about installed add-ons. This is now different, since we store the add-on information in a JSON database, so the UIDs of the add-ons are known.

This PR changes improves the add-on services. It now

  1. Reads the information about the installed add-ons from the database and sets the installation status based on information from the handlers.
  2. Removes all add-ons that are not installed from the JSON database and remembers their UIDs.
  3. Refreshes the remote add-on list (including check for compatibility if not disabled).
  4. Tries installation of the add-ons remembered in step 2. Since incompatible add-ons are missing in the add-on list, their installation fails and a warning is logged.

This PR is has two corresponding PR in openhab-distro and openhab-linuxpkg to ensure that the upgrade script and openhab-cli also clear the marketplace cache.

It has been reported several times that add-ons were not properly installed / missing after an upgrade or the installation of incompatible add-ons resulted in broken installations.

After an upgrade (or clean cache) the `AddonHandler`s try to re-install the add-ons from the download cache (`<userdata>/marketplace`). This happens without checking compatibility. This was needed before OH4, because the cache was the only source providing information about installed add-ons. This is now different, since we store the add-on information in a JSON database, so the UIDs of the add-ons are known.

This PR changes improves the add-on services. It now

1. Reads the information about the installed add-ons from the database and sets the installation status based on information from the handlers.
2. Removes all add-ons that are not installed from the JSON database and remembers their UIDs.
3. Refreshes the remote add-on list (including check for compatibility if not disabled).
4. Tries installation of the add-ons remembered in step 2. Since incompatible add-ons are missing in the add-on list, their installation fails and a warning is logged.

This PR is has two corresponding PR in openhab-distro and openhab-linuxpkg to ensure that the upgrade script and `openhab-cli` also clear the marketplace cache.

Signed-off-by: Jan N. Klug <github@klug.nrw>
Copy link
Member

@wborn wborn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! This certainly helps preventing incompatiblity issues resulting from outdated Marketplace add-ons. 👍

@wborn wborn merged commit 5cea59b into openhab:main Jan 14, 2024
3 checks passed
@wborn wborn added this to the 4.2 milestone Jan 14, 2024
@wborn wborn added the enhancement An enhancement or new feature of the Core label Jan 14, 2024
@J-N-K J-N-K deleted the marketplace branch January 14, 2024 20:51
wborn added a commit to wborn/openhab-docker that referenced this pull request Jan 14, 2024
Related to openhab/openhab-core#4019

Signed-off-by: Wouter Born <github@maindrain.net>
wborn added a commit to openhab/openhab-docker that referenced this pull request Jan 14, 2024
Related to openhab/openhab-core#4019

Signed-off-by: Wouter Born <github@maindrain.net>
cipianpascu pushed a commit to cipianpascu/openhab-core that referenced this pull request Jan 17, 2024
It has been reported several times that add-ons were not properly installed / missing after an upgrade or the installation of incompatible add-ons resulted in broken installations.

After an upgrade (or clean cache) the `AddonHandler`s try to re-install the add-ons from the download cache (`<userdata>/marketplace`). This happens without checking compatibility. This was needed before OH4, because the cache was the only source providing information about installed add-ons. This is now different, since we store the add-on information in a JSON database, so the UIDs of the add-ons are known.

This PR changes improves the add-on services. It now

1. Reads the information about the installed add-ons from the database and sets the installation status based on information from the handlers.
2. Removes all add-ons that are not installed from the JSON database and remembers their UIDs.
3. Refreshes the remote add-on list (including check for compatibility if not disabled).
4. Tries installation of the add-ons remembered in step 2. Since incompatible add-ons are missing in the add-on list, their installation fails and a warning is logged.

This PR is has two corresponding PR in openhab-distro and openhab-linuxpkg to ensure that the upgrade script and `openhab-cli` also clear the marketplace cache.

Signed-off-by: Jan N. Klug <github@klug.nrw>
Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement or new feature of the Core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants