Skip to main content

a python hiera parser

Project description

Phiera

codecov Test PyPi Release License Python Versions Python Wheel

Phiera is a fork of Piera, a lightweight, pure-Python Hiera parser. Piera was originally built to provide Python tooling access to Puppet/Hiera configurations. The original Piera is currently not feature complete; lacking some less-used interpolation and loading features.

Table of content

Why?:

Piera/Phiera generalizes Puppet Hiera's hierarchical storage system; making a simple, very flexible, abstracted, and DRY mechanism for managing complex configuration data available to a broad set of tooling and applicable to a broad set of problems.

Phiera builds on the original Piera work, adding:

  • Python3 compatibility
  • Support for deep merging
  • Support for configuration as a dict

Installation:

From PyPi:

pip install phiera

From GitHub:

pip install git+https://github.com/Nike-Inc/phiera#egg=phiera

Manually

git clone git@github.com/Nike-Inc/phiera.git
cd phiera
poetry install

Usage:

import phiera

h = phiera.Hiera("my_hiera.yaml")

# You can use phiera to simply interact with your structured Hiera data

# key: 'value'
assert h.get("key") == "value"

# key_alias: '%{alias('key')}'
assert h.get("key_alias") == "value"

# key_hiera: 'OHAI %{hiera('key_alias')}'
assert h.get("key_hiera") == "OHAI value"

# Give phiera context
assert h.get("my_context_based_key", name='test01', environment='qa') == "context is great!"

Unit Tests:

poetry run pytest --cov-report=html --cov=phiera --cov-fail-under=80 tests/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

phiera-2.1.0.tar.gz (10.3 kB view hashes)

Uploaded Source

Built Distribution

phiera-2.1.0-py3-none-any.whl (11.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page