Configuration

The gofer agent and plugins are configured using ini style configuration files located in /etc/gofer.

Agent Configuration

The agent configuration is specified in: /etc/gofer/agent.conf and through files located in /etc/gofer/conf.d. During startup, gofer first reads agent.conf. Then, reads and merges in values found in the conf.d files.

All configuration files support the following sections and properties:

[logging]

This section sets logging properties. Currently, the logging level can be set for each gofer packege as follows:

<package> = <level>

Levels (may be lower case):

  • CRITICAL
  • DEBUG
  • ERROR
  • FATAL
  • INFO
  • WARN
  • WARNING

Gofer packages:

  • agent
  • messaging
  • plugins

Examples:

[logging]
agent = DEBUG
messaging = WARNING

[pam]

  • service - The (optional) service to be used for PAM authentication.

Plugin Descriptors

Each plugin has a configuration located in /etc/gofer/plugins. Plugin descriptors are ini style configuration that require the following sections and properties:

[main]

Defines basic plugin properties.

  • name - The (optional) plugin name. The basename of the descriptor is used when not specified.

  • plugin - The (optional) fully qualified module to be loaded from the PYTHON path. When plugin is not specified, the plugin is loaded by searching the following directories for a module with the same name as the plugin:

    • /usr/share/gofer/plugins
    • /usr/lib/gofer/plugins
    • /usr/lib64/gofer/plugins
    • /opt/gofer/plugins
  • enabled - Specify the plugin as enabled/disabled.

  • requires - Specify (optional) required (,) comma separated list of plugins by name.

  • extends - Specify (optional) another plugin to extend by name.

[messaging]

  • ‘url - The (optional) broker connection URL.

  • uuid - The agent identity. This value also specifies the queue name. No value indicates the plugin should not connect to broker. format: <adapter>+<protocol>://<user>:<password>@<host>:<port>/<virtual-host>, protocol is one of:

    • tcp: non-SSL protocol
    • amqp: non-SSL protocol
    • ssl: SSL protocol
    • amqps: SSL protocol

    The <adapter>, <user>:<password> and /<virtual-host> are optional. See: Messaging Adapters for list of supported adapters.

    The <port> is optional and defaults based on the protocol when not specified:

    • (amqp|tcp) port:5672
    • (amqps|ssl) port:5671
  • cacert - The (optional) SSL CA certificate used to validate the server certificate.

  • clientcert - The (optional) SSL client certificate. A (PEM) file containing both the private key and certificate.

  • host_validation - The (optional) flag indicates SSL host validation should be performed.

  • threads - The (optional) number of threads for the RMI dispatcher. Default to (1) when not specified.

[model]

  • managed - The model is manged. Default:2

    • 0: Not managed.
    • 1: The queue is declared on attach and bound the the exchange as needed.
    • 2: The queue is declared on attach and bound the the exchange as needed and drained and deleted on explicit detach.
  • queue - The queue name. Overrides the [messaging] uuid.

  • exchange - The exchange name. Default:’‘.

Examples

This example enables messaging and defines the uuid:

[main]
enabled = 1

[messaging]
enabled = 1
uuid=123

This example enables messaging and does not define the uuid. It is expected that the plugin defines an @identity decorated method/function that provides the uuid:

[main]
enabled = 1

[messaging]
enabled = 1

This example does not enable messaging for this plugin. This would be done when the plugin does not need to specify an additional identity. This example also specifies a user defined sections to be used by the plugin:

[main]
enabled = 1

[messaging]
enabled = 0

[foobar]
timeout = 100

However, additional user defined sections and properties are supported and made available to the plugin(s) as follows:

from gofer.agent.plugin import Plugin
...
class MyPlugin:
  ...
  def mymethod(self):
      cfg = Plugin.find(__name__).cfg()
      timeout = cfg.foobar.timeout
      ...