~juju-qa/juju-ci-tools/trunk

« back to all changes in this revision

Viewing changes to run_deployer.py

  • Committer: Curtis Hovey
  • Date: 2016-01-15 03:19:50 UTC
  • mto: This revision was merged to the branch mainline in revision 1222.
  • Revision ID: curtis@canonical.com-20160115031950-n5ty1u9vgyhozvae
Add more introspection.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
from utility import (
19
19
    add_basic_testing_arguments,
20
20
    configure_logging,
 
21
    scoped_environ,
21
22
)
22
23
 
23
24
 
44
45
    return parser.parse_args(argv)
45
46
 
46
47
 
47
 
def check_health(cmd_path, env_name=''):
 
48
def check_health(cmd_path, env_name='', environ=None):
48
49
    """Run the health checker command and raise on error."""
49
50
    try:
50
51
        cmd = (cmd_path, env_name)
51
52
        logging.debug('Calling {}'.format(cmd))
52
 
        sub_output = subprocess.check_output(cmd)
 
53
        with scoped_environ(environ):
 
54
            sub_output = subprocess.check_output(cmd)
53
55
        logging.info('Health check output: {}'.format(sub_output))
54
56
    except OSError as e:
55
57
        logging.error(
88
90
    client.deployer(args.bundle_path, args.bundle_name)
89
91
    client.wait_for_workloads()
90
92
    if args.health_cmd:
91
 
        check_health(args.health_cmd, args.temp_env_name)
 
93
        environ = client._shell_environ()
 
94
        check_health(args.health_cmd, args.temp_env_name, environ)
92
95
    if args.upgrade:
93
96
        client.juju('status', ())
94
97
        if args.upgrade_condition:
97
100
        assess_upgrade(client, args.juju_bin)
98
101
        client.wait_for_workloads()
99
102
        if args.health_cmd:
100
 
            check_health(args.health_cmd, args.temp_env_name)
 
103
            environ = client._shell_environ()
 
104
            check_health(args.health_cmd, args.temp_env_name, environ)
101
105
 
102
106
 
103
107
def main(argv=None):