[gnoi] SetPackage: use absolute path for sonic-installer#691
Open
v-cshekar wants to merge 1 commit into
Open
Conversation
nsenter does not inherit the host PATH when executing commands from within the container. Use /usr/local/bin/sonic-installer as the full path to ensure the command is found. Also use 'binary-version' subcommand instead of deprecated 'binary_version' which fails on newer sonic-installer versions. Signed-off-by: Chandra Shekar (WIPRO LIMITED) <v-cshekar@microsoft.com>
Contributor
|
/azp run |
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates the sonic-installer invocation to use the absolute path /usr/local/bin/sonic-installer and corrects the subcommand name from binary_version (underscore) to binary-version (hyphen), with matching test updates.
Changes:
- Replace
sonic-installerwith absolute path/usr/local/bin/sonic-installerin all three call sites (install, binary-version, set-default). - Rename the subcommand
binary_version→binary-versionin code, error messages, and comments. - Update tests and assertions to reflect the new command path and subcommand name.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pkg/gnoi/system/system.go | Switches sonic-installer calls to absolute path and corrects subcommand to binary-version, updating related error messages. |
| pkg/gnoi/system/system_monkey_test.go | Updates mock expectations and assertion strings to match the new path and subcommand name. |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
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.
nsenter does not inherit the host PATH when executing commands from within the container. Use /usr/local/bin/sonic-installer as the full path to ensure the command is found.
Also use 'binary-version' subcommand instead of deprecated 'binary_version' which fails on newer sonic-installer versions.
Why I did it
nsenter does not inherit the host PATH when executing commands from within the container, causing sonic-installer to not be found. Also, the binary_version subcommand is deprecated and fails on newer sonic-installer versions
How I did it
Use absolute path /usr/local/bin/sonic-installer instead of relying on PATH
Use binary-version subcommand instead of deprecated binary_version
How to verify it
Run SetPackage gNOI RPC from a container context and verify sonic-installer is invoked successfully.
Device running SONiC-OS-20251110.30:
admin@bjw3-can-7060-7:/tmp$ sudo sonic-installer list
Current: SONiC-OS-20251110.30
Next: SONiC-OS-20251110.30
Available:
SONiC-OS-20250510.30
SONiC-OS-20251110.30
Called SetPackag with no version information
admin@bjw3-can-7060-7:/tmp$ grpcurl -plaintext -d '{
"package": {
"filename": "/tmp/sonic-aboot-broadcom.swi",
"activate": true
}
}' localhost:50052 gnoi.system.System/SetPackage
{}
Version auto-resolved from imag
admin@bjw3-can-7060-7:/tmp$ sudo sonic-installer list
Current: SONiC-OS-20251110.30
Next: SONiC-OS-20250510.37
Available:
SONiC-OS-20250510.30
SONiC-OS-20250510.37
SONiC-OS-20251110.30
sudo reboot
Device booted into SONiC-OS-20250510.37
admin@bjw3-can-7060-7:~$ sudo sonic-installer list
Current: SONiC-OS-20250510.37
Next: SONiC-OS-20250510.37
Available:
SONiC-OS-20250510.30
SONiC-OS-20250510.37
SONiC-OS-20251110.30
Which release branch to backport (provide reason below if selected)
Description for the changelog
Link to config_db schema for YANG module changes
A picture of a cute animal (not mandatory but encouraged)