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

« back to all changes in this revision

Viewing changes to jujuci.py

  • Committer: Aaron Bentley
  • Date: 2016-03-18 14:47:06 UTC
  • mto: This revision was merged to the branch mainline in revision 1324.
  • Revision ID: aaron.bentley@canonical.com-20160318144706-z7wy9c21m3psi6g5
Introduce set_model_name, update tests, check controller on bootstrap.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
from deploy_stack import destroy_environment
19
19
from jujuconfig import NoSuchEnvironment
20
20
from jujupy import (
21
 
    client_from_config,
 
21
    SimpleEnvironment,
 
22
    EnvJujuClient,
22
23
)
23
24
try:
24
25
    from lsb_release import get_distro_information
222
223
 
223
224
def clean_environment(env_name, verbose=False):
224
225
    try:
225
 
        client = client_from_config(env_name, None)
 
226
        env = SimpleEnvironment.from_config(env_name)
226
227
    except NoSuchEnvironment as e:
227
228
        # Nothing to do.
228
229
        if verbose:
229
230
            print_now(str(e))
230
231
        return False
 
232
    client = EnvJujuClient.by_version(env)
231
233
    if verbose:
232
234
        print_now("Destroying %s" % env_name)
233
235
    destroy_environment(client, env_name)