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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file phiera-2.1.0.tar.gz.

File metadata

  • Download URL: phiera-2.1.0.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.1 CPython/3.10.11 Linux/5.15.0-1037-azure

File hashes

Hashes for phiera-2.1.0.tar.gz
Algorithm Hash digest
SHA256 1e6f5ae856cf1af6afddd7bb01c8184afb43bc873b4310f71360aec8e576b810
MD5 819405ca68c367e90c05ea2e07b9d501
BLAKE2b-256 c5aa61d169cb110946daf482564540ef361cbb43d80f9af2d1895e58ec36ac3d

See more details on using hashes here.

File details

Details for the file phiera-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: phiera-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.1 CPython/3.10.11 Linux/5.15.0-1037-azure

File hashes

Hashes for phiera-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3136984461704b6f865c91e7b5ac97411e556f5ebbb50bd82af07c439278a8c2
MD5 b8d3ee2cec9186c1f2df2d2b6120a914
BLAKE2b-256 497301185e5ea8e8154454dd0d1df9daeb03d35e8e625f0c31c344bd3ffeeda5

See more details on using hashes here.

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