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 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.1.tar.gz (83.2 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.1-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: juju_doctor-0.1.1.tar.gz
  • Upload date:
  • Size: 83.2 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.1.tar.gz
Algorithm Hash digest
SHA256 4d9088640f1052f2e8a4801af443ddd10d9232a31e43dd9be473963691cf4f83
MD5 5d7ca17e17bf6f5d6d7a6c1f082b79af
BLAKE2b-256 64f39af75579e6991414e74967b805fd425ebc38586ffd923345e74546e0b396

See more details on using hashes here.

File details

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

File metadata

  • Download URL: juju_doctor-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 14.3 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 41d4b51e9a7ec7b596ec5ba7505506b77a96c58a4b9042efd52aa9b44e19734d
MD5 6c076407caffa32ae0d3ecbc1c0a75c3
BLAKE2b-256 597cfa712d599ea3852d1c59d0769547545c986247c357dc5959a99edd83cf48

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