k2hr3-api 1.0.10 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ChangeLog +24 -0
- package/app.js +7 -4
- package/bin/run.sh +218 -172
- package/bin/watcher +7 -4
- package/bin/www +7 -4
- package/config/default.json +7 -4
- package/config/development.json +7 -4
- package/config/dummyuser.json +8 -5
- package/config/extdata-dummy.sh.templ +12 -9
- package/config/k2hr3-cloud-config.txt.templ +7 -4
- package/config/k2hr3-init-error.sh.templ +8 -5
- package/config/k2hr3-init.sh.templ +127 -207
- package/config/keystone_v2.json +7 -4
- package/config/keystone_v3.json +7 -4
- package/lib/basicipcheck.js +7 -4
- package/lib/cacerts.js +7 -4
- package/lib/dbglogging.js +7 -4
- package/lib/dummyuserapi.js +7 -4
- package/lib/ipwatch.js +7 -4
- package/lib/k2hr3acrutil.js +7 -5
- package/lib/k2hr3apiutil.js +7 -4
- package/lib/k2hr3cliutil.js +7 -4
- package/lib/k2hr3config.js +7 -4
- package/lib/k2hr3cryptutil.js +7 -4
- package/lib/k2hr3dkc.js +7 -4
- package/lib/k2hr3extdata.js +7 -4
- package/lib/k2hr3keys.js +7 -4
- package/lib/k2hr3resutil.js +7 -4
- package/lib/k2hr3template.js +7 -4
- package/lib/k2hr3tokens.js +7 -4
- package/lib/k2hr3userdata.js +8 -5
- package/lib/k8soidc.js +41 -16
- package/lib/openstackapiv2.js +7 -4
- package/lib/openstackapiv3.js +7 -4
- package/lib/openstackep.js +7 -4
- package/package.json +73 -72
- package/routes/acr.js +7 -4
- package/routes/debugVerify.js +7 -4
- package/routes/extdata.js +7 -4
- package/routes/list.js +7 -4
- package/routes/policy.js +7 -4
- package/routes/resource.js +7 -4
- package/routes/role.js +7 -4
- package/routes/service.js +7 -4
- package/routes/userTokens.js +7 -4
- package/routes/userdata.js +7 -4
- package/routes/version.js +7 -4
- package/templ/Dockerfile.templ +35 -52
- package/{test → tests}/auto_acr.js +7 -4
- package/{test → tests}/auto_acr_spec.js +7 -4
- package/{test → tests}/auto_all_spec.js +7 -4
- package/{test → tests}/auto_common.js +7 -4
- package/tests/auto_control_subprocess.sh +239 -0
- package/{test → tests}/auto_extdata.js +7 -4
- package/{test → tests}/auto_extdata_spec.js +7 -4
- package/tests/auto_init_config_json.sh +275 -0
- package/{test → tests}/auto_k2hdkc_server.ini +7 -4
- package/{test → tests}/auto_k2hdkc_slave.ini +7 -4
- package/{test → tests}/auto_list.js +7 -4
- package/{test → tests}/auto_list_spec.js +7 -4
- package/{test → tests}/auto_policy.js +7 -4
- package/{test → tests}/auto_policy_spec.js +7 -4
- package/{test → tests}/auto_resource.js +7 -4
- package/{test → tests}/auto_resource_spec.js +7 -4
- package/{test → tests}/auto_role.js +7 -4
- package/{test → tests}/auto_role_spec.js +7 -4
- package/{test → tests}/auto_service.js +7 -4
- package/{test → tests}/auto_service_spec.js +7 -4
- package/{test → tests}/auto_subprocesses.js +14 -11
- package/tests/auto_template.sh +126 -0
- package/{test → tests}/auto_token_util.js +7 -4
- package/{test → tests}/auto_userdata.js +7 -4
- package/{test → tests}/auto_userdata_spec.js +7 -4
- package/{test → tests}/auto_usertokens.js +7 -4
- package/{test → tests}/auto_usertokens_spec.js +7 -4
- package/{test → tests}/auto_version.js +7 -4
- package/{test → tests}/auto_version_spec.js +7 -4
- package/{test → tests}/auto_watcher.js +7 -4
- package/{test → tests}/auto_watcher_spec.js +7 -4
- package/{test → tests}/k2hdkc_test.data +7 -4
- package/tests/k2hdkc_test_load.sh +255 -0
- package/{test → tests}/k2hr3template_test.js +7 -4
- package/tests/k2hr3template_test.sh +339 -0
- package/{test → tests}/k2hr3template_test_async.js +7 -4
- package/{test → tests}/k2hr3template_test_template.result +14 -8
- package/{test → tests}/k2hr3template_test_template.txt +7 -4
- package/{test → tests}/k2hr3template_test_vars.js +7 -4
- package/{test → tests}/manual_acr_delete.js +7 -4
- package/{test → tests}/manual_acr_get.js +7 -4
- package/{test → tests}/manual_acr_postput.js +7 -4
- package/{test → tests}/manual_allusertenant_get.js +7 -4
- package/{test → tests}/manual_extdata_get.js +7 -4
- package/{test → tests}/manual_k2hr3keys_get.js +7 -4
- package/{test → tests}/manual_list_gethead.js +7 -4
- package/{test → tests}/manual_policy_delete.js +7 -4
- package/{test → tests}/manual_policy_gethead.js +7 -4
- package/{test → tests}/manual_policy_postput.js +7 -4
- package/{test → tests}/manual_resource_delete.js +7 -4
- package/{test → tests}/manual_resource_gethead.js +7 -4
- package/{test → tests}/manual_resource_postput.js +7 -4
- package/{test → tests}/manual_role_delete.js +7 -4
- package/{test → tests}/manual_role_gethead.js +7 -4
- package/{test → tests}/manual_role_postput.js +7 -4
- package/{test → tests}/manual_service_delete.js +7 -4
- package/{test → tests}/manual_service_gethead.js +7 -4
- package/{test → tests}/manual_service_postput.js +7 -4
- package/tests/manual_test.sh +338 -0
- package/{test → tests}/manual_userdata_get.js +7 -4
- package/{test → tests}/manual_usertoken_gethead.js +7 -4
- package/{test → tests}/manual_usertoken_postput.js +7 -4
- package/{test → tests}/manual_version_get.js +7 -4
- package/tests/run_local_test_k2hdkc.sh +174 -0
- package/tests/test.sh +331 -0
- package/test/auto_control_subprocess.sh +0 -170
- package/test/auto_init_config_json.sh +0 -246
- package/test/auto_template.sh +0 -127
- package/test/auto_test.sh +0 -321
- package/test/k2hdkc_test_load.sh +0 -198
- package/test/k2hr3template_test.sh +0 -296
- package/test/manual_test.sh +0 -321
- package/test/run_local_test_k2hdkc.sh +0 -154
package/test/manual_test.sh
DELETED
|
@@ -1,321 +0,0 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
#
|
|
3
|
-
# K2HR3 REST API
|
|
4
|
-
#
|
|
5
|
-
# Copyright 2017 Yahoo! Japan Corporation.
|
|
6
|
-
#
|
|
7
|
-
# K2HR3 is K2hdkc based Resource and Roles and policy Rules, gathers
|
|
8
|
-
# common management information for the cloud.
|
|
9
|
-
# K2HR3 can dynamically manage information as "who", "what", "operate".
|
|
10
|
-
# These are stored as roles, resources, policies in K2hdkc, and the
|
|
11
|
-
# client system can dynamically read and modify these information.
|
|
12
|
-
#
|
|
13
|
-
# For the full copyright and license information, please view
|
|
14
|
-
# the license file that was distributed with this source code.
|
|
15
|
-
#
|
|
16
|
-
# AUTHOR: Takeshi Nakatani
|
|
17
|
-
# CREATE: Wed Jun 8 2017
|
|
18
|
-
# REVISION:
|
|
19
|
-
#
|
|
20
|
-
|
|
21
|
-
#
|
|
22
|
-
# Common
|
|
23
|
-
#
|
|
24
|
-
PROGRAM_NAME=`basename $0`
|
|
25
|
-
MYSCRIPTDIR=`dirname $0`
|
|
26
|
-
MYSCRIPTDIR=`cd ${MYSCRIPTDIR}; pwd`
|
|
27
|
-
SRCTOP=`cd ${MYSCRIPTDIR}/..; pwd`
|
|
28
|
-
COMMAND=""
|
|
29
|
-
CMD_PREFIX="manual_"
|
|
30
|
-
CMD_SUFFIX=".js"
|
|
31
|
-
|
|
32
|
-
#
|
|
33
|
-
# Commands
|
|
34
|
-
#
|
|
35
|
-
COMMANDS="
|
|
36
|
-
version_get
|
|
37
|
-
usertoken_gethead
|
|
38
|
-
usertoken_postput
|
|
39
|
-
policy_delete
|
|
40
|
-
policy_gethead
|
|
41
|
-
policy_postput
|
|
42
|
-
resource_delete
|
|
43
|
-
resource_gethead
|
|
44
|
-
resource_postput
|
|
45
|
-
role_delete
|
|
46
|
-
role_gethead
|
|
47
|
-
role_postput
|
|
48
|
-
service_postput
|
|
49
|
-
service_gethead
|
|
50
|
-
service_delete
|
|
51
|
-
acr_postput
|
|
52
|
-
acr_get
|
|
53
|
-
acr_delete
|
|
54
|
-
list_gethead
|
|
55
|
-
userdata_get
|
|
56
|
-
extdata_get
|
|
57
|
-
allusertenant_get
|
|
58
|
-
k2hr3keys_get
|
|
59
|
-
"
|
|
60
|
-
|
|
61
|
-
CheckCommands()
|
|
62
|
-
{
|
|
63
|
-
for command in ${COMMANDS}; do
|
|
64
|
-
if [ "X$1" = "X${command}" ]; then
|
|
65
|
-
echo ${command}
|
|
66
|
-
return
|
|
67
|
-
fi
|
|
68
|
-
done
|
|
69
|
-
echo ""
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
#
|
|
73
|
-
# Usage
|
|
74
|
-
#
|
|
75
|
-
PrintUsage()
|
|
76
|
-
{
|
|
77
|
-
echo "Usage: $1 [--apihost(-a) hostname]"
|
|
78
|
-
echo " [--apiport(-p) port]"
|
|
79
|
-
echo " [--sec(-s) | --https]"
|
|
80
|
-
echo " [--debuglevel(-d) DBG/MSG/WARN/ERR/(custom debug level)]"
|
|
81
|
-
echo " Command-Name"
|
|
82
|
-
echo ""
|
|
83
|
-
echo "Option: --apihost(-a) : Specify k2hr3 API hostname used by this test"
|
|
84
|
-
echo " --apiport(-p) : Specify k2hr3 API port used by this test"
|
|
85
|
-
echo " --sec(-s) : Use HTTPS to access k2hr3 API server"
|
|
86
|
-
echo " --https : Same as '--sec' option"
|
|
87
|
-
echo " --debuglevel(-d) : Specify the level of debug output."
|
|
88
|
-
echo " (DBG/MSG/WARN/ERR/custom debug level)"
|
|
89
|
-
echo ""
|
|
90
|
-
echo "Command: version_get : Get version information"
|
|
91
|
-
echo ""
|
|
92
|
-
echo " usertoken_postput : Get User Token(v1)"
|
|
93
|
-
echo " usertoken_gethead : Get User Token Information(v1)"
|
|
94
|
-
echo ""
|
|
95
|
-
echo " resource_postput : Post(Put) resource(v1)"
|
|
96
|
-
echo " resource_gethead : Get(Head) resource(v1)"
|
|
97
|
-
echo " resource_delete : Delete resource(v1)"
|
|
98
|
-
echo ""
|
|
99
|
-
echo " policy_postput : Post(Put) policy(v1)"
|
|
100
|
-
echo " policy_gethead : Get(Head) policy(v1)"
|
|
101
|
-
echo " policy_delete : Delete policy(v1)"
|
|
102
|
-
echo ""
|
|
103
|
-
echo " role_postput : Post(Put) role(v1)"
|
|
104
|
-
echo " role_gethead : Get(Head) role(v1)"
|
|
105
|
-
echo " role_delete : Delete role(v1)"
|
|
106
|
-
echo ""
|
|
107
|
-
echo " service_postput : Post(Put) service(v1)"
|
|
108
|
-
echo " service_gethead : Get(head) service(v1)"
|
|
109
|
-
echo " service_delete : Delete service(v1)"
|
|
110
|
-
echo ""
|
|
111
|
-
echo " acr_postput : Post(Put) ACR(v1)"
|
|
112
|
-
echo " acr_get : Get ACR(v1)"
|
|
113
|
-
echo " acr_delete : Delete ACR(v1)"
|
|
114
|
-
echo ""
|
|
115
|
-
echo " list_gethead : Get(Head) children list for path(v1)"
|
|
116
|
-
echo ""
|
|
117
|
-
echo " userdata_get : Get userdata for openstack instance(v1)"
|
|
118
|
-
echo ""
|
|
119
|
-
echo " extdata_get : Get extdata for user defined data(v1)"
|
|
120
|
-
echo ""
|
|
121
|
-
echo " allusertenant_get : Get all user and tenant list in k2hr3"
|
|
122
|
-
echo " k2hr3keys_get : Get common key name object for debug"
|
|
123
|
-
echo ""
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
#
|
|
127
|
-
# Parse arguments
|
|
128
|
-
#
|
|
129
|
-
DEBUG_ENV_CUSTOM=""
|
|
130
|
-
DEBUG_ENV_LEVEL=0
|
|
131
|
-
APIPORT=
|
|
132
|
-
APIHOST=
|
|
133
|
-
HTTPS_ENV=
|
|
134
|
-
|
|
135
|
-
while [ $# -ne 0 ]; do
|
|
136
|
-
if [ "X$1" = "X" ]; then
|
|
137
|
-
break
|
|
138
|
-
|
|
139
|
-
elif [ "X$1" = "X--help" -o "X$1" = "X--HELP" -o "X$1" = "X-h" -o "X$1" = "X-H" ]; then
|
|
140
|
-
PrintUsage ${PROGRAM_NAME}
|
|
141
|
-
exit 0
|
|
142
|
-
|
|
143
|
-
elif [ "X$1" = "X--apihost" -o "X$1" = "X--APIHOST" -o "X$1" = "X-a" -o "X$1" = "X-A" ]; then
|
|
144
|
-
#
|
|
145
|
-
# API HOST
|
|
146
|
-
#
|
|
147
|
-
if [ "X${APIHOST}" != "X" ]; then
|
|
148
|
-
echo "ERROR: already specified --apihost option"
|
|
149
|
-
exit 1
|
|
150
|
-
fi
|
|
151
|
-
shift
|
|
152
|
-
if [ $# -eq 0 ]; then
|
|
153
|
-
echo "ERROR: --apihost(-h) option needs parameter(hostname)"
|
|
154
|
-
exit 1
|
|
155
|
-
fi
|
|
156
|
-
APIHOST=$1
|
|
157
|
-
|
|
158
|
-
elif [ "X$1" = "X--apiport" -o "X$1" = "X--APIPORT" -o "X$1" = "X-p" -o "X$1" = "X-P" ]; then
|
|
159
|
-
#
|
|
160
|
-
# API PORT
|
|
161
|
-
#
|
|
162
|
-
if [ "X${APIPORT}" != "X" ]; then
|
|
163
|
-
echo "ERROR: already specified --apiport option"
|
|
164
|
-
exit 1
|
|
165
|
-
fi
|
|
166
|
-
shift
|
|
167
|
-
if [ $# -eq 0 ]; then
|
|
168
|
-
echo "ERROR: --apiport(-p) option needs parameter(port number)"
|
|
169
|
-
exit 1
|
|
170
|
-
fi
|
|
171
|
-
APIPORT=$1
|
|
172
|
-
|
|
173
|
-
elif [ "X$1" = "X--sec" -o "X$1" = "X--SEC" -o "X$1" = "X--https" -o "X$1" = "X--HTTPS" -o "X$1" = "X-s" -o "X$1" = "X-S" ]; then
|
|
174
|
-
if [ "X${HTTPS_ENV}" != "X" ]; then
|
|
175
|
-
echo "ERROR: already specified --sec or --https option"
|
|
176
|
-
exit 1
|
|
177
|
-
fi
|
|
178
|
-
HTTPS_ENV="yes"
|
|
179
|
-
|
|
180
|
-
elif [ "X$1" = "X--debuglevel" -o "X$1" = "X--DEBUGLEVEL" -o "X$1" = "X-d" -o "X$1" = "X-D" ]; then
|
|
181
|
-
#
|
|
182
|
-
# DEBUG option
|
|
183
|
-
#
|
|
184
|
-
shift
|
|
185
|
-
if [ $# -eq 0 ]; then
|
|
186
|
-
echo "ERROR: --debuglevel(-d) option needs parameter(dbg/msg/warn/err)"
|
|
187
|
-
exit 1
|
|
188
|
-
fi
|
|
189
|
-
|
|
190
|
-
if [ "X$1" = "Xdbg" -o "X$1" = "XDBG" -o "X$1" = "Xdebug" -o "X$1" = "XDEBUG" ]; then
|
|
191
|
-
if [ ${DEBUG_ENV_LEVEL} -ne 0 ]; then
|
|
192
|
-
echo "ERROR: --debuglevel(-d) option already is set"
|
|
193
|
-
exit 1
|
|
194
|
-
fi
|
|
195
|
-
if [ ${DEBUG_ENV_LEVEL} -lt 4 ]; then
|
|
196
|
-
DEBUG_ENV_LEVEL=4
|
|
197
|
-
fi
|
|
198
|
-
|
|
199
|
-
elif [ "X$1" = "Xmsg" -o "X$1" = "XMSG" -o "X$1" = "Xmessage" -o "X$1" = "XMESSAGE" -o "X$1" = "Xinfo" -o "X$1" = "XINFO" ]; then
|
|
200
|
-
if [ ${DEBUG_ENV_LEVEL} -ne 0 ]; then
|
|
201
|
-
echo "ERROR: --debuglevel(-d) option already is set"
|
|
202
|
-
exit 1
|
|
203
|
-
fi
|
|
204
|
-
if [ ${DEBUG_ENV_LEVEL} -lt 3 ]; then
|
|
205
|
-
DEBUG_ENV_LEVEL=3
|
|
206
|
-
fi
|
|
207
|
-
|
|
208
|
-
elif [ "X$1" = "Xwarn" -o "X$1" = "XWARN" -o "X$1" = "Xwarning" -o "X$1" = "XWARNING" ]; then
|
|
209
|
-
if [ ${DEBUG_ENV_LEVEL} -ne 0 ]; then
|
|
210
|
-
echo "ERROR: --debuglevel(-d) option already is set"
|
|
211
|
-
exit 1
|
|
212
|
-
fi
|
|
213
|
-
if [ ${DEBUG_ENV_LEVEL} -lt 2 ]; then
|
|
214
|
-
DEBUG_ENV_LEVEL=2
|
|
215
|
-
fi
|
|
216
|
-
|
|
217
|
-
elif [ "X$1" = "Xerr" -o "X$1" = "XERR" -o "X$1" = "Xerror" -o "X$1" = "XERROR" ]; then
|
|
218
|
-
if [ ${DEBUG_ENV_LEVEL} -ne 0 ]; then
|
|
219
|
-
echo "ERROR: --debuglevel(-d) option already is set"
|
|
220
|
-
exit 1
|
|
221
|
-
fi
|
|
222
|
-
if [ ${DEBUG_ENV_LEVEL} -lt 1 ]; then
|
|
223
|
-
DEBUG_ENV_LEVEL=1
|
|
224
|
-
fi
|
|
225
|
-
|
|
226
|
-
else
|
|
227
|
-
if [ "X${DEBUG_ENV_CUSTOM}" != "X" ]; then
|
|
228
|
-
DEBUG_ENV_CUSTOM="${DEBUG_ENV_CUSTOM},"
|
|
229
|
-
fi
|
|
230
|
-
DEBUG_ENV_CUSTOM="${DEBUG_ENV_CUSTOM}$1"
|
|
231
|
-
fi
|
|
232
|
-
|
|
233
|
-
else
|
|
234
|
-
#
|
|
235
|
-
# Run test command
|
|
236
|
-
#
|
|
237
|
-
if [ "X${COMMAND}" != "X" ]; then
|
|
238
|
-
echo "ERROR: Already specified command name(${COMMAND}), could not specify multi command $1"
|
|
239
|
-
exit 1
|
|
240
|
-
fi
|
|
241
|
-
|
|
242
|
-
COMMAND=`CheckCommands $1`
|
|
243
|
-
if [ "X${COMMAND}" = "X" ]; then
|
|
244
|
-
echo "ERROR: $1 is not command name"
|
|
245
|
-
exit 1
|
|
246
|
-
fi
|
|
247
|
-
fi
|
|
248
|
-
shift
|
|
249
|
-
done
|
|
250
|
-
|
|
251
|
-
#
|
|
252
|
-
# Command
|
|
253
|
-
#
|
|
254
|
-
if [ "X${COMMAND}" = "X" ]; then
|
|
255
|
-
echo "ERROR: command name is not specified"
|
|
256
|
-
echo ""
|
|
257
|
-
PrintUsage ${PROGRAM_NAME}
|
|
258
|
-
exit 1
|
|
259
|
-
fi
|
|
260
|
-
|
|
261
|
-
#
|
|
262
|
-
# Make NODE_DEBUG environment
|
|
263
|
-
#
|
|
264
|
-
DEBUG_ENV_PARAM=""
|
|
265
|
-
if [ ${DEBUG_ENV_LEVEL} -ge 4 ]; then
|
|
266
|
-
DEBUG_ENV_PARAM="LOGLEVEL_DBG"
|
|
267
|
-
elif [ ${DEBUG_ENV_LEVEL} -ge 3 ]; then
|
|
268
|
-
DEBUG_ENV_PARAM="LOGLEVEL_MSG"
|
|
269
|
-
elif [ ${DEBUG_ENV_LEVEL} -ge 2 ]; then
|
|
270
|
-
DEBUG_ENV_PARAM="LOGLEVEL_WAN"
|
|
271
|
-
elif [ ${DEBUG_ENV_LEVEL} -ge 1 ]; then
|
|
272
|
-
DEBUG_ENV_PARAM="LOGLEVEL_ERR"
|
|
273
|
-
else
|
|
274
|
-
DEBUG_ENV_PARAM="LOGLEVEL_SILENT"
|
|
275
|
-
fi
|
|
276
|
-
|
|
277
|
-
if [ "X${DEBUG_ENV_CUSTOM}" != "X" ]; then
|
|
278
|
-
if [ "X${DEBUG_ENV_PARAM}" != "X" ]; then
|
|
279
|
-
DEBUG_ENV_PARAM="${DEBUG_ENV_PARAM},"
|
|
280
|
-
fi
|
|
281
|
-
DEBUG_ENV_PARAM="${DEBUG_ENV_PARAM}${DEBUG_ENV_CUSTOM}"
|
|
282
|
-
fi
|
|
283
|
-
|
|
284
|
-
#
|
|
285
|
-
# HTTPS
|
|
286
|
-
#
|
|
287
|
-
if [ "X${HTTPS_ENV}" != "X" ]; then
|
|
288
|
-
HTTPS_ENV="yes"
|
|
289
|
-
fi
|
|
290
|
-
|
|
291
|
-
#
|
|
292
|
-
# K2HR3 API HOST/PORT
|
|
293
|
-
#
|
|
294
|
-
if [ "X${APIHOST}" = "X" ]; then
|
|
295
|
-
APIHOST=`hostname`
|
|
296
|
-
fi
|
|
297
|
-
if [ "X${APIPORT}" = "X" ]; then
|
|
298
|
-
if [ "X${HTTPS_ENV}" != "X" ]; then
|
|
299
|
-
APIPORT=443
|
|
300
|
-
else
|
|
301
|
-
APIPORT=3000
|
|
302
|
-
fi
|
|
303
|
-
fi
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
#
|
|
307
|
-
# Executing
|
|
308
|
-
#
|
|
309
|
-
cd ${SRCTOP}
|
|
310
|
-
if [ ${DEBUG_ENV_LEVEL} -ge 4 ]; then
|
|
311
|
-
echo "***** RUN *****"
|
|
312
|
-
echo "NODE_PATH=${NODE_PATH} NODE_DEBUG=${DEBUG_ENV_PARAM} APIHOST=${APIHOST} APIPORT=${APIPORT} HTTPS_ENV=${HTTPS_ENV} node ${DEBUG_OPTION} test/${CMD_PREFIX}${COMMAND}${CMD_SUFFIX}"
|
|
313
|
-
echo "***************"
|
|
314
|
-
fi
|
|
315
|
-
NODE_PATH=${NODE_PATH} NODE_DEBUG=${DEBUG_ENV_PARAM} APIHOST=${APIHOST} APIPORT=${APIPORT} HTTPS_ENV=${HTTPS_ENV} node ${DEBUG_OPTION} test/${CMD_PREFIX}${COMMAND}${CMD_SUFFIX}
|
|
316
|
-
|
|
317
|
-
#
|
|
318
|
-
# VIM modelines
|
|
319
|
-
#
|
|
320
|
-
# vim:set ts=4 fenc=utf-8:
|
|
321
|
-
#
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
#!/bin/sh
|
|
2
|
-
#
|
|
3
|
-
# K2HR3 REST API
|
|
4
|
-
#
|
|
5
|
-
# Copyright 2017 Yahoo! Japan Corporation.
|
|
6
|
-
#
|
|
7
|
-
# K2HR3 is K2hdkc based Resource and Roles and policy Rules, gathers
|
|
8
|
-
# common management information for the cloud.
|
|
9
|
-
# K2HR3 can dynamically manage information as "who", "what", "operate".
|
|
10
|
-
# These are stored as roles, resources, policies in K2hdkc, and the
|
|
11
|
-
# client system can dynamically read and modify these information.
|
|
12
|
-
#
|
|
13
|
-
# For the full copyright and license information, please view
|
|
14
|
-
# the license file that was distributed with this source code.
|
|
15
|
-
#
|
|
16
|
-
# AUTHOR: Takeshi Nakatani
|
|
17
|
-
# CREATE: Wed Dec 27 2017
|
|
18
|
-
# REVISION:
|
|
19
|
-
#
|
|
20
|
-
|
|
21
|
-
#
|
|
22
|
-
# Common
|
|
23
|
-
#
|
|
24
|
-
PROGRAM_NAME=`basename $0`
|
|
25
|
-
MYSCRIPTDIR=`dirname $0`
|
|
26
|
-
MYSCRIPTDIR=`cd ${MYSCRIPTDIR}; pwd`
|
|
27
|
-
SRCTOP=`cd ${MYSCRIPTDIR}/..; pwd`
|
|
28
|
-
|
|
29
|
-
#
|
|
30
|
-
# Parse arguments
|
|
31
|
-
#
|
|
32
|
-
IS_SCRIPT_MODE=0
|
|
33
|
-
KEYWORD=""
|
|
34
|
-
|
|
35
|
-
while [ $# -ne 0 ]; do
|
|
36
|
-
if [ "X$1" = "X" ]; then
|
|
37
|
-
break
|
|
38
|
-
|
|
39
|
-
elif [ "X$1" = "X--help" -o "X$1" = "X--HELP" -o "X$1" = "X-h" -o "X$1" = "X-H" ]; then
|
|
40
|
-
echo "Usage: ${PROGRAM_NAME} [--key(-k) keyword(group name for control)] [start | stop]"
|
|
41
|
-
exit 0
|
|
42
|
-
|
|
43
|
-
elif [ "X$1" = "X--key" -o "X$1" = "X--KEY" -o "X$1" = "X-k" -o "X$1" = "X-K" ]; then
|
|
44
|
-
shift
|
|
45
|
-
if [ $# -eq 0 ]; then
|
|
46
|
-
echo "ERROR: --key(-k) option needs parameter"
|
|
47
|
-
exit 1
|
|
48
|
-
fi
|
|
49
|
-
if [ "X${KEYWORD}" != "X" ]; then
|
|
50
|
-
echo "ERROR: already set --key(-k) option"
|
|
51
|
-
exit 1
|
|
52
|
-
fi
|
|
53
|
-
KEYWORD=_$1
|
|
54
|
-
|
|
55
|
-
elif [ "X$1" = "Xstart" -o "X$1" = "XSTART" ]; then
|
|
56
|
-
if [ ${IS_SCRIPT_MODE} -ne 0 ]; then
|
|
57
|
-
echo "ERROR: already specified start or stop"
|
|
58
|
-
exit 1
|
|
59
|
-
fi
|
|
60
|
-
IS_SCRIPT_MODE=1
|
|
61
|
-
|
|
62
|
-
elif [ "X$1" = "Xstop" -o "X$1" = "XSTOP" ]; then
|
|
63
|
-
if [ ${IS_SCRIPT_MODE} -ne 0 ]; then
|
|
64
|
-
echo "ERROR: already specified start or stop"
|
|
65
|
-
exit 1
|
|
66
|
-
fi
|
|
67
|
-
IS_SCRIPT_MODE=2
|
|
68
|
-
|
|
69
|
-
else
|
|
70
|
-
echo "ERROR: unknown option $1"
|
|
71
|
-
exit 1
|
|
72
|
-
fi
|
|
73
|
-
shift
|
|
74
|
-
done
|
|
75
|
-
|
|
76
|
-
if [ ${IS_SCRIPT_MODE} -eq 0 ]; then
|
|
77
|
-
echo "ERROR: must specify start or stop"
|
|
78
|
-
exit 1
|
|
79
|
-
fi
|
|
80
|
-
|
|
81
|
-
if [ ${IS_SCRIPT_MODE} -eq 1 ]; then
|
|
82
|
-
#
|
|
83
|
-
# Start
|
|
84
|
-
#
|
|
85
|
-
echo "*** Start : chmpx server node for k2hdkc"
|
|
86
|
-
echo -n " "
|
|
87
|
-
${SRCTOP}/test/auto_control_subprocess.sh -start -key server${KEYWORD} -int 3 chmpx -conf ${SRCTOP}/test/auto_k2hdkc_server.ini -ctlport 18021 -d msg
|
|
88
|
-
if [ $? -ne 0 ]; then
|
|
89
|
-
echo "ERROR: could not run chmpx server node for k2hdkc"
|
|
90
|
-
exit 1
|
|
91
|
-
fi
|
|
92
|
-
|
|
93
|
-
echo "*** Start : one k2hdkc process"
|
|
94
|
-
echo -n " "
|
|
95
|
-
${SRCTOP}/test/auto_control_subprocess.sh -start -key server${KEYWORD} -int 3 k2hdkc -conf ${SRCTOP}/test/auto_k2hdkc_server.ini -ctlport 18021 -d msg
|
|
96
|
-
if [ $? -ne 0 ]; then
|
|
97
|
-
echo "ERROR: one k2hdkc process"
|
|
98
|
-
exit 1
|
|
99
|
-
fi
|
|
100
|
-
|
|
101
|
-
echo "*** Start : chmpx slave node for k2hdkc"
|
|
102
|
-
echo -n " "
|
|
103
|
-
${SRCTOP}/test/auto_control_subprocess.sh -start -key slave${KEYWORD} -int 3 chmpx -conf ${SRCTOP}/test/auto_k2hdkc_slave.ini -ctlport 18031 -d msg
|
|
104
|
-
if [ $? -ne 0 ]; then
|
|
105
|
-
echo "ERROR: chmpx slave node for k2hdkc"
|
|
106
|
-
exit 1
|
|
107
|
-
fi
|
|
108
|
-
|
|
109
|
-
echo "*** Start : load default test data to k2hdkc"
|
|
110
|
-
echo -n " "
|
|
111
|
-
${SRCTOP}/test/k2hdkc_test_load.sh --for_auto_test
|
|
112
|
-
if [ $? -ne 0 ]; then
|
|
113
|
-
echo "ERROR: load default test data to k2hdkc"
|
|
114
|
-
exit 1
|
|
115
|
-
fi
|
|
116
|
-
|
|
117
|
-
else
|
|
118
|
-
#
|
|
119
|
-
# Stop
|
|
120
|
-
#
|
|
121
|
-
echo "*** Stop : chmpx slave node for k2hdkc"
|
|
122
|
-
echo -n " "
|
|
123
|
-
${SRCTOP}/test/auto_control_subprocess.sh -stop -key slave${KEYWORD} -int 3 chmpx
|
|
124
|
-
if [ $? -ne 0 ]; then
|
|
125
|
-
echo "ERROR: chmpx slave node for k2hdkc"
|
|
126
|
-
exit 1
|
|
127
|
-
fi
|
|
128
|
-
|
|
129
|
-
echo "*** Stop : one k2hdkc process"
|
|
130
|
-
echo -n " "
|
|
131
|
-
${SRCTOP}/test/auto_control_subprocess.sh -stop -key server${KEYWORD} -int 3 k2hdkc
|
|
132
|
-
if [ $? -ne 0 ]; then
|
|
133
|
-
echo "ERROR: one k2hdkc process"
|
|
134
|
-
exit 1
|
|
135
|
-
fi
|
|
136
|
-
|
|
137
|
-
echo "*** Stop : chmpx server node for k2hdkc"
|
|
138
|
-
echo -n " "
|
|
139
|
-
${SRCTOP}/test/auto_control_subprocess.sh -stop -key server${KEYWORD} -int 3 chmpx
|
|
140
|
-
if [ $? -ne 0 ]; then
|
|
141
|
-
echo "ERROR: could not run chmpx server node for k2hdkc"
|
|
142
|
-
exit 1
|
|
143
|
-
fi
|
|
144
|
-
fi
|
|
145
|
-
|
|
146
|
-
echo ""
|
|
147
|
-
echo "SUCCEED: finished"
|
|
148
|
-
exit 0
|
|
149
|
-
|
|
150
|
-
#
|
|
151
|
-
# VIM modelines
|
|
152
|
-
#
|
|
153
|
-
# vim:set ts=4 fenc=utf-8:
|
|
154
|
-
#
|