Last active
April 27, 2018 03:53
-
-
Save nottrobin/9e7ff961cc6c00a65c61 to your computer and use it in GitHub Desktop.
Get the machine number for the first unit of a juju service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Get the machine number for the first unit of a juju service | |
# Requires: | |
# - `jq` (http://stedolan.github.io/jq/) | |
# Usage: | |
# $ juju-machine-number.sh my-awesome-service | |
# 12 | |
service_name=${1} | |
juju status --format json | jq -r '.services|.["'${service_name}'"]|.["units"]|.["'${service_name}'/0"]|.["machine"]' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A more proper way: