Skip to main content

Convert Kea DHCP leases to JSON format

Project description

Kea Leases to JSON

A Python tool to convert ISC Kea DHCP leases files to JSON format.
Supports both IPv4 and IPv6 leases. Includes a directory watcher for real-time conversion.

Features

  • Converts Kea leases CSV files to JSON
  • Handles both IPv4 and IPv6 addresses
  • Watches a directory for changes and updates the JSON output automatically
  • Command-line interface

Installation

You can install the latest release from PyPI:

pip install kea-leases-to-json

Or, to install from source:

git clone https://github.com/yourusername/kea-leases-to-json.git
cd kea-leases-to-json
pip install .

Usage

After installation, you can use the command-line tool:

kea-leases-to-json /path/to/kea/leases/dir /path/to/output.json

Options

  • source_dir (required): Directory containing Kea lease CSV files
  • target_file (required): Output JSON file path
  • --extension: File extension to look for (default: .csv)
  • --log-level: Logging level - choices: DEBUG, INFO, WARNING, ERROR, CRITICAL (default: INFO)
  • --single-run: Run once and exit, useful for testing. By default, the script starts a watcher for any file changes
  • --daemonize: Run the process as a daemon in the background (only works when not in single-run mode)
  • --pid: PID file path for the daemon process (default: /var/run/kea_leases_to_json.pid)

Example

kea-leases-to-json \
  ./leases \
  ./leases.json \
  --extension .csv \
  --log-level DEBUG \
  --single-run

CI & Test Coverage

Test Status codecov

The test suite is run automatically on every push and pull request using GitHub Actions. Coverage results are uploaded to Codecov and displayed above.

To run tests and check coverage locally:

pytest --cov=kea_leases_to_json --cov-report=term

License

This project is licensed under the GNU GPL v3.

Contributing

Pull requests

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

kea_leases_to_json-0.1.3.tar.gz (21.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kea_leases_to_json-0.1.3-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

File details

Details for the file kea_leases_to_json-0.1.3.tar.gz.

File metadata

  • Download URL: kea_leases_to_json-0.1.3.tar.gz
  • Upload date:
  • Size: 21.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for kea_leases_to_json-0.1.3.tar.gz
Algorithm Hash digest
SHA256 f8ad0007d867d0c93466dda74e2022798b411e4ca5a274f17842175903b13140
MD5 a49e96152c9338464f7a7fa59876118c
BLAKE2b-256 fb4437cf63080d19efcadec19cfae5c4393211fb840395fe4fa13b3f45a312f0

See more details on using hashes here.

Provenance

The following attestation bundles were made for kea_leases_to_json-0.1.3.tar.gz:

Publisher: publish.yml on cjuniorfox/kea-leases-to-json

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kea_leases_to_json-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for kea_leases_to_json-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f476f6ad25cddea7851eea2ffc49f45dd426c5a81b3c61076e3c32b9a56d8153
MD5 37fc3e591368b726b4a246e23ac5900e
BLAKE2b-256 5b0c6d44b5ff15c0b770429ecdb24e0cf1c04daeeb039972614ce2af5b5374fb

See more details on using hashes here.

Provenance

The following attestation bundles were made for kea_leases_to_json-0.1.3-py3-none-any.whl:

Publisher: publish.yml on cjuniorfox/kea-leases-to-json

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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