MGMT-21040: Hide the infraenv concept better#19
MGMT-21040: Hide the infraenv concept better#19carbonin merged 2 commits intoopenshift-assisted:masterfrom
Conversation
The information in the infraenv is generally not of much use to the user. This is why the entire concept is hidden from them in the SaaS UI. In order to be able to support getting the download URL for clusters created outside of the current session and to further hide the infraenv concept this commit changes the infraenv_info tool into cluster_iso_download_url which takes just a cluster ID as input. While a cluster can have multiple infraenvs, this is currently not an expected flow in the SaaS so we simply return all that we find without additional context. In the future if this MCP server is required to support multi-arch deployments (the most common use-case for multiple infraenvs) then maybe more information will need to accompany the multiple URLs. https://issues.redhat.com/browse/MGMT-21040
|
@carbonin: This pull request references MGMT-21040 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "4.20.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: carbonin The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
WalkthroughThe codebase replaces the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Server
participant InventoryClient
participant AssistedServiceAPI
User->>Server: cluster_iso_download_url(cluster_id)
Server->>InventoryClient: list_infra_envs(cluster_id)
InventoryClient->>AssistedServiceAPI: list_infra_envs(cluster_id)
AssistedServiceAPI-->>InventoryClient: List of infraenvs
InventoryClient-->>Server: List of infraenvs
Server-->>User: ISO download URLs (newline-separated)
Suggested labels
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
@carbonin: This pull request references MGMT-21040 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "4.20.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
README.md (1)
109-112: Fix spacing and formatting issues.The documentation changes correctly reflect the new tool functionality, but there are some formatting issues that should be addressed.
Apply these formatting fixes:
-### ISO Download URL +### ISO Download URL -* **cluster_iso_download_url** - Get ISO download URL(s) for a cluster. Returns ISO download URLs separated by newlines if multiple exist. +* **cluster_iso_download_url** — Get ISO download URL(s) for a cluster. Returns ISO download URLs separated by newlines if multiple exist. - * `cluster_id`: Cluster ID (string, required) + * `cluster_id`: Cluster ID (string, required)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
README.md(1 hunks)server.py(4 hunks)service_client/assisted_service_api.py(1 hunks)tests/test_assisted_service_api.py(1 hunks)tests/test_server.py(2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (3)
tests/test_assisted_service_api.py (1)
service_client/assisted_service_api.py (1)
list_infra_envs(256-291)
server.py (2)
tests/test_assisted_service_api.py (1)
client(25-30)service_client/assisted_service_api.py (3)
InventoryClient(22-623)list_infra_envs(256-291)create_cluster(293-342)
tests/test_server.py (2)
service_client/assisted_service_api.py (1)
list_infra_envs(256-291)server.py (1)
cluster_iso_download_url(203-249)
🪛 LanguageTool
README.md
[grammar] ~109-~109: Use proper spacing conventions.
Context: ...(string, required) ### ISO Download URL * cluster_iso_download_url - Get ISO dow...
(QB_NEW_EN_OTHER_ERROR_IDS_000007)
[typographical] ~111-~111: To join two clauses or set off examples, consider using an em dash.
Context: ...g, required) ### ISO Download URL * cluster_iso_download_url - Get ISO download URL(s) for a cluster. Retu...
(QB_NEW_EN_DASH_RULE_EM)
[grammar] ~111-~111: There might be a problem here.
Context: ...separated by newlines if multiple exist. * cluster_id: Cluster ID (string, required) ### Host...
(QB_NEW_EN_MERGED_MATCH)
[grammar] ~112-~112: Use proper spacing conventions.
Context: ...uster_id`: Cluster ID (string, required) ### Host Management * set_host_role - U...
(QB_NEW_EN_OTHER_ERROR_IDS_000007)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Red Hat Konflux / assisted-service-mcp-saas-main-on-pull-request
🔇 Additional comments (6)
service_client/assisted_service_api.py (1)
256-292: LGTM! Well-implemented API method.The
list_infra_envsmethod follows the established patterns in the codebase with proper:
- Async implementation using
asyncio.to_thread- Comprehensive error handling for both
ApiExceptionand generic exceptions- Detailed logging for debugging
- Correct type hints
tests/test_assisted_service_api.py (1)
296-334: Comprehensive test coverage for the new API method.The tests properly cover both success and error scenarios:
- Success case validates correct API call and return value
- Exception handling test ensures proper error propagation
- Mocking strategy is consistent with other tests in the file
server.py (2)
203-249: Well-implemented function that properly handles multiple infra envs.The
cluster_iso_download_urlfunction correctly:
- Uses the new
list_infra_envsAPI method- Handles edge cases (no infra envs, no download URLs)
- Extracts URLs from each infra env and joins with newlines
- Provides user-friendly error messages
- Includes comprehensive logging
286-300: Good error handling and simplified return value.The changes to
create_clusterare consistent with hiding the infraenv concept:
- Returns only the cluster ID instead of JSON with both cluster and infraenv IDs
- Adds proper error handling for when cluster.id is None
- Still creates the infraenv but doesn't expose its ID to users
tests/test_server.py (2)
342-428: Comprehensive test coverage for all scenarios.The updated tests properly cover:
- Single infra env scenario with correct URL extraction
- Multiple infra envs with newline-separated URLs
- No infra envs scenario with appropriate error message
- Proper mocking of the new
list_infra_envsmethod
456-456: Correct assertion for simplified return value.The test correctly expects just the cluster ID string instead of JSON, consistent with the updated
create_clusterfunction behavior.

The information in the infraenv is generally not of much use to the
user. This is why the entire concept is hidden from them in the SaaS UI.
In order to be able to support getting the download URL for clusters
created outside of the current session and to further hide the infraenv
concept this PR changes the infraenv_info tool into
cluster_iso_download_url which takes just a cluster ID as input.
While a cluster can have multiple infraenvs, this is currently not an
expected flow in the SaaS so we simply return all that we find without
additional context. In the future if this MCP server is required to
support multi-arch deployments (the most common use-case for multiple
infraenvs) then maybe more information will need to accompany the
multiple URLs.
https://issues.redhat.com/browse/MGMT-21040
Summary by CodeRabbit
Documentation
New Features
Bug Fixes
Tests