-
Notifications
You must be signed in to change notification settings - Fork 7
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
Issue/6025 document discovery handler #6270
Conversation
…6025-implement-discovery-handler
…#6025, PR #6415) # Description - [x] implement `DiscoveryHandler` - [x] Verify that the `Id` constructor and `resource_str` method are part of the stable API and documented. This PR replaces #6264 Part of #6025 # Self Check: - [x] Attached issue to pull request - [ ] Changelog entry - [x] Type annotations are present - [x] Code is clear and sufficiently documented - [x] No (preventable) type errors (check using make mypy or make mypy-diff) - [x] Sufficient test cases (reproduces the bug/tests the requested feature) - [x] Correct, in line with design - [x] End user documentation is included or an issue is created for end-user documentation (#6270) - [ ] ~~If this PR fixes a race condition in the test suite, also push the fix to the relevant stable branche(s) (see [test-fixes](https://internal.inmanta.com/development/core/tasks/build-master.html#test-fixes) for more info)~~
docs/model_developers/unmanaged_resources/shared_attributes_example_handler.py
Show resolved
Hide resolved
docs/model_developers/unmanaged_resources/shared_attributes_example_handler.py
Outdated
Show resolved
Hide resolved
docs/model_developers/unmanaged_resources/shared_attributes_example_handler.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is really clear and the examples help a lot
Co-authored-by: Sander Van Balen <[email protected]> Co-authored-by: FloLey <[email protected]>
…manta/inmanta-core into issue/6025-document-discovery-handler
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I think the test cases have just the right scope!
@@ -28,20 +28,20 @@ class UnmanagedInterface(pydantic.BaseModel): | |||
""" | |||
host: str | |||
interface_name: str | |||
ip_address: pydantic.IPvAnyAddress | |||
ip_address: str |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Purely out of curiosity: why did you have to make this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to keep the type here close to the type in the model. In the model I used std::ipv4_address
which maps to ipaddress::IPv4Address
. The latter cannot be serialized by our customer json serializer. That's why I went to str.
@@ -53,7 +53,7 @@ def discover_resources( | |||
for res in discovered | |||
} | |||
|
|||
def _get_discovered_resources(self, host: str) -> list[dict[str, object]]: | |||
def _get_discovered_interfaces(self, discovery_resource: InterfaceDiscovery) -> list[dict[str, object]]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, I like the name change!
src/inmanta/agent/handler.py
Outdated
discovered and reported to the server. Objects of this type must be serializable. | ||
discovered and reported to the server. Objects of this type must be either: | ||
1. A pydantic object | ||
2. An object that inherits from `inmanta.util.JSONSerializable` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one doesn't seem to be part of the stable API. So we should either make it so, or drop this option. Given the somewhat subtle interface of the class, and the fact that pydantic should cover most, if not all, use cases, I'm inclined to go with the latter. Not too strong of a preference though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. I didn't pay attention to whether or not these classes are part of the stable API. I dropped the option.
Processing this pull request |
Merged into branches master in 3bad712 |
… PR #6270) # Description - [x] add documentation including examples, see the design for more details. part of #6025 # Self Check: Strike through any lines that are not applicable (`~~line~~`) then check the box - [x] Attached issue to pull request - [x] Changelog entry - [x] Type annotations are present - [x] Code is clear and sufficiently documented - [x] No (preventable) type errors (check using make mypy or make mypy-diff) - [x] Sufficient test cases (reproduces the bug/tests the requested feature) - [x] Correct, in line with design - [ ] End user documentation is included or an issue is created for end-user documentation (add ref to issue here: ) - [ ] ~~If this PR fixes a race condition in the test suite, also push the fix to the relevant stable branche(s) (see [test-fixes](https://internal.inmanta.com/development/core/tasks/build-master.html#test-fixes) for more info)~~
Description
part of #6025
Self Check:
Strike through any lines that are not applicable (
~~line~~
) then check the boxIf this PR fixes a race condition in the test suite, also push the fix to the relevant stable branche(s) (see test-fixes for more info)