rPath Appliance Platform Agent:Plugins
From rPath Wiki
|
The administrative tasks that can be performed using the rPath Appliance Platform Agent (rAPA) are each powered by a plugin to rAPA. rAPA includes standard plugins to cover many common administrative tasks, and though all included plugins are enabled by default, appliance developers can add configuration to disable any plugins as appropriate for the appliance. Also, developers can create and include custom plugins for tasks specific to an appliance.
Plugin Structure
A plugin in the rAPA consists of Python code and related files used to accomplish a particular administrative task. Plugin files reside in the directories associated with the agent or in an alternate location configured for searching plugins. The agent finds plugins at these configured locations and interprets the code to render the plugin interface and execute its underlying functions.
A plugin is referenced in configuration files by a plugin identifier. The identifier has the format /plugin/PluginName where plugin is the directory in which the plugin files reside and PluginName is the name of the Python class that defines the plugin. Standard appliance agent plugins reside in /usr/lib/raa/raaplugins/ by default.
The action of a plugin is driven by tasks. The two components of the plugin each handle different tasks:
| Web Component The web component handles user interaction through the agent's web interface. The web component must be in the web directory of the plugin. | Service Component The service component handles prolonged tasks or tasks requiring root privileges. The service component must be in the srv directory of the plugin. |
In the Python code used for plugins, developers use methods (functions) associated with a class to pull in different rPath Appliance Platform Agent operations. Methods in the web component can correspond to a URL so that when the browser navigates to that URL, the method is run and its return value is sent to the browser. For example, if the plugin is project.plug.web.plugin.Plugin, then the index method is evaluated when the user browses to /rAA/plugin/PluginName/, and the example method is evaluated upon the request of /rAA/plugin/PluginName/example.
The web component can request two types of task execution by the service component:
- Immediate execution is for tasks which complete quickly (such as changing the root password), but require root privileges. For such tasks, the call for execution made by the web component must wait for the service component to complete the task.
- Scheduled execution is for tasks which may run longer than a few seconds, whether or not they require root privileges to execute.
The following images show rPath Appliance Platform Agent infrastructure and plugin structure:
Standard Plugins and Configuration
The rPath Appliance Platform Agent standard plugins cover several common appliance administration tasks. All included plugins are enabled by default, and the files driving the plugin are installed in /usr/lib/raa/raaplugins/ by default.
- View the list of standard plugins with links to more information about each.
- Create a custom configuration for plugins.
Custom Plugins
rAPA exposes an application programming interface (API) to plugins, allowing the plugins to utilize the supporting infrastructure provided by rAPA to perform actions such as scheduling tasks, sending notifications, and logging. Using the infrastructure, plugins can also communicate with users by providing the user interface layout using kid templates.
User Roles
Developers can statically define user roles in the plugin code. rAPA users can assign users to one or more groups, and the groups can be associated with the roles defined by the plugins. See the Appliance Developer Notes section in the User Management plugin page for more information on this feature.
