Skip to main content

Juju-doctor is a pypi package which helps validate Juju deployments using probes.

Project description

juju-doctor

You deploy, we validate, you fix :)

Probes

Run a sample show-unit probe with:

  1. On a live model juju show-unit grafana/0 | ./resources/relation_dashboard_uid.py
  2. On a file cat resources/show-unit.yaml | ./resources/relation_dashboard_uid.py

Run that same probe with juju-doctor:

  1. On a live model
juju-doctor check \
    --probe "file://tests/resources/show-unit/relation_dashboard_uid.py" \
    --model "grafana"
  1. On a file
juju-doctor check \
    --probe "file://tests/resources/show-unit/relation_dashboard_uid.py" \
    --show-unit "tests/resources/show-unit/show-unit.yaml"

If you want to see more internals, go to src/main.py and change the log level to INFO

Simplest Probe

#!/usr/bin/env python3

import sys
import yaml

def demo_probe(juju_artifact: dict):
    # Your validation goes here
    failure = "you_choose"
    if failure:
        print("failed", file=sys.stderr)
        exit(1)

if __name__ == "__main__":
    juju_artifact = yaml.safe_load(sys.stdin.read())
    demo_probe(juju_artifact)

Demo juju-doctor commands

juju-doctor check --help

juju-doctor check \
    --probe "github://canonical/grafana-k8s-operator//probes/show-unit/relation_dashboard_uid.py" \
    --model "cos"

juju-doctor check \
    --probe "github://canonical/grafana-k8s-operator//probes/show-unit/relation_dashboard_uid.py" \
    --show-unit "tests/resources/show-unit/show-unit.yaml"

juju-doctor check \
    --probe "file://tests/resources/show-unit/relation_dashboard_uid.py" \
    --show-unit "tests/resources/show-unit/show-unit.yaml"

juju-doctor check \
    --probe "file://tests/resources/status" \
    --status "tests/resources/status/gagent-status.yaml"

juju-doctor check \
    --probe "github://canonical/grafana-agent-operator//probes" \
    --status "tests/resources/status/gagent-status.yaml" \
    --bundle "tests/resources/bundle/gagent-bundle.yaml"

Development

git clone https://github.com/canonical/juju-doctor.git
python3 -m venv venv && source venv/bin/activate
pip install -e juju-doctor
juju-doctor check --help

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

juju_doctor-0.1.tar.gz (83.3 kB view details)

Uploaded Source

Built Distribution

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

juju_doctor-0.1-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file juju_doctor-0.1.tar.gz.

File metadata

  • Download URL: juju_doctor-0.1.tar.gz
  • Upload date:
  • Size: 83.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.0

File hashes

Hashes for juju_doctor-0.1.tar.gz
Algorithm Hash digest
SHA256 213511c46b835848775f060985d2176c595ebcac4eb35758e6312753558392f2
MD5 3d19c7596d6e405bfb18c14e040c283a
BLAKE2b-256 1843c31d3ddfe6ea34d35b8dae9e059ca152be2bdac436de05ce221b4a87fd06

See more details on using hashes here.

File details

Details for the file juju_doctor-0.1-py3-none-any.whl.

File metadata

  • Download URL: juju_doctor-0.1-py3-none-any.whl
  • Upload date:
  • Size: 14.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.0

File hashes

Hashes for juju_doctor-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 810a71a88a93c1a8372e66834727bbe5dab13f1c72c8448734c8a14d342786b3
MD5 7e7654fd7e10cec4fd8a4e31eb09f0dc
BLAKE2b-256 c50bc65087075eeff79a5a9fd53d5b543cf599b15251a0c97194f0812a60efe4

See more details on using hashes here.

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