forked from juju/juju
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathassess_mixed_images.py
executable file
·67 lines (52 loc) · 1.84 KB
/
assess_mixed_images.py
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env python
"""Assess mixed deployment of images from two sets of simplestreams."""
from __future__ import print_function
import argparse
import logging
import sys
from deploy_stack import (
assess_juju_relations,
BootstrapManager,
)
from jujucharm import (
local_charm_path,
)
from utility import (
add_basic_testing_arguments,
configure_logging,
)
__metaclass__ = type
log = logging.getLogger("assess_mixed_images")
def assess_mixed_images(client):
charm_path = local_charm_path(charm='dummy-sink', juju_ver=client.version,
series='centos7', platform='centos')
client.deploy(charm_path)
charm_path = local_charm_path(charm='dummy-source',
juju_ver=client.version, series='trusty')
client.deploy(charm_path)
client.juju('add-relation', ('dummy-source', 'dummy-sink'))
# Wait for the deployment to finish.
client.wait_for_started()
assess_juju_relations(client)
def parse_args(argv):
"""Parse all arguments."""
parser = argparse.ArgumentParser(
description="Deploy images from two sets of simplestreams.")
add_basic_testing_arguments(parser)
# Fallback behaviour fails without --bootstrap-series: Bug 1560625
parser.set_defaults(series='trusty')
parser.add_argument('--image-metadata-url')
return parser.parse_args(argv)
def main(argv=None):
args = parse_args(argv)
configure_logging(args.verbose)
bs_manager = BootstrapManager.from_args(args)
client = bs_manager.client
if args.image_metadata_url is not None:
client.env.update_config('image-metadata-url',
args.image_metadata_url)
with bs_manager.booted_context(args.upload_tools):
assess_mixed_images(bs_manager.client)
return 0
if __name__ == '__main__':
sys.exit(main())