Skip to content

V cshekar/setpackage 202511#689

Open
v-cshekar wants to merge 3 commits into
sonic-net:202511from
v-cshekar:v-cshekar/setpackage-202511
Open

V cshekar/setpackage 202511#689
v-cshekar wants to merge 3 commits into
sonic-net:202511from
v-cshekar:v-cshekar/setpackage-202511

Conversation

@v-cshekar
Copy link
Copy Markdown
Contributor

Why I did it

How I did it

How to verify it

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)

ryanzhu706 and others added 2 commits May 27, 2026 09:40
When the caller does not provide the version (to_version) field in the
SetPackage request, instead of failing with an error, the API now
automatically resolves the version by running
'sonic-installer binary_version <filename>' on the installed image.

This allows hwproxy and other callers to omit the version field while
still getting proper activation (set-default) behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: ryanzhu <ryanzhu@microsoft.com>
Restructure HandleSetPackage to validate and resolve the version
from the image binary BEFORE performing install. This ensures we
fail early without side effects if version resolution fails.

Order is now: validate inputs -> resolve version -> install -> activate

Also addresses PR review comments:
- Fix args bounds check (len >= 2) before accessing args[1]
- Add test for Version='' + Activate=false (install-only)
- Update test names to accurately reflect scenarios

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: ryanzhu <ryanzhu@microsoft.com>
@mssonicbld
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@mssonicbld
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@v-cshekar v-cshekar force-pushed the v-cshekar/setpackage-202511 branch from 46b66d4 to 1b75a2d Compare May 28, 2026 22:38
@mssonicbld
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

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>
@v-cshekar v-cshekar force-pushed the v-cshekar/setpackage-202511 branch from 1b75a2d to 0842312 Compare May 29, 2026 16:55
@mssonicbld
Copy link
Copy Markdown
Contributor

/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.

3 participants