Most of the implementation is available in plainbox.impl.secure.providers.v1
Bases: plainbox.abc.IProvider1
A v1 provider implementation.
A provider is a container of jobs and whitelists. It provides additional meta-data and knows about location of essential directories to both load structured data and provide runtime information for job execution.
Providers are normally loaded with Provider1PlugIn, due to the number of fields involved in basic initialization.
required value of CHECKBOX_SHARE environment variable.
Note
This variable is only required by one script. It would be nice to remove this later on.
path of the directory with (perhaps) all of jobs_dir, whitelists_dir, data_dir, bin_dir, locale_dir. This may be None
absolute path of the bin directory
Note
The programs in that directory may not work without setting PYTHONPATH and CHECKBOX_SHARE.
absolute path of the build/bin directory
This value may be None. It depends on location/base_dir being set.
absolute path of the build directory
This value may be None. It depends on location/base_dir being set.
absolute path of the build/mo directory
This value may be None. It depends on location/base_dir being set.
Exposed ProviderContentClassifier.classify()
Exposed ProviderContentEnumerator.content_collection()
absolute path of the data directory
description of this provider
List of all the executables
additional entry for PYTHONPATH, if needed.
This entry is required for CheckBox scripts to import the correct CheckBox python libraries.
Note
The result may be None
Bridge to .content_collection.fake_plugins that’s shorter to type.
Initialize a provider from Provider1Definition object
Parameters: |
|
---|
This method simplifies initialization of a Provider1 object where the caller already has a Provider1Definition object. Depending on the value of definition.location all of the directories are either None or initialized to a good (typical) value relative to location
The only value that you may want to adjust, for working with source providers, is locale_dir, by default it would be location/locale but manage.py i18n creates location/build/mo
Get a localized piece of data
Parameters: | msgid – data to translate |
---|---|
Returns: | translated data obtained from the provider if msgid is not False (empty string and None both are) and this provider has a gettext_domain defined for it, msgid itself otherwise. |
the name of the gettext domain associated with this provider
This value may be empty, in such case provider data cannot be localized for the user environment.
A mapping from unit identifier to list of units with that identifier.
Note
Typically the list will be one element long but invalid providers may break that guarantee. Code defensively if you can.
A sorted list of loaded job definition units.
absolute path of the jobs directory
absolute path of the directory with locale data
The value is applicable as argument bindtextdomain()
name of this provider
namespace component of the provider name
This property defines the namespace in which all provider jobs are defined in. Jobs within one namespace do not need to be fully qualified by prefixing their partial identifier with provider namespace (so all stays ‘as-is’). Jobs that need to interact with other provider namespaces need to use the fully qualified job identifier instead.
The identifier is defined as the part of the provider name, up to the colon. This effectively gives organizations flat namespace within one year-domain pair and allows to create private namespaces by using sub-domains.
A mapping from filename path to a list of units stored in that file.
Note
For .pxu files this will enumerate all units stored there. For other things it will typically be just the FileUnit.
absolute path of the po/ directory
This value may be None. It depends on location/base_dir set.
list of problems encountered by the loading process
flag indicating that this provider was loaded from the secure portion of PROVIDERPATH and thus can be used with the plainbox-trusted-launcher-1.
absolute path of the src/ directory
This value may be None. It depends on location/base_dir set.
Get the translated version of description()
List of loaded units.
This list may contain units of various types. You should not assume all of them are JobDefinition instances. You may use filtering to obtain units of a given type.
>>> [unit for unit in provider.unit_list
... if unit.Meta.name == 'job']
[...]
absolute path of the units directory
version of this provider
List of loaded whitelists.
Warning
WhiteList is currently deprecated. You should never need to access them in any new code. They are entirely replaced by TestPlan. This property is provided for completeness and it will be removed once whitelists classes are no longer used.
absolute path of the whitelist directory
Bases: plainbox.impl.secure.plugins.FsPlugInCollection
A collection of v1 provider plugins.
This FsPlugInCollection subclass carries proper, built-in defaults, that make loading providers easier.
This particular class loads providers from both the system-wide managed locations and per-user location. In addition the list of locations searched can be changed by setting the PROVIDERPATH, which behaves just like PATH, but is used for looking up providers.
Time, in fractional seconds, that was required to discover all objects.
This time is separate from the load and wrap time of all each individual plug-in. Typically this is either a fixed cost or a predictable cost related to traversing the file system.
Context manager for using fake list of plugins
Parameters: |
|
---|
The provided list of plugins overrides any previously loaded plugins and prevent loading any other, real, plugins. After the context manager exits the previous state is restored.
Get a list of all the pairs of plugin name and plugin
Returns: | a list of tuples (plugin.plugin_name, plugin) |
---|
Get a list of all the plug-in names
Returns: | a list of plugin names |
---|
Get an list of plug-in objects
Get a list of all the plug-ins
Returns: | a list of plugin objects |
---|
Get the specified plug-in (by name)
Parameters: | name – name of the plugin to locate |
---|---|
Returns: | PlugIn like object associated with the name |
Raises KeyError: | |
if the specified name cannot be found |
Get the sum of load and wrap time of each plugin object
Returns: | The total number of fractional seconds of wall-clock time spent by loading this collection. This value doesn’t include some small overhead of this class but is representative of the load times of pluggable code. |
---|
Load all plug-ins.
This method loads all plug-ins from the search directories (as defined by the path attribute). Missing directories are silently ignored.
List of problems encountered while loading plugins
Internal method of PlugInCollectionBase.
Parameters: |
|
---|
This method prepares a wrapper (PlugIn subclass instance) for the specified plugin name/object by attempting to instantiate the wrapper class. If a PlugInError exception is raised then it is added to the problem_list and the corresponding plugin is not added to the collection of plugins.
Computes the insecure value of PROVIDERPATH.
This value is not used by plainbox-trusted-launcher-1 executable since it would involve reading files outside of the control by the local administrator. This value is used for handing non-root jobs.
Returns: | A list of three strings: * /usr/local/share/plainbox-providers-1 * /usr/share/plainbox-providers-1 * $XDG_DATA_HOME/plainbox-providers-1 |
---|