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

1183.2.2 by Martin Packman
Update assess template and add new-assess makefile target
1
#!/usr/bin/env python
2
"""TODO: add rough description of what is assessed in this module."""
3
979.3.1 by Horacio Durán
Added CI tests for status.
4
from __future__ import print_function
5
1183.2.2 by Martin Packman
Update assess template and add new-assess makefile target
6
import argparse
7
import logging
8
import sys
1031.1.1 by Curtis Hovey
Remove helper that prevented custom arguments.
9
979.3.1 by Horacio Durán
Added CI tests for status.
10
from deploy_stack import (
1169.3.5 by John George
Use BootstrapManager from template_assess.py.tmpl
11
    BootstrapManager,
979.3.5 by Horacio Durán
Addressed curtis observations.
12
)
1031.1.1 by Curtis Hovey
Remove helper that prevented custom arguments.
13
from utility import (
1183.2.2 by Martin Packman
Update assess template and add new-assess makefile target
14
    add_basic_testing_arguments,
15
    configure_logging,
1031.1.1 by Curtis Hovey
Remove helper that prevented custom arguments.
16
)
17
979.3.5 by Horacio Durán
Addressed curtis observations.
18
1326.1.3 by Aaron Bentley
Fix lint in template
19
__metaclass__ = type
20
21
1183.2.2 by Martin Packman
Update assess template and add new-assess makefile target
22
log = logging.getLogger("assess_TEMPLATE")
23
24
25
def assess_TEMPLATE(client):
26
    # Deploy charms, there are several under ./repository
1434.1.1 by Aaron Bentley
Update templates to current best practises.
27
    client.deploy('local:trusty/my-charm')
1183.2.2 by Martin Packman
Update assess template and add new-assess makefile target
28
    # Wait for the deployment to finish.
29
    client.wait_for_started()
1183.2.4 by Martin Packman
Log via the local logger in template
30
    log.info("TODO: Add log line about any test")
1183.2.2 by Martin Packman
Update assess template and add new-assess makefile target
31
    # TODO: Add specific functional testing actions here.
32
33
34
def parse_args(argv):
979.3.1 by Horacio Durán
Added CI tests for status.
35
    """Parse all arguments."""
1183.2.2 by Martin Packman
Update assess template and add new-assess makefile target
36
    parser = argparse.ArgumentParser(description="TODO: script info")
37
    # TODO: Add additional positional arguments.
1031.1.1 by Curtis Hovey
Remove helper that prevented custom arguments.
38
    add_basic_testing_arguments(parser)
1183.2.2 by Martin Packman
Update assess template and add new-assess makefile target
39
    # TODO: Add additional optional arguments.
40
    return parser.parse_args(argv)
41
42
43
def main(argv=None):
44
    args = parse_args(argv)
45
    configure_logging(args.verbose)
1169.3.5 by John George
Use BootstrapManager from template_assess.py.tmpl
46
    bs_manager = BootstrapManager.from_args(args)
47
    with bs_manager.booted_context(args.upload_tools):
1183.2.2 by Martin Packman
Update assess template and add new-assess makefile target
48
        assess_TEMPLATE(bs_manager.client)
49
    return 0
979.3.1 by Horacio Durán
Added CI tests for status.
50
51
52
if __name__ == '__main__':
1183.2.2 by Martin Packman
Update assess template and add new-assess makefile target
53
    sys.exit(main())