forked from aws-solutions/edit-in-the-cloud-on-aws
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure
executable file
·82 lines (69 loc) · 3.65 KB
/
configure
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/env python3
import csv
import argparse
CUSTOM_MK = "custom.mk"
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Configures the environment vars for the Makefile')
parser.add_argument("usecase", \
help="Cloud Video Editing Usecase", choices=[\
'consolidated_with_SGW', \
'consolidated_with_FSX', \
'edit_host_only', \
'FSX_env_with_existing_AD', \
'SGW_env_with_existing_AD'])
parser.add_argument("--stack_name", help="Cloudformation Stack Name")
parser.add_argument("--stack_prefix", help="Cloudformation Stack Prefix")
parser.add_argument("--region", help="AWS Region")
parser.add_argument("--aws_profile", help="AWS Profile")
parser.add_argument("--s3_bucket", \
help="S3 Bucket to host Cloudformation templates")
parser.add_argument("--s3_key", \
help="S3 Prefix/Key to host Cloudformation templates")
parser.add_argument("--timeout", \
help="Timeout (in mins) to wait for Cloudformation to complete")
args = parser.parse_args()
print("Processing Custom Variables for make ...")
with open(CUSTOM_MK, "w") as fout:
write_sequence = ""
if args.stack_name:
write_sequence += "%s = %s\n" % ("STACK_NAME", args.stack_name)
if args.stack_prefix:
write_sequence += "%s = %s\n" % ("STACKPREFIX", args.stack_prefix)
if args.region:
write_sequence += "%s = %s\n" % ("REGION", args.region)
if args.aws_profile:
write_sequence += "%s = %s\n" % ("PROFILE", args.aws_profile)
if args.s3_bucket:
write_sequence += "%s = %s\n" % ("CFN_BUCKET", args.s3_bucket)
if args.s3_key:
write_sequence += "%s = %s\n" % ("CFN_KEY", args.s3_key)
if args.timeout:
write_sequence += "%s = %s\n" % ("TIMEOUT_IN_MINS", args.timeout)
if args.usecase:
if args.usecase == "consolidated_with_SGW":
write_sequence += "%s = %s\n" % ("CFN_TEMPLATE", \
"templates/cloud-video-editing-master-with-SGW.yaml")
write_sequence += "%s = %s\n" % ("PARAM_FILE", \
"ci/cloud-video-editing-master-with-SGW.json")
elif args.usecase == "consolidated_with_FSX":
write_sequence += "%s = %s\n" % ("CFN_TEMPLATE", \
"templates/cloud-video-editing-master-with-FSX.yaml")
write_sequence += "%s = %s\n" % ("PARAM_FILE", \
"ci/cloud-video-editing-master-with-FSX.json")
elif args.usecase == "edit_host_only":
write_sequence += "%s = %s\n" % ("CFN_TEMPLATE", \
"templates/cloud-video-editing-edit-host.yaml")
write_sequence += "%s = %s\n" % ("PARAM_FILE", \
"ci/cloud-video-editing-edit-host.json")
elif args.usecase == "FSX_env_with_existing_AD":
write_sequence += "%s = %s\n" % ("CFN_TEMPLATE", \
"templates/cloud-video-editing-FSX-with-existing-AD.yaml")
write_sequence += "%s = %s\n" % ("PARAM_FILE", \
"ci/cloud-video-editing-FSX-with-existing-AD.json")
elif args.usecase == "SGW_env_with_existing_AD":
write_sequence += "%s = %s\n" % ("CFN_TEMPLATE", \
"templates/cloud-video-editing-SGW-with-existing-AD.yaml")
write_sequence += "%s = %s\n" % ("PARAM_FILE", \
"ci/cloud-video-editing-SGW-with-existing-AD.json")
fout.writelines(write_sequence)
print("Configure completed - Run 'make' or 'make help' next!")