Ubuntu Pastebin

Paste from Nate Finch at Fri, 22 May 2015 02:05:51 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
def main():
    args = parse_args()
    log_dir = args.logs
    try:
        setup_juju_path(args.juju_path)
        client = make_client(args.juju_path, args.debug, args.env_name,
                             args.temp_env_name)
        juju_home = get_juju_home()
        ensure_deleted(get_jenv_path(juju_home, client.env.environment))
        with temp_bootstrap_env(juju_home, client):
            client.bootstrap()
        bootstrap_host = get_machine_dns_name(client, 0)
        try:
            try:
                client.get_status(60)
            except CannotConnectEnv:
                print("Status got Unable to connect to env.  Retrying...")
                client.get_status(60)
            client.wait_for_started()
            client.juju("deploy", ('local:trusty/fill-logs',))
            client.wait_for_started(60)

            test_unit_rotation(client)
            test_machine_rotation(client)
        except Exception as e:
            try:
                if bootstrap_host is None:
                    bootstrap_host = parse_new_state_server_from_error(e)
                dump_env_logs(client, bootstrap_host, log_dir)
            except Exception as e2:
                # make sure we don't mask the original exception if this stuff fails.
                print_now("exception while dumping logs:\n")
                logging.exception(e2)
            raise
        finally:
            client.destroy_environment()
    except Exception as e3:
        print_now("\nEXCEPTION CAUGHT:\n")
        logging.exception(e3)
        if getattr(e3, 'output', None):
            print_now('\n')
            print_now(e.output)
        print_now("\nFAIL")
        sys.exit(1)
Download as text