-
Notifications
You must be signed in to change notification settings - Fork 881
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(snap): avoid refresh on package_upgrade: true and refresh.hold (#…
…5426) When snap refresh.hold is set to forever, an admin is saying they do not want generic automated refreshes of snaps performed by default. This should be an indicator to cloud-init to avoid calling snap refresh on such systems due to a `package_upgrade: true` present in user-data. For network-limited environments with images which have the snap package manager but don't want to wait and timeout on snap refresh, the following user-data can be provided to still allow for package_upgrade: true, and avoid a 20-30 second wait on snaps being unable to access certain snap URLs. #cloud-config package_upgrade: true snap: commands: 00: snap refresh --hold=forever cloud-init now interrogates the state refresh.hold value by calling snap get system -d If snap refresh --hold was called in that environment to set 'forever', cloud-init will skip calling refresh and log the reason for skipping. We cannot honor short time-based refresh.holds because the snap services place a short hold in early boot anyway as systemd units startup. Fixes: GH-5290
- Loading branch information
1 parent
acf04d6
commit 0787d62
Showing
6 changed files
with
150 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 7 additions & 4 deletions
11
doc/module-docs/cc_package_update_upgrade_install/data.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
7 changes: 7 additions & 0 deletions
7
doc/module-docs/cc_package_update_upgrade_install/example2.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#cloud-config | ||
package_update: true | ||
package_upgrade: true | ||
snap: | ||
commands: | ||
00: snap refresh --hold=forever | ||
package_reboot_if_required: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters