Skip to content

fix(python): request cluster name field in cluster_info#43

Merged
hvinn merged 1 commit into
NetApp:mainfrom
jainpiyush111:fix/cluster-info-missing-name-field
May 22, 2026
Merged

fix(python): request cluster name field in cluster_info#43
hvinn merged 1 commit into
NetApp:mainfrom
jainpiyush111:fix/cluster-info-missing-name-field

Conversation

@jainpiyush111
Copy link
Copy Markdown
Contributor

@jainpiyush111 jainpiyush111 commented May 21, 2026

The /cluster GET requested only fields=version, so ONTAP omitted name from the response and the script logged 'Cluster: unknown'. Include name alongside version so the cluster identity prints correctly.

Summary

python/cluster_info.py was logging Cluster: unknown for every cluster
because the /cluster GET requested only the version field. ONTAP's
REST API returns only the fields listed in ?fields=... (plus a minimal
default set), so name was absent from the response and the
.get("name", "unknown") fallback kicked in.

Change

Request both fields:

- cluster = client.get("/cluster", fields="version")
+ cluster = client.get("/cluster", fields="name,version")

Before

INFO  Cluster: unknown — ONTAP NetApp Release 9.19.1: Wed May 06 17:37:14 UTC 2026
INFO  Nodes in cluster: 2

After

INFO  Cluster: FsnIdoci-46023003xxxx — ONTAP NetApp Release 9.19.1: Wed May 06 17:37:14 UTC 2026
INFO  Nodes in cluster: 2

Why

The script reads cluster["name"] and cluster["version"]["full"], so
both keys must be listed in the fields selector. This is the standard
ONTAP REST pattern — projection is opt-in to keep payloads small.

Testing

  • Ran python python/cluster_info.py against a 2-node ONTAP 9.19.1
    simulator; cluster name now renders correctly.
  • make lint passes (ruff check + format).

Risk

Minimal — single-line change to a read-only example script. No public
API or behaviour change beyond the corrected log line.

Checklist

  • Code follows repo conventions
  • make lint passes
  • No new dependencies
  • Manually verified against a live cluster
  • Docs update — N/A (output format unchanged)

@github-actions
Copy link
Copy Markdown

Test Report missing or unfilled.

This PR touches python/, ansible/, or terraform/, so a populated Test Report section is required in the PR body. See TESTING.md for what to capture (environment, platform version, first-run output, idempotency check, teardown).

This is a soft gate - your CI checks are unaffected - but reviewers will not approve until the report is filled in.

@github-actions github-actions Bot added python Pull requests that update python code and removed needs-test-report labels May 21, 2026
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Thanks for your first PR to Pace — welcome aboard.

Quick orientation:

  1. CI runs in ~2 minutes. If anything fails, check the Actions tab — most failures have a one-line fix in docs/troubleshooting.md.
  2. If your PR touches python/, ansible/, or terraform/, you'll be asked for a Test Report. It's worth the effort — reviewers rely on it.
  3. Make sure the NetApp CCLA is on file before review.
  4. Stuck? Comment on this PR and a maintainer will jump in. We aim to respond as soon as possible.

For background, see CONTRIBUTING.md.

The /cluster GET requested only fields=version, so ONTAP omitted name from the response and the script logged 'Cluster: unknown'. Include name alongside version so the cluster identity prints correctly.
@hvinn hvinn force-pushed the fix/cluster-info-missing-name-field branch from 4c82ff2 to 8884ae9 Compare May 22, 2026 07:00
@hvinn hvinn merged commit 5f8f7f7 into NetApp:main May 22, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-test-report python Pull requests that update python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants