Skip to content

[gnoi] SetPackage: use absolute path for sonic-installer#691

Open
v-cshekar wants to merge 1 commit into
sonic-net:masterfrom
v-cshekar:gnoi-setpackage-fix
Open

[gnoi] SetPackage: use absolute path for sonic-installer#691
v-cshekar wants to merge 1 commit into
sonic-net:masterfrom
v-cshekar:gnoi-setpackage-fix

Conversation

@v-cshekar
Copy link
Copy Markdown
Contributor

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)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111

Description for the changelog

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

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>
Copilot AI review requested due to automatic review settings May 29, 2026 23:31
@mssonicbld
Copy link
Copy Markdown
Contributor

/azp run

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-installer with absolute path /usr/local/bin/sonic-installer in all three call sites (install, binary-version, set-default).
  • Rename the subcommand binary_versionbinary-version in 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
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@hdwhdw
Copy link
Copy Markdown
Contributor

hdwhdw commented Jun 1, 2026

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants