-
Notifications
You must be signed in to change notification settings - Fork 884
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
fix: Fix breaking changes in package install #5069
Changes from 3 commits
1f7b3c0
6cd3978
d06bc9d
bdd8e03
ea179a2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -239,36 +239,46 @@ def install_packages(self, pkglist: PackageList): | |
|
||
# First install packages using package manager(s) | ||
# supported by the distro | ||
uninstalled = [] | ||
total_failed: Set[str] = set() | ||
for manager in self.package_managers: | ||
to_try = ( | ||
packages_by_manager.get(manager.__class__, set()) | ||
| generic_packages | ||
|
||
manager_packages = packages_by_manager.get( | ||
manager.__class__, set() | ||
) | ||
|
||
to_try = manager_packages | generic_packages | ||
total_failed.difference_update(to_try) | ||
TheRealFalcon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if not manager.available(): | ||
LOG.debug("Package manager '%s' not available", manager.name) | ||
total_failed.update(to_try) | ||
continue | ||
if not to_try: | ||
continue | ||
uninstalled = manager.install_packages(to_try) | ||
failed = { | ||
pkg for pkg in uninstalled if pkg not in generic_packages | ||
failed = manager.install_packages(to_try) | ||
total_failed.update(failed) | ||
unexpected_failed = { | ||
pkg for pkg in failed if pkg not in generic_packages | ||
} | ||
if failed: | ||
if unexpected_failed: | ||
LOG.info(error_message, failed) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we be logging the unexpected_failed here instead of failed now? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmmm, originally we were logging (at info) all failed packages. I think I want to keep it that way (still requiring a change here) so it shows something didn't install here but may be installed in the future. Let me know if you disagree. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. WFM. |
||
generic_packages = set(uninstalled) | ||
# Ensure we don't attempt to install packages specific to | ||
# one particular package manager using another package manager | ||
generic_packages = set(failed) - manager_packages | ||
|
||
# Now attempt any specified package managers not explicitly supported | ||
# by distro | ||
for manager_type, packages in packages_by_manager.items(): | ||
if manager_type.name in [p.name for p in self.package_managers]: | ||
# We already installed/attempted these; don't try again | ||
continue | ||
uninstalled.extend( | ||
total_failed.update( | ||
manager_type.from_config( | ||
self._runner, self._cfg | ||
).install_packages(pkglist=packages) | ||
) | ||
|
||
if uninstalled: | ||
raise PackageInstallerError(error_message % uninstalled) | ||
if total_failed: | ||
raise PackageInstallerError(error_message % total_failed) | ||
|
||
@property | ||
def dhcp_client(self) -> dhcp.DhcpClient: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not strictly needed, but I made this slightly more passive since the old phrasing sounds like ALL packages failed, whereas that may not always be the case.