feat(rps): display structured per-component activation result#1349
feat(rps): display structured per-component activation result#1349madhavilosetty-intel wants to merge 1 commit into
Conversation
63d1686 to
d327bce
Compare
Parse and surface the structured per-component provisioning result that RPS now sends (rps#2665). When the success message includes the additive Components object, log each component (Activation, Wired/ Wireless Network, TLS, CIRA Proxy/Connection) with its result and details, logging failures at error level. When Components is absent (older RPS), fall back to the existing flat status lines, so behavior against older servers is unchanged. Refs device-management-toolkit/rps#2665
d327bce to
8afb2e0
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates the RPS client activation-status reporting to parse and surface the new structured, per-component provisioning results returned by newer RPS versions, while keeping legacy logging behavior for older RPS responses.
Changes:
- Parse and log the new
Componentsobject in RPS “success” status messages, logging each component result individually. - Add new message types (
ComponentResult,ComponentResults) to represent structured activation results. - Add tests covering structured-success parsing and basic structured/legacy logging paths.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| internal/rps/rps.go | Replaces flat status logging with structured per-component logging when Components is present, with legacy fallback. |
| internal/rps/rps_test.go | Adds tests for structured success handling and for calling the new logging helper without panics. |
| internal/rps/message.go | Extends StatusMessage with Components and introduces structured component result structs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if statusMessage.Components != nil { | ||
| c := statusMessage.Components | ||
| logComponentResult("Activation", c.Activation) | ||
| logComponentResult("Wired Network", c.WiredNetwork) | ||
| logComponentResult("Wireless Network", c.WirelessNetwork) |
There was a problem hiding this comment.
Looks to be valid suggestion. Please check
| line := label + ": " + result.Result | ||
| if result.Details != "" { | ||
| line += " (" + result.Details + ")" | ||
| } |
| func TestLogStatusMessageStructured(t *testing.T) { | ||
| // Structured Components present: per-component lines are logged, no panic. | ||
| statusMessage := StatusMessage{ | ||
| Status: "Admin control mode.", |
sudhir-intc
left a comment
There was a problem hiding this comment.
Please do address the copilot review comments
| if statusMessage.Components != nil { | ||
| c := statusMessage.Components | ||
| logComponentResult("Activation", c.Activation) | ||
| logComponentResult("Wired Network", c.WiredNetwork) | ||
| logComponentResult("Wireless Network", c.WirelessNetwork) |
There was a problem hiding this comment.
Looks to be valid suggestion. Please check
| if result.Result == "Failure" { | ||
| log.Error(line) | ||
| } else { | ||
| log.Info(line) |
There was a problem hiding this comment.
I tried your PR and don't see new info lines getting logged.
I see the following output, which is same as 2.x.x branch. Am I missing something here ?
sudo ./rpc-2665 activate -u wss://10.190.213.16/activate -n --profile acmProfileCloud --tls-tunnel --password <password>
time="2026-06-03T14:53:26+05:30" level=info msg="connecting to wss://10.190.213.16/activate"
time="2026-06-03T14:53:26+05:30" level=info msg="connected to wss://10.190.213.16/activate"
time="2026-06-03T14:54:43+05:30" level=info msg="Status: Admin control mode."
time="2026-06-03T14:54:43+05:30" level=info msg="Network: Wired Network Configured"
time="2026-06-03T14:54:43+05:30" level=info msg="CIRA: Configured"
time="2026-06-03T14:54:43+05:30" level=info msg="TLS: unconfigured"
Parse and surface the structured per-component provisioning result that RPS now sends (rps#2665). When the success message includes the additive Components object, log each component (Activation, Wired/ Wireless Network, TLS, CIRA Proxy/Connection) with its result and details, logging failures at error level. When Components is absent (older RPS), fall back to the existing flat status lines, so behavior against older servers is unchanged.
Refs device-management-toolkit/rps#2665