Skip to content
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

Closed
wants to merge 39 commits into from

Conversation

Hugo-Inmanta
Copy link
Contributor

@Hugo-Inmanta Hugo-Inmanta commented Jul 13, 2023

Description

  • 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

  • Attached issue to pull request
  • Changelog entry
  • Type annotations are present
  • Code is clear and sufficiently documented
  • No (preventable) type errors (check using make mypy or make mypy-diff)
  • Sufficient test cases (reproduces the bug/tests the requested feature)
  • 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 for more info)

inmantaci pushed a commit that referenced this pull request Aug 28, 2023
…#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)~~
@arnaudsjs arnaudsjs self-assigned this Aug 28, 2023
.gitignore Outdated Show resolved Hide resolved
docs/model_developers/unmanaged_resources.rst Outdated Show resolved Hide resolved
docs/model_developers/unmanaged_resources.rst Outdated Show resolved Hide resolved
docs/model_developers/unmanaged_resources.rst Outdated Show resolved Hide resolved
docs/model_developers/unmanaged_resources.rst Outdated Show resolved Hide resolved
docs/model_developers/unmanaged_resources.rst Outdated Show resolved Hide resolved
docs/model_developers/unmanaged_resources.rst Show resolved Hide resolved
Copy link
Contributor

@FloLey FloLey left a 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

docs/model_developers/unmanaged_resources.rst Outdated Show resolved Hide resolved
arnaudsjs and others added 7 commits August 29, 2023 13:40
Co-authored-by: Sander Van Balen <git@sandervanbalen.be>
Co-authored-by: FloLey <95339363+FloLey@users.noreply.github.com>
…manta/inmanta-core into issue/6025-document-discovery-handler
Copy link
Contributor

@sanderr sanderr left a 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
Copy link
Contributor

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?

Copy link
Contributor

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]]:
Copy link
Contributor

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!

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`
Copy link
Contributor

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.

Copy link
Contributor

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.

@arnaudsjs arnaudsjs added the merge-tool-ready This ticket is ready to be merged in label Sep 11, 2023
@inmantaci
Copy link
Contributor

Processing this pull request

@inmantaci
Copy link
Contributor

Merged into branches master in 3bad712

inmantaci pushed a commit that referenced this pull request Sep 11, 2023
… 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)~~
@inmantaci inmantaci closed this Sep 11, 2023
@inmantaci inmantaci deleted the issue/6025-document-discovery-handler branch September 11, 2023 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge-tool-ready This ticket is ready to be merged in
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants