-
Notifications
You must be signed in to change notification settings - Fork 583
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
daemon: hide old experimental flags (#14455)
There is window between moving an experimental flag out of experimental and possibly having a snapd revert to a version where the experimental flag was used. To avoid breaking devices that depend on those flags, instead of removing them completely from state, let's hide them instead. Also, Avoid pruning exact queries for experimental features just in case there are snaps out there that gate some behaviour behind a flag check (if so, it probably gets that specific config path and not all). Signed-off-by: Zeyad Gouda <[email protected]>
- Loading branch information
1 parent
f890545
commit 55306fc
Showing
6 changed files
with
181 additions
and
7 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
summary: Ensure that old experimental flag configs are hidden | ||
|
||
details: | | ||
Check that experimental flag configs that used to exist but now | ||
are out of experimental are hidden unless specifically referenced | ||
and their values will be retained to ensure it works as before in | ||
case of revert to previous snapd version. | ||
prepare: | | ||
snap install --devmode jq | ||
restore: | | ||
snap remove jq | ||
execute: | | ||
echo "Check that users cannot set unsupported experimental features" | ||
snap set core experimental.old-flag=true 2>&1 | MATCH "unsupported system option" | ||
snap get core experimental.old-flag | NOMATCH "true" | ||
# Stop snapd while editing state.json manually | ||
systemctl stop snapd.service snapd.socket | ||
echo "Force setting the unsupported experimental.old-flag" | ||
# This simulates the situation where an experimental feature got out | ||
# of experimental after a snapd refresh and now is an unsupported config | ||
jq '.data.config.core.experimental += {"old-flag": true}' /var/lib/snapd/state.json > state.json | ||
mv state.json /var/lib/snapd/state.json | ||
echo "Check that experimental.old-flag is persisted in state.json" | ||
jq '.data.config.core.experimental."old-flag"' /var/lib/snapd/state.json | MATCH "true" | ||
systemctl start snapd.service snapd.socket | ||
echo "Old experimental flags are hidden in generic queries" | ||
snap get core experimental | NOMATCH "old-flag" | ||
echo "But not removed for exact queries" | ||
snap get core experimental.old-flag | MATCH "true" | ||
echo "Also, old flag is not removed from state in case of a revert" | ||
jq '.data.config.core.experimental."old-flag"' /var/lib/snapd/state.json | MATCH "true" |