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

fix(cc_apt_configure): avoid unneeded call to apt-install #4519

Merged
merged 2 commits into from
Oct 17, 2023

Conversation

aciba90
Copy link
Contributor

@aciba90 aciba90 commented Oct 17, 2023

Proposed Commit Message

If no apt-sources config is given, then no apt dependencies are required to be installed.
This avoids unneeded calls to apt-update and apt-install.

The problem was introduced in 015543d304.

Additional Context

#4441

Test Steps

lxc launch ubuntu-daily:devel mm
lxc shell mm

# without this patch the following happens while cc_apt_configure runs, and no package is installed:
$ grep -E 'apt-update|apt-install' /var/log/cloud-init.log
2023-10-17 14:50:41,775 - util.py[DEBUG]: apt-update [eatmydata apt-get --option=Dpkg::Options::=--force-confold --option=Dpkg::options::=--force-unsafe-io --assume-yes --quiet update] took 8.957 seconds
2023-10-17 14:50:42,142 - util.py[DEBUG]: apt-install [eatmydata apt-get --option=Dpkg::Options::=--force-confold --option=Dpkg::options::=--force-unsafe-io --assume-yes --quiet install] took 0.366 seconds

# with this patch no output expected

Checklist:

  • My code follows the process laid out in the documentation
  • I have updated or added any unit tests accordingly
  • I have updated or added any documentation accordingly

If no apt-sources config is given and no apt depencies are required to
be installed, the avoid unneeded calls to apt-update and apt-install.

The problem was introduced in 015543d.
Copy link
Collaborator

@blackboxsw blackboxsw left a comment

Choose a reason for hiding this comment

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

Fix is good. I've added supplemental unittests for various configs which can be provided to _ensure_dependencies. When this passes we can merge this and reflect to release branches

@blackboxsw blackboxsw marked this pull request as ready for review October 17, 2023 17:37
@blackboxsw blackboxsw merged commit 2ab1f34 into canonical:main Oct 17, 2023
26 checks passed
@aciba90 aciba90 deleted the fix-apt-configure branch October 18, 2023 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants