Ubuntu Pastebin

Paste from Cory at Tue, 29 Mar 2016 19:08:33 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
#!/usr/bin/python

import os
import json
import subprocess

with open(os.devnull, 'w') as devnull:
    try:
        status = json.loads(subprocess.check_output(
            ['/usr/bin/env', 'juju', 'status', '--format=json'],
            stderr=devnull))
    except subprocess.CalledProcessError:
        print "-"
    else:
        print len(status["machines"]) - 1
Download as text