-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgaedeployer.py
executable file
·91 lines (68 loc) · 2.89 KB
/
gaedeployer.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/usr/bin/env python
"""
For help/usage run: python shell.py -h
"""
import os
import sys
import logging
import argparse
from observer import Observer
from deployer import GAEDeployer
parser = argparse.ArgumentParser(prog='GAE Deployment CLI')
parser.add_argument('-p', '--build_path', default="./",
help='location of current build path, relative to shell script')
parser.add_argument('-s', '--gae_path', default=None,
help='Path to GAE Python SDK')
parser.add_argument('-A', '--app', required=True,
help='The GAE App being Deployed (e.g. <app-name>.appspot.com)')
parser.add_argument('-V', '--app_version', required=True,
help='The GAE app version to use in app.yaml')
parser.add_argument('-m', '--modules', nargs='*', default=[],
help='the GAE Modules. More than one can be listed (e.g. app.yaml)')
parser.add_argument('-v', '--verbose',
dest='verbose', action='store_true',
help='Toggling Verbosity.')
parser.add_argument('-q', '--queue',
dest='queue', action='store_true',
help='Toggling Queue Uploading.')
parser.add_argument('-i', '--index',
dest='index', action='store_true',
help='Toggling Index Uploading.')
parser.add_argument('-d', '--dispatch',
dest='dispatch', action='store_true',
help='Toggling Dispatch Uploading.')
parser.add_argument('-c', '--cron',
dest='cron', action='store_true',
help='Toggling Cron Uploading.'
)
parser.add_argument('-l', '--make_live',
dest='make_live', action='store_true',
help='Makes this GAE version Default.')
args = parser.parse_args()
def main():
"""
Handles Arguments pass and runs the deployment process for Google App Engine
:return:
"""
# Create an Observer that logs progress updates from the deployment process
class LoggingObserver(Observer):
def observeEvent(self, event):
logging.info('Update: %s at: %s %%', event.type, event.percent)
deployer = GAEDeployer(build_path=args.build_path,
app=args.app,
app_version=args.app_version,
gae_path=args.gae_path,
modules=args.modules or [],
verbose=args.verbose,
queue=args.queue,
index=args.index,
dispatch=args.dispatch,
cron=args.cron,
make_live=args.make_live
)
observer = LoggingObserver()
deployer.subscribe(observer)
deployer.deploy_to_gae()
sys.exit(0)
if __name__ == "__main__":
main() # Calls main