Repository navigation
Conversation
The generated preparation script kept going after a failed package, Juju or LXD installation and could still exit 0, so the failure only showed up later in sunbeam commands. Exit with the failing install command's status instead. Partial-Bug: #2068935 Signed-off-by: Seyeong Kim <seyeong.kim@canonical.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The generated preparation script kept going when a package, Juju or LXD install failed, and it could still exit 0. The failure only showed up later in
sunbeam cluster join, as in the bug report. I made each of those three installs exit with its own status.I didn't add
set -eto the whole script as the bug suggests. Several lines rely on a failing command on purpose (thegrep ... || {...}checks,juju show-controllerfollowed by$?), so that would change a lot more behaviour.Partial-bug: #2068935
QA steps
From
sunbeam-python/:tox -e unit,pep8,mypy: 4,745 unit tests passed, pep8 and mypy passed.tests/unit/sunbeam/commands/test_prepare_node.pyruns each template in bash with a stubbedsudo. An install that returns 42 must make the script exit 42 before the next step, and status 0 must continue. On the base commit the three failure cases fail withassert 0 == 42.I also ran the rendered templates on a fresh Ubuntu 24.04 VM, as the
ubuntuuser. I renderedPREPARE_NODE_TEMPLATE,COMMON_TEMPLATEandBOOTSTRAP_TEMPLATEfrom this branch (new) and from main (old) into files, and ran each one up to a marker line with this helper:Re-runs with everything already installed still pass:
5.21/stable./cut.sh new_bootstrap.sh "# Bootstrap juju onto LXD"sudo snap install lxd --channel 5.21/stablealone prints "already installed" and returns 0)latest/stablelatest/stable3.6/stableinstalled./cut.sh new_common.sh "# Workaround a bug between snapd and juju"./cut.sh new_prepare.sh '# Add $USER to the snap_daemon group'Install failures now stop the script:
http://127.0.0.1:9(./cut.sh <v>_bootstrap.sh "if [ -n")cannot install "lxd"./cut.sh <v>_common.sh "# Workaround a bug between snapd and juju")cannot install "juju"http://127.0.0.1:9(./cut.sh <v>_prepare.sh '# Add $USER to the snap_daemon group')Failed to fetch ... curlLinks
Jira card: N/A