-
Notifications
You must be signed in to change notification settings - Fork 26
/
docker-entrypoint.py
executable file
·137 lines (118 loc) · 3.72 KB
/
docker-entrypoint.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
#!/usr/bin/env python3
# Single entry point / dispatcher for simplified running of pxpy bin
# apps
import argparse
import os
import pudb
str_desc = """
NAME
docker-entrypoint.py
SYNOPSIS
docker-entrypoint.py [optional cmd args for each sub-module]
DESCRIPTION
'docker-entrypoint.py' is the main entrypoint for running pypx
containerized apps.
"""
def pxdispatch_do(str_appName, args, unknown):
str_otherArgs = ' '.join(unknown)
str_CMD = "/usr/local/bin/%s %s" % (str_appName, str_otherArgs)
return str_CMD
parser = argparse.ArgumentParser(description = str_desc)
parser.add_argument(
'--px-do',
action = 'store_true',
dest = 'b_pxdo',
default = False,
help = 'if specified, indicates running px-do.',
)
parser.add_argument(
'--px-echo',
action = 'store_true',
dest = 'b_pxecho',
default = False,
help = 'if specified, indicates running px-echo.',
)
parser.add_argument(
'--px-find',
action = 'store_true',
dest = 'b_pxfind',
default = False,
help = 'if specified, indicates running px-find.',
)
parser.add_argument(
'--px-move',
action = 'store_true',
dest = 'b_pxmove',
default = False,
help = 'if specified, indicates running px-move.',
)
parser.add_argument(
'--px-push',
action = 'store_true',
dest = 'b_pxpush',
default = False,
help = 'if specified, indicates running px-push.',
)
parser.add_argument(
'--px-register',
action = 'store_true',
dest = 'b_pxregister',
default = False,
help = 'if specified, indicates running px-register.',
)
parser.add_argument(
'--px-repack',
action = 'store_true',
dest = 'b_pxrepack',
default = False,
help = 'if specified, indicates running px-repack.',
)
parser.add_argument(
'--px-report',
action = 'store_true',
dest = 'b_pxreport',
default = False,
help = 'if specified, indicates running px-report.',
)
parser.add_argument(
'--px-status',
action = 'store_true',
dest = 'b_pxstatus',
default = False,
help = 'if specified, indicates running px-status.',
)
parser.add_argument(
'--pfstorage',
action = 'store_true',
dest = 'b_pfstorage',
default = False,
help = 'if specified, indicates running pfstorage.',
)
parser.add_argument(
'--px-smdb',
action = 'store_true',
dest = 'b_pxsmdb',
default = False,
help = 'if specified, indicates running px-smdb.',
)
args, unknown = parser.parse_known_args()
if __name__ == '__main__':
fname = 'pxdispatch_do("px-find",args, unknown)'
os.system("/dock/storescp.sh -p 11113 &")
if args.b_pxdo: fname = 'pxdispatch_do("px-do", args, unknown)'
if args.b_pxecho: fname = 'pxdispatch_do("px-echo", args, unknown)'
if args.b_pxfind: fname = 'pxdispatch_do("px-find", args, unknown)'
if args.b_pxmove: fname = 'pxdispatch_do("px-move", args, unknown)'
if args.b_pxpush: fname = 'pxdispatch_do("px-push", args, unknown)'
if args.b_pxregister: fname = 'pxdispatch_do("px-register", args, unknown)'
if args.b_pxrepack: fname = 'pxdispatch_do("px-repack", args, unknown)'
if args.b_pxreport: fname = 'pxdispatch_do("px-report", args, unknown)'
if args.b_pxstatus: fname = 'pxdispatch_do("px-status", args, unknown)'
if args.b_pfstorage: fname = 'pxdispatch_do("pfstorage", args, unknown)'
if args.b_pxsmdb: fname = 'pxdispatch_do("px-smdb", args, unknown)'
try:
str_cmd = eval(fname)
# print(str_cmd)
os.system(str_cmd)
except:
print("Misunderstood container app... exiting.")