Reference

Python client for Hiera hierachical database.

class hiera.client.HieraClient(config_filename, hiera_binary=u'hiera', **kwargs)[source]

Python client for Hiera hierachical database.

__init__(config_filename, hiera_binary=u'hiera', **kwargs)[source]

Create a new instance with the given settings.

Key value params passed into this will be added to the environment when running the hiera client. For example, (environment=’developer’, osfamily=’Debian’) as keyword args to __init__ would result in hiera calls like this:

hiera –config <config_filename> <key> environment=developer osfamily=Debian
Parameters:
  • config_filename – Path to the hiera configuration file.
  • hiera_binary – Path to the hiera binary. Defaults to ‘hiera’.
get(key_name)[source]

Request the given key from hiera.

Returns the string version of the key when successful.

Raises hiera.exc.HieraError if the key does not exist or there was an error invoking hiera. Raises hiera.exc.HieraNotFoundError if the hiera CLI binary could not be found.

Parameters:key_name – string key
Return type:str value for key or None
class hiera.HieraClient(config_filename, hiera_binary=u'hiera', **kwargs)

Python client for Hiera hierachical database.

__init__(config_filename, hiera_binary=u'hiera', **kwargs)

Create a new instance with the given settings.

Key value params passed into this will be added to the environment when running the hiera client. For example, (environment=’developer’, osfamily=’Debian’) as keyword args to __init__ would result in hiera calls like this:

hiera –config <config_filename> <key> environment=developer osfamily=Debian
Parameters:
  • config_filename – Path to the hiera configuration file.
  • hiera_binary – Path to the hiera binary. Defaults to ‘hiera’.
get(key_name)

Request the given key from hiera.

Returns the string version of the key when successful.

Raises hiera.exc.HieraError if the key does not exist or there was an error invoking hiera. Raises hiera.exc.HieraNotFoundError if the hiera CLI binary could not be found.

Parameters:key_name – string key
Return type:str value for key or None

Exceptions

Exceptions for specific hiera issues.

class hiera.exc.HieraError(message, returncode=None, output=None)[source]

Generic Hiera error.

__init__(message, returncode=None, output=None)[source]

Override instance init so that return code and console output can be added to error.

class hiera.exc.HieraNotFoundError[source]

Hiera error indicating the hiera CLI could not be found.

Project Versions

Table Of Contents

Previous topic

Introduction

Next topic

Development

This Page