~abentley/juju-ci-tools/client-from-config-4

« back to all changes in this revision

Viewing changes to chaos.py

  • Committer: Curtis Hovey
  • Date: 2015-12-20 15:14:05 UTC
  • Revision ID: curtis@canonical.com-20151220151405-pm3dauunjr2978gz
skip any client-server that starts with 1.26.

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
import subprocess
11
11
import sys
12
12
 
13
 
from jujucharm import (
14
 
    local_charm_path,
15
 
)
16
13
from remote import remote_from_unit
17
14
from utility import (
18
15
    until_timeout,
80
77
        if self.machine:
81
78
            logging.debug(
82
79
                'Deploying ubuntu to machine {}.'.format(self.machine))
83
 
            charm = local_charm_path(
84
 
                charm='ubuntu', juju_ver=self.client.version)
85
 
            self.client.deploy(charm, to=self.machine)
 
80
            self.client.deploy('ubuntu', to=self.machine)
86
81
        logging.debug('Deploying local:chaos-monkey.')
87
 
        charm = local_charm_path(
88
 
            charm='chaos-monkey', juju_ver=self.client.version)
89
 
        self.client.deploy(charm)
 
82
        self.client.deploy('local:chaos-monkey')
90
83
        logging.debug('Relating chaos-monkey to {}.'.format(self.service))
91
84
        self.client.juju('add-relation', (self.service, 'chaos-monkey'))
92
85
        logging.debug('Waiting for services to start.')
110
103
            args = args + (enablement_arg,)
111
104
            if monkey_id is not None:
112
105
                args = args + ('monkey-id={}'.format(monkey_id),)
113
 
 
114
 
            id = self.client.action_do(*args)
 
106
            action_out = self.client.get_juju_output('action do', *args)
 
107
            if not action_out.startswith('Action queued with id'):
 
108
                raise Exception(
 
109
                    'Unexpected output from "juju action do": {}'.format(
 
110
                        action_out))
 
111
            logging.info(action_out)
115
112
            if not self.monkey_ids.get(unit_name):
 
113
                id = action_out.split().pop()
116
114
                logging.info('Setting the monkey-id for {} to: {}'.format(
117
115
                    unit_name, id))
118
116
                self.monkey_ids[unit_name] = id