Personal tools

rPath Appliance Platform Agent:Structure

From rPath Wiki

Jump to: navigation, search

Contents

The key parts of the rPath Appliance Platform Agent are a server and exposed interfaces. The server part is driven by a task scheduler, and the interfaces are driven by HTTP and JSON. The agent makes use of open-source technologies, and it provides a means to extend its functions through the development of plugins.

Task Scheduler

The agent provides a scheduling model for tasks that features three types of task scheduling:

  • Immediate Tasks scheduled to execute once, usually within 5 seconds; this is equivalent to manually launching the task
  • One Time Tasks scheduled to be executed once; these often include long-running tasks to be scheduled as resources permit
  • Repeating Tasks with flexible and repeatable schedules, such as hourly, daily, weekly, and monthly

Interfaces

The appliance agent makes functions available through two exposed interfaces:

  • HTTP and HTTPS - the web user interface, accessible by any W3 standard-compliant web browser
  • JSON - the JavaScript Object Notation data interchange interface, useful for creating dynamic interfaces using asynchronous JavaScript calls

The agent also provides the option to write an XML-RPC client to call agent functions.

Technologies

rAPA is built on and powered by open-source technologies, enhancing its extensible nature while providing a solid web application foundation. The following technologies are used in the appliance agent:

  • Kid template framework -- feature for web interface layout and presentation
  • CherryPy -- CherryPy is a pythonic, object-oriented HTTP framework based on the Python programming language, handling everything from backend database activities to web interface layout.

rPath maintains rAPA for use on software appliances based on Conary, an open-source package management technology.

rAPA Plugins

The administrative tasks that can be performed using the 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:

rAPA Infrastructure
Enlarge
rAPA Infrastructure
rAPA Plugin Structure
Enlarge
rAPA 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.

Access instructions and reference for developing plugins.

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.