Repository navigation
Conversation
Contributor
|
@kayaal34 3006.x has entered security only. Please rebase these changes on 3008.x |
The passphrase error in rpmbuild_pkgbuild._get_gpg_key_resources and the
'host not found' message in vsphere.add_host_to_dvs used '{1}' with a single
format argument, so building the message raised IndexError and hid the
real error.
kayaal34
force-pushed
the
fix-format-placeholders
branch
from
October 23, 2026 09:38
8a4a2ff to
73cd3ba
Compare
Author
|
Thanks, rebased onto 3008.x and retargeted the PR. On 3008.x the new test lives in the existing |
This branch has not been deployed
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.
What does this PR do?
Two error messages use the format placeholder
{1}with a single.format()argument, so building the message raisesIndexError: Replacement index 1 out of rangeand the real error is lost:rpmbuild_pkgbuild._get_gpg_key_resources: whengpg-preset-passphrasefails, the user gets anIndexErrorinstead ofSaltInvocationError: Failed to preset passphrase, error <rc>, ....vsphere.add_host_to_dvs: when a host isn't found, the function crashes instead of returning"Host <name> not found"for that host.Both now use
{}. Targeting 3008.x (3006.x is security-only now); the same lines are also in 3007.x and master.What issues does this PR fix or reference?
No issue; found with a static check (ruff F523/F524).
Previous Behavior
IndexError: Replacement index 1 out of range for positional args tupleNew Behavior
SaltInvocationError: Failed to preset passphrase, error 2, check logs for further details/Host esx1 not foundMerge requirements satisfied?
tests/pytests/unit/modules/test_rpmbuild_pkgbuild.pymocks a failinggpg-preset-passphrase(cmd.retcodereturns 2) and expects theSaltInvocationError; it fails on 3008.x with theIndexErrorand passes with the fix (run on Linux, Python 3.12). I didn't add a test for thevsphereline: exercisingadd_host_to_dvsneeds pyVmomi object mocks, and the change there is the same one-character fix.Commits signed with GPG?
No
Note: I used Claude (an AI assistant) to help find and fix this; I reviewed the change and ran the test as described.