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

Add update integration #66552

Merged
merged 43 commits into from
Mar 3, 2022
Merged

Add update integration #66552

merged 43 commits into from
Mar 3, 2022

Conversation

ludeeus
Copy link
Member

@ludeeus ludeeus commented Feb 15, 2022

Breaking change

Proposed change

This adds a new update integration that allows other integrations to provide an updater platform to present and perform updates.
Similar to what we have for updates for supervisor (the hassio integration will migrate to this as well).

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

To help with the load of incoming pull requests:

@probot-home-assistant
Copy link

Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration (updater) you are listed as a code owner for? Thanks!
(message by CodeOwnersMention)

@ludeeus ludeeus marked this pull request as ready for review February 17, 2022 14:25
@ludeeus ludeeus requested a review from a team as a code owner February 17, 2022 14:25
Copy link
Member

@frenck frenck left a comment

Choose a reason for hiding this comment

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

I really dig this idea! Awesome!

However, I do think repurposing updater is causing it to have a weird name for a platform. I feel like the update platform is more consistent with our naming in general.

In the current schema of things, I would personally vote for removing the updater platform (as the use is gone), and introducing the update platform.

@ludeeus
Copy link
Member Author

ludeeus commented Feb 17, 2022

I'm fine with both

@ludeeus ludeeus changed the title Repurpose the Updater integration Add update integration Feb 17, 2022
)
return

manager.skip_update(msg["domain"], msg["identifier"], msg["version"])
Copy link
Member

Choose a reason for hiding this comment

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

What if identifier or version is no longer valid ? We only validate domain. Would it help to drop domain_is_valid and just raise some exception if something is off?

Copy link
Member Author

Choose a reason for hiding this comment

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

Since we do not store updates anymore, that would mean that on each call info/update/skip we would need to gather all updates, then iterate over all updates for the domain to ensure the identifier and version are present.
That's expensive, and this I would say is a rare edge case, and if needed is something that the individual update platforms should handle, they get the identifier and version, and can raise or just return early if the update no longer exists.

ludeeus and others added 2 commits March 3, 2022 15:14
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
@balloob balloob merged commit 1a78e18 into dev Mar 3, 2022
@balloob balloob deleted the repurpose_updater branch March 3, 2022 16:27
domain: str,
identifier: str,
version: str,
**kwargs: Any,
Copy link
Member

Choose a reason for hiding this comment

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

When will the arbitrary keyword arguments be used?

Copy link
Member Author

Choose a reason for hiding this comment

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

for backup and whatever we decide to add in the future.

ludeeus added a commit that referenced this pull request Mar 4, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Mar 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants