mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-09 03:57:41 +00:00
Using python to parse the json output from Juju.
This commit is contained in:
parent
5deef09178
commit
dbca4bf5dd
14
cluster/juju/return-node-ips.py
Executable file
14
cluster/juju/return-node-ips.py
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
import json
|
||||||
|
import sys
|
||||||
|
# This script helps parse out the private IP addreses from the
|
||||||
|
# `juju run` command's JSON object, see cluster/juju/util.sh
|
||||||
|
|
||||||
|
if len(sys.argv) > 1:
|
||||||
|
# It takes the JSON output as the first argument.
|
||||||
|
nodes = json.loads(sys.argv[1])
|
||||||
|
# There can be multiple nodes to print the Stdout.
|
||||||
|
for num in nodes:
|
||||||
|
print num['Stdout'].rstrip()
|
||||||
|
else:
|
||||||
|
exit(1)
|
Loading…
Reference in New Issue
Block a user