-
Notifications
You must be signed in to change notification settings - Fork 881
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
feat(snap): avoid refresh on package_upgrade: true and refresh.hold #5426
Changes from all commits
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 |
---|---|---|
@@ -1,13 +1,16 @@ | ||
cc_package_update_upgrade_install: | ||
description: | | ||
This module allows packages to be updated, upgraded or installed during | ||
boot. If any packages are to be installed or an upgrade is to be performed | ||
then the package cache will be updated first. If a package installation or | ||
upgrade requires a reboot, then a reboot can be performed if | ||
``package_reboot_if_required`` is specified. | ||
boot using any available package manager present on a system such as apt, | ||
pkg, snap, yum or zypper. If any packages are to be installed or an upgrade | ||
is to be performed then the package cache will be updated first. If a | ||
package installation or upgrade requires a reboot, then a reboot can be | ||
performed if ``package_reboot_if_required`` is specified. | ||
examples: | ||
- comment: | | ||
Example 1: | ||
file: cc_package_update_upgrade_install/example1.yaml | ||
- comment: "By default, ``package_upgrade: true`` performs upgrades on any installed package manager. To avoid calling ``snap refresh`` in images with snap installed, set snap refresh.hold to ``forever`` will prevent cloud-init's snap interaction during any boot" | ||
file: cc_package_update_upgrade_install/example2.yaml | ||
name: Package Update Upgrade Install | ||
title: Update, upgrade, and install packages |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#cloud-config | ||
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. Nit: It seems a bit odd to have 2 of our 3 examples dedicated to a workaround for a single package manager on a single OS. I don't think we really need an example showing how to unhold it. 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. sounds good to me. I'll drop that example. of needed it is a corner case for sure. |
||
package_update: true | ||
package_upgrade: true | ||
snap: | ||
commands: | ||
00: snap refresh --hold=forever | ||
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. since this is a workaround, we should include a comment explaining why someone might want this 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. We do include that comment in data.yaml for example2 which is rendered above the example in the modules documentation |
||
package_reboot_if_required: true |
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.
If I start a new lxd container, I see a refresh hold immediately upon starting the container. I think a refresh hold exists regardless if the user has specified one and just points to the next time snap will refresh.
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.
Hrm, yes you are correct. Just saw this on jammy and oracular images. Ok, we can't approach this feature from this angle. If someone wants temporary snap hold during boot, They can add a runcmd: snap refresh --unhold to user-data. I'll update docs and avoid the time-based hold since it looks to be set during boot anyway that ties directly to the
Jul 10 22:33:58.917075 test-j systemd[1]: Started Snap Daemon.
getting started in journalctl.