Repository navigation
Expand file tree
/
Copy pathtaskcat.py
More file actions
executable file
·58 lines (48 loc) · 1.77 KB
/
Copy pathtaskcat.py
File metadata and controls
executable file
·58 lines (48 loc) · 1.77 KB
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
#!/usr/bin/env python
# authors:
# Tony Vattathil [email protected], [email protected]
# Shivansh Singh [email protected],
# Santiago Cardenas [email protected],
# Jay McConnell, [email protected]
"""
Program License: Amazon License
Python Class License: Apache 2.0
"""
from __future__ import print_function
import taskcat
import yaml
import sys
if sys.version_info[0] < 3:
raise Exception("Please use Python 3")
def main():
tcat_instance = taskcat.TaskCat()
tcat_instance.welcome('taskcat')
# Initialize cli interface
# :TODO Add RestFull Interface
args = tcat_instance.interface
# Get configuration from command line arg (-c)
tcat_instance.set_config(args.config_yml)
# tcat_instance.set_config('ci/config.yml')
# Get API Handle - Try all know auth
tcat_instance.aws_api_init(args)
# Optional: Enables verbose output by default (DEBUG ON)
tcat_instance.verbose = True
# --Begin
# Check for valid ymal and required keys in config
if args.config_yml is not None:
test_list = tcat_instance.validate_yaml(args.config_yml)
# Load yaml into local taskcat config
with open(tcat_instance.get_config(), 'r') as cfg:
taskcat_cfg = yaml.safe_load(cfg.read())
cfg.close()
tcat_instance.stage_in_s3(taskcat_cfg)
tcat_instance.validate_template(taskcat_cfg, test_list)
tcat_instance.validate_parameters(taskcat_cfg, test_list)
# instance.stackcreate returns testdata object
# 'tag' can be replace with only alphanumeric values
testdata = tcat_instance.stackcreate(taskcat_cfg, test_list, 'tag')
tcat_instance.get_stackstatus(testdata, 5)
tcat_instance.createreport(testdata, 'index.html')
tcat_instance.cleanup(testdata, 5)
# --End
main()