We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
There is more or less documented way to write your own connectors: https://docs.pyinfra.com/en/2.x/api/connectors.html
However, connectors lookup is pretty much hardcoded to pyinfra.connectors package right here: https://github.com/Fizzadar/pyinfra/blob/51c48de09adcc7b8e9ee5da7b56b44f230cc30a0/pyinfra/api/connectors.py#L33
pyinfra.connectors
and there: https://github.com/Fizzadar/pyinfra/blob/51c48de09adcc7b8e9ee5da7b56b44f230cc30a0/pyinfra/api/inventory.py#L92
So, it's not possible to use connectors outside the official pyinfra release without monkey patching.
Is it designed to be like that? And if so, what is the purpose of the mentioned documentation page?
The text was updated successfully, but these errors were encountered:
I've managed to create a basic teleport connector here https://github.com/mvgijssel/setup/pull/262/files with the following monkey patch in the inventory.py
inventory.py
import pyinfra.api.connectors import provisioner.connectors.teleport from pyinfra.api.connectors import get_all_connectors import pyinfra.api.inventory original_get_all_connectors = pyinfra.api.connectors.get_all_connectors def patched_get_all_connectors(): data = original_get_all_connectors() data["teleport"] = provisioner.connectors.teleport return data pyinfra.api.connectors.get_all_connectors = patched_get_all_connectors pyinfra.api.inventory.get_all_connectors = patched_get_all_connectors
It's not pretty but it works!
Sorry, something went wrong.
The move to use entrypoints should facilitate exactly this kind of situation! I don't have time to pull an example together right now but essentially you need to define a package that adds to the pyinfra.connectors entry point (https://packaging.python.org/en/latest/guides/creating-and-discovering-plugins/#using-package-metadata).
I will try to get an example of this up somewhere!
No branches or pull requests
There is more or less documented way to write your own connectors:
https://docs.pyinfra.com/en/2.x/api/connectors.html
However, connectors lookup is pretty much hardcoded to
pyinfra.connectors
package right here:https://github.com/Fizzadar/pyinfra/blob/51c48de09adcc7b8e9ee5da7b56b44f230cc30a0/pyinfra/api/connectors.py#L33
and there:
https://github.com/Fizzadar/pyinfra/blob/51c48de09adcc7b8e9ee5da7b56b44f230cc30a0/pyinfra/api/inventory.py#L92
So, it's not possible to use connectors outside the official pyinfra release without monkey patching.
Is it designed to be like that? And if so, what is the purpose of the mentioned documentation page?
The text was updated successfully, but these errors were encountered: