~1chb1n/mojo/eoan

« back to all changes in this revision

Viewing changes to mojo/juju/status.py

  • Committer: Ryan Beisner
  • Date: 2018-01-26 23:13:11 UTC
  • mfrom: (462.1.12 mojo3)
  • Revision ID: ryan.beisner@canonical.com-20180126231311-4bsirj5x6ajvhbv8
[chris.macnaughton, r=1chb1n] Additional py3 run time fixes for mojo

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
import subprocess
5
5
import time
6
6
import yaml
 
7
import six
7
8
 
8
9
from collections import Counter
9
10
 
12
13
try:
13
14
    with open(os.devnull, 'w') as devnull:
14
15
        version = subprocess.check_output(['juju', 'version'], stderr=devnull)
 
16
        if six.PY3:
 
17
            version = version.decode('utf-8')
15
18
    major_version = int(version[0])
16
19
except subprocess.CalledProcessError:
17
20
    # In cases where the Juju Status yaml is provided by a file this may legitimately fail
463
466
        # self.ready() will raise exceptions on error states
464
467
        if self.ready() or not wait_for_steady:
465
468
            return
466
 
 
467
469
        logging.info("Waiting for environment to reach steady state")
468
470
        wait(max_wait=timeout)
469
471
        logging.info("Environment has reached steady state")