py-choria-discovery
Overview
py-choria-discovery contains a collection of tools for writing Choria External Discovery plugins in Python.
Installation
pip install py-choria-discovery
This library requires a version of Choria with external discovery support (0.19.1+).
Implementing Discovery plugins
The bare minimum steps to implement a python discovery plugin are:
- Create a python file without a
.pyextension
#!/usr/bin/python3
from choria_external.dispatcher import dispatch
from choria_discovery import Discovery
class MyDiscovery(Discovery):
def discover(self):
filtered_nodes = []
# Retrieve your list of all available nodes
#nodes = get_nodes()
# Apply the filters in self.request.collective and self.request.filter
#filtered_nodes = apply_filters()
# Return the set of node names which match the filters
self.reply.nodes = filtered_nodes
if __name__ == '__main__':
dispatch(MyDiscovery)
Example
See examples/static for a basic implementation of the node filtering and response.
Reference
Discovery
Provides a base class for implementing External Discovery plugins
Public methods:
discoverReturns a boolean value to indicate whether the agent should be activated on this host. By default returns True and the agent is always activated. Subclasses may choose to override this method and deactivate themselves under appropriate conditions such as missing pre-requisites.
Instance variables:
loggerContains a python logger which can be used to send log information back to choria (debug and info are sent to stdout, which is only displayed in verbose mode; warnings and errors are sent to stderr which are displayed always). The logger is set to use thechoria.plugin_namehierarchy. By default all other logging is disabled to prevent pollution of the reply. This is done by setting the log level on the root logger to 100. You can re-enable logging by adjusting the log-level on either the root logger or a specific child if required.configContains a dict-like object which can be used to read configuration settings from a choria plugin configuration file (/etc/puppetlabs/mcollective/plugin.d/agentname.cfgby default).
Metadata
Release files for py-choria-discovery 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| py-choria-discovery-0.1.1.tar.gz | 4.3 kB | Without provenance | Details for py-choria-discovery-0.1.1.tar.gz |
Release files / py-choria-discovery-0.1.1.tar.gz
| Download URL | py-choria-discovery-0.1.1.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8c80e69edce3aa5bc5815cdae3c7006e72a0d2852e6b6415f3c5d7ebcc63b9e7
|
|
BLAKE2b-256 checksum How to use checksums |
6c13b5ca3738857233a8e24e7d316936711d2f5f6cc5856c2c7c4df34fcbe32f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.8
|
Security for py-choria-discovery 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.