Repository navigation
baremetal list: add --details #2886
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| """Ironic helpers that need more than openstacksdk exposes. | ||
|
|
||
| Importing this module imports openstacksdk; import it where it is used, | ||
| not at the top of a command module. | ||
| """ | ||
|
|
||
| from openstack import resource | ||
| from openstack.baremetal.v1.node import Node | ||
|
|
||
|
|
||
| class DetailedNode(Node): | ||
| """An Ironic node that also keeps ``provision_updated_at``. | ||
|
|
||
| Ironic returns ``provision_updated_at`` (when the node entered its | ||
| current provision state) with every detailed node, but openstacksdk's | ||
| ``Node`` has no attribute for it, so the SDK drops the value while | ||
| parsing the response. Declaring the field here keeps it. Remove the | ||
| declaration once openstacksdk maps the field itself. | ||
| """ | ||
|
|
||
| # openstacksdk looks up the alternate id only in the class's own | ||
| # __dict__, not in its bases. Without repeating the declaration a | ||
| # subclass of Node loses the "uuid" -> id mapping and every node's id | ||
| # is None. | ||
| id = resource.Body("uuid", alternate_id=True) | ||
|
|
||
| provision_updated_at = resource.Body("provision_updated_at") | ||
|
|
||
|
|
||
| def list_detailed_nodes(conn, **query): | ||
| """List nodes with all fields, as ``conn.baremetal.nodes(details=True)``. | ||
|
|
||
| This goes through the same request and microversion negotiation as the | ||
| SDK's own proxy method; only the resource class differs. | ||
| """ | ||
| return DetailedNode.list(conn.baremetal, details=True, **query) | ||
|
ideaship marked this conversation as resolved.
Resolved
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.