Skip to content

fix(sos): refactor Azure IMDS collection with pretty-printed JSON#17345

Open
jonathanbrenes wants to merge 1 commit into
microsoft:4.0from
jonathanbrenes:fix/sos-azure-imds-refactor
Open

fix(sos): refactor Azure IMDS collection with pretty-printed JSON#17345
jonathanbrenes wants to merge 1 commit into
microsoft:4.0from
jonathanbrenes:fix/sos-azure-imds-refactor

Conversation

@jonathanbrenes
Copy link
Copy Markdown

Backport upstream PR sosreport/sos#4322 (merged) to the AZL sos 4.11.0 build.

Replaces the curl-based IMDS collection with a Python urllib approach that emits pretty-printed JSON, bumps the IMDS API version from 2023-07-01 to 2025-04-07, and collects the full /metadata/instance payload (now including network info).

Merge Checklist

All boxes should be checked before merging the PR (just tick any boxes which don't apply to this PR)

  • The toolchain has been rebuilt successfully (or no changes were made to it)
  • The toolchain/worker package manifests are up-to-date
  • Any updated packages successfully build (or no packages were changed)
  • Packages depending on static components modified in this PR (Golang, *-static subpackages, etc.) have had their Release tag incremented.
  • Package tests (%check section) have been verified with RUN_CHECK=y for existing SPEC files, or added to new SPEC files
  • All package sources are available
  • cgmanifest files are up-to-date and sorted
  • LICENSE-MAP files are up-to-date
  • All source files have up-to-date hashes in the *.signatures.json files
  • sudo make go-tidy-all and sudo make go-test-coverage pass
  • Documentation has been updated to match any changes to the build system
  • Ready to merge

Summary

Backports upstream sosreport/sos#4322 (merged) into the Azure Linux sos 4.11.0 build. The Azure plugin's IMDS metadata collection now uses Python urllib instead of shelling out to curl, producing pretty-printed JSON (4-space indented) for improved readability in the sos report. The IMDS API version is bumped to the latest supported (2025-04-07), and the collected payload is the full /metadata/instance (which now includes network information) instead of only /metadata/instance/compute.

Change Log
  • Add overlay azure-refactor-IMDS-collection-with-pretty-printed-JSON.patch to the sos component, backporting upstream PR [azure] Refactor IMDS collection with pretty-printed JSON sosreport/sos#4322 to sos 4.11.0 (Fedora 43 dist-git base, which does not import glob — hunk 1 line numbers adjusted accordingly).
  • Wire the new patch into base/comps/sos/sos.comp.toml as a patch-add overlay.
  • Refresh locks/sos.lock and re-render specs/s/sos/sos.spec (Release bumped to 4.11.0-6).

Affected package: sos.

Does this affect the toolchain?

NO

Associated issues
  • N/A
Links to CVEs
  • N/A
Test Methodology
  • Local build via azldev comp build -p sos against tomls/base/main (built sos-4.11.0-6.azl4.noarch.rpm).
  • Smoke-test in a mock chroot (azldev adv mock shell --add-package …) verified:
    • from sos.report.plugins.azure import Azure, IMDS_URL imports cleanly.
    • IMDS_URL == "http://169.254.169.254/metadata/instance?api-version=2025-04-07&format=json".
    • Azure.collect and Azure._get_imds_metadata are present and callable.
  • azldev comp render -p sos and azldev comp update -p sos both clean after the finalize-and-amend step (no drift).

Backport upstream PR sosreport/sos#4322 (merged) to the AZL sos 4.11.0 build.

Replaces the curl-based IMDS collection with a Python urllib approach that emits pretty-printed JSON, bumps the IMDS API version from 2023-07-01 to 2025-04-07, and collects the full /metadata/instance payload (now including network info).

Signed-off-by: Jonathan Brenes <jonathan.brenes@microsoft.com>
Copilot AI review requested due to automatic review settings May 19, 2026 02:08
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

Backports upstream sosreport/sos#4322 to the Azure Linux sos 4.11.0 build, replacing the curl-based Azure IMDS metadata collection with a Python urllib implementation that emits pretty-printed JSON, bumps the IMDS API version to 2025-04-07, and collects the full /metadata/instance payload.

Changes:

  • Add backport patch azure-refactor-IMDS-collection-with-pretty-printed-JSON.patch under base/comps/sos/.
  • Wire the patch into sos.comp.toml via a patch-add overlay.
  • Refresh locks/sos.lock and re-render specs/s/sos/sos.spec (Release bumped to 4.11.0-6).

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
base/comps/sos/azure-refactor-IMDS-collection-with-pretty-printed-JSON.patch New backport patch source.
base/comps/sos/sos.comp.toml Adds patch-add overlay for the new patch.
locks/sos.lock Updated input-fingerprint after overlay change.
specs/s/sos/sos.spec Re-rendered: Patch4 registered, Release bumped to 6, changelog entry added.
specs/s/sos/azure-refactor-IMDS-collection-with-pretty-printed-JSON.patch Patch file copied into rendered specs dir.

@jonathanbrenes jonathanbrenes changed the base branch from tomls/base/main to 4.0 May 19, 2026 20:14
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.

2 participants