k2hr3-api 1.0.11 → 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.
Files changed (121) hide show
  1. package/ChangeLog +18 -0
  2. package/app.js +7 -4
  3. package/bin/run.sh +218 -172
  4. package/bin/watcher +7 -4
  5. package/bin/www +7 -4
  6. package/config/default.json +7 -4
  7. package/config/development.json +7 -4
  8. package/config/dummyuser.json +8 -5
  9. package/config/extdata-dummy.sh.templ +12 -9
  10. package/config/k2hr3-cloud-config.txt.templ +7 -4
  11. package/config/k2hr3-init-error.sh.templ +8 -5
  12. package/config/k2hr3-init.sh.templ +127 -207
  13. package/config/keystone_v2.json +7 -4
  14. package/config/keystone_v3.json +7 -4
  15. package/lib/basicipcheck.js +7 -4
  16. package/lib/cacerts.js +7 -4
  17. package/lib/dbglogging.js +7 -4
  18. package/lib/dummyuserapi.js +7 -4
  19. package/lib/ipwatch.js +7 -4
  20. package/lib/k2hr3acrutil.js +7 -5
  21. package/lib/k2hr3apiutil.js +7 -4
  22. package/lib/k2hr3cliutil.js +7 -4
  23. package/lib/k2hr3config.js +7 -4
  24. package/lib/k2hr3cryptutil.js +7 -4
  25. package/lib/k2hr3dkc.js +7 -4
  26. package/lib/k2hr3extdata.js +7 -4
  27. package/lib/k2hr3keys.js +7 -4
  28. package/lib/k2hr3resutil.js +7 -4
  29. package/lib/k2hr3template.js +7 -4
  30. package/lib/k2hr3tokens.js +7 -4
  31. package/lib/k2hr3userdata.js +8 -5
  32. package/lib/k8soidc.js +1 -1
  33. package/lib/openstackapiv2.js +7 -4
  34. package/lib/openstackapiv3.js +7 -4
  35. package/lib/openstackep.js +7 -4
  36. package/package.json +73 -72
  37. package/routes/acr.js +7 -4
  38. package/routes/debugVerify.js +7 -4
  39. package/routes/extdata.js +7 -4
  40. package/routes/list.js +7 -4
  41. package/routes/policy.js +7 -4
  42. package/routes/resource.js +7 -4
  43. package/routes/role.js +7 -4
  44. package/routes/service.js +7 -4
  45. package/routes/userTokens.js +7 -4
  46. package/routes/userdata.js +7 -4
  47. package/routes/version.js +7 -4
  48. package/templ/Dockerfile.templ +35 -52
  49. package/{test → tests}/auto_acr.js +7 -4
  50. package/{test → tests}/auto_acr_spec.js +7 -4
  51. package/{test → tests}/auto_all_spec.js +7 -4
  52. package/{test → tests}/auto_common.js +7 -4
  53. package/tests/auto_control_subprocess.sh +239 -0
  54. package/{test → tests}/auto_extdata.js +7 -4
  55. package/{test → tests}/auto_extdata_spec.js +7 -4
  56. package/tests/auto_init_config_json.sh +275 -0
  57. package/{test → tests}/auto_k2hdkc_server.ini +7 -4
  58. package/{test → tests}/auto_k2hdkc_slave.ini +7 -4
  59. package/{test → tests}/auto_list.js +7 -4
  60. package/{test → tests}/auto_list_spec.js +7 -4
  61. package/{test → tests}/auto_policy.js +7 -4
  62. package/{test → tests}/auto_policy_spec.js +7 -4
  63. package/{test → tests}/auto_resource.js +7 -4
  64. package/{test → tests}/auto_resource_spec.js +7 -4
  65. package/{test → tests}/auto_role.js +7 -4
  66. package/{test → tests}/auto_role_spec.js +7 -4
  67. package/{test → tests}/auto_service.js +7 -4
  68. package/{test → tests}/auto_service_spec.js +7 -4
  69. package/{test → tests}/auto_subprocesses.js +14 -11
  70. package/tests/auto_template.sh +126 -0
  71. package/{test → tests}/auto_token_util.js +7 -4
  72. package/{test → tests}/auto_userdata.js +7 -4
  73. package/{test → tests}/auto_userdata_spec.js +7 -4
  74. package/{test → tests}/auto_usertokens.js +7 -4
  75. package/{test → tests}/auto_usertokens_spec.js +7 -4
  76. package/{test → tests}/auto_version.js +7 -4
  77. package/{test → tests}/auto_version_spec.js +7 -4
  78. package/{test → tests}/auto_watcher.js +7 -4
  79. package/{test → tests}/auto_watcher_spec.js +7 -4
  80. package/{test → tests}/k2hdkc_test.data +7 -4
  81. package/tests/k2hdkc_test_load.sh +255 -0
  82. package/{test → tests}/k2hr3template_test.js +7 -4
  83. package/tests/k2hr3template_test.sh +339 -0
  84. package/{test → tests}/k2hr3template_test_async.js +7 -4
  85. package/{test → tests}/k2hr3template_test_template.result +14 -8
  86. package/{test → tests}/k2hr3template_test_template.txt +7 -4
  87. package/{test → tests}/k2hr3template_test_vars.js +7 -4
  88. package/{test → tests}/manual_acr_delete.js +7 -4
  89. package/{test → tests}/manual_acr_get.js +7 -4
  90. package/{test → tests}/manual_acr_postput.js +7 -4
  91. package/{test → tests}/manual_allusertenant_get.js +7 -4
  92. package/{test → tests}/manual_extdata_get.js +7 -4
  93. package/{test → tests}/manual_k2hr3keys_get.js +7 -4
  94. package/{test → tests}/manual_list_gethead.js +7 -4
  95. package/{test → tests}/manual_policy_delete.js +7 -4
  96. package/{test → tests}/manual_policy_gethead.js +7 -4
  97. package/{test → tests}/manual_policy_postput.js +7 -4
  98. package/{test → tests}/manual_resource_delete.js +7 -4
  99. package/{test → tests}/manual_resource_gethead.js +7 -4
  100. package/{test → tests}/manual_resource_postput.js +7 -4
  101. package/{test → tests}/manual_role_delete.js +7 -4
  102. package/{test → tests}/manual_role_gethead.js +7 -4
  103. package/{test → tests}/manual_role_postput.js +7 -4
  104. package/{test → tests}/manual_service_delete.js +7 -4
  105. package/{test → tests}/manual_service_gethead.js +7 -4
  106. package/{test → tests}/manual_service_postput.js +7 -4
  107. package/tests/manual_test.sh +338 -0
  108. package/{test → tests}/manual_userdata_get.js +7 -4
  109. package/{test → tests}/manual_usertoken_gethead.js +7 -4
  110. package/{test → tests}/manual_usertoken_postput.js +7 -4
  111. package/{test → tests}/manual_version_get.js +7 -4
  112. package/tests/run_local_test_k2hdkc.sh +174 -0
  113. package/tests/test.sh +331 -0
  114. package/test/auto_control_subprocess.sh +0 -170
  115. package/test/auto_init_config_json.sh +0 -246
  116. package/test/auto_template.sh +0 -127
  117. package/test/auto_test.sh +0 -321
  118. package/test/k2hdkc_test_load.sh +0 -198
  119. package/test/k2hr3template_test.sh +0 -296
  120. package/test/manual_test.sh +0 -321
  121. package/test/run_local_test_k2hdkc.sh +0 -154
@@ -1,198 +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: Thu Nov 9 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
- # default conf/port for k2hdkc
31
- #
32
- K2HR3_K2HDKC_PATH="${SRCTOP}/../k2hr3_dkc/conf"
33
- REMOTE_K2HDKC_CONF_PATH="${K2HR3_K2HDKC_PATH}/slave.ini"
34
- REMOTE_K2HDKC_CTRL_PORT=8031
35
- AUTO_K2HDKC_CONF_PATH="${SRCTOP}/test/auto_k2hdkc_slave.ini"
36
- AUTO_K2HDKC_CTRL_PORT=18031
37
-
38
- #
39
- # Option
40
- #
41
- OPTION_MODE=0
42
- TENANT_MAIN="tenant0"
43
- TENANT_SUB="tenant1"
44
-
45
- while [ $# -ne 0 ]; do
46
- if [ "X$1" = "X" ]; then
47
- break
48
-
49
- elif [ "X$1" = "X--help" -o "X$1" = "X--HELP" -o "X$1" = "X-h" -o "X$1" = "X-H" ]; then
50
- echo "Usage: $1 --for_auto_test(-f)"
51
- echo " $1 --main(-m) <main tenant name> --sub(-s) <sub tenant name> [--conf(-c) <conf file>] [--port(-p) <port>]"
52
- echo " --for_auto_test(-f) for local k2hdkc as auto testing(dummyuser)"
53
- echo " --main(-m) specify main tenant name for remote k2hr3 cluster"
54
- echo " --sub(-s) specify sub tenant name for remote k2hr3 cluster"
55
- echo " --conf(-c) specify slave chmpx conf file for remote k2hr3 cluster(default is ../k2hr3_dkc/conf)"
56
- echo " --port(-p) specify slave chmpx port for remote k2hr3 cluster(default is ../k2hr3_dkc/conf)"
57
- echo ""
58
- exit 0
59
-
60
- elif [ "X$1" = "X--for_auto_test" -o "X$1" = "X--FOR_AUTO_TEST" -o "X$1" = "X-f" -o "X$1" = "X-F" ]; then
61
- if [ ${OPTION_MODE} -ne 0 ]; then
62
- echo "ERROR: --for_auto_test(-f) option is specified, but already set it or another options."
63
- exit 1
64
- fi
65
- OPTION_MODE=1
66
-
67
- elif [ "X$1" = "X--main" -o "X$1" = "X--MAIN" -o "X$1" = "X-m" -o "X$1" = "X-M" ]; then
68
- #
69
- # input main tenant name
70
- #
71
- shift
72
- if [ $# -eq 0 ]; then
73
- echo "ERROR: --main(-m) option needs parameter"
74
- exit 1
75
- fi
76
- TENANT_MAIN=$1
77
-
78
- if [ ${OPTION_MODE} -eq 1 ]; then
79
- echo "ERROR: --main(-m) option is specified, but already set --for_auto_test(-f) option."
80
- exit 1
81
- fi
82
- OPTION_MODE=2
83
-
84
- elif [ "X$1" = "X--sub" -o "X$1" = "X--SUB" -o "X$1" = "X-s" -o "X$1" = "X-S" ]; then
85
- #
86
- # input sub tenant name
87
- #
88
- shift
89
- if [ $# -eq 0 ]; then
90
- echo "ERROR: --sub(-s) option needs parameter"
91
- exit 1
92
- fi
93
- TENANT_SUB=$1
94
-
95
- if [ ${OPTION_MODE} -eq 1 ]; then
96
- echo "ERROR: --sub(-s) option is specified, but already set --for_auto_test(-f) option."
97
- exit 1
98
- fi
99
- OPTION_MODE=2
100
-
101
- elif [ "X$1" = "X--conf" -o "X$1" = "X--CONF" -o "X$1" = "X-c" -o "X$1" = "X-C" ]; then
102
- shift
103
- if [ "X$1" = "X" ]; then
104
- echo "[ERROR] --conf(-c) option needs parameter"
105
- exit 1
106
- fi
107
- REMOTE_K2HDKC_CONF_PATH=$1
108
-
109
- if [ ${OPTION_MODE} -eq 1 ]; then
110
- echo "ERROR: --conf(-c) option is specified, but already set --for_auto_test(-f) option."
111
- exit 1
112
- fi
113
- OPTION_MODE=2
114
-
115
- elif [ "X$1" = "X--port" -o "X$1" = "X--PORT" -o "X$1" = "X-p" -o "X$1" = "X-P" ]; then
116
- shift
117
- if [ "X$1" = "X" ]; then
118
- echo "[ERROR] --port(-p) option needs parameter"
119
- exit 1
120
- fi
121
- REMOTE_K2HDKC_CTRL_PORT=$1
122
-
123
- if [ ${OPTION_MODE} -eq 1 ]; then
124
- echo "ERROR: --port(-p) option is specified, but already set --for_auto_test(-f) option."
125
- exit 1
126
- fi
127
- OPTION_MODE=2
128
-
129
- else
130
- echo "ERROR: unknown option \"$1\""
131
- exit 1
132
- fi
133
- shift
134
- done
135
-
136
- #
137
- # Check options
138
- #
139
- if [ ${OPTION_MODE} -eq 0 ]; then
140
- echo "ERROR: no option is specified."
141
- exit 1
142
- elif [ ${OPTION_MODE} -eq 1 ]; then
143
- K2HDKC_CONF_PATH=${AUTO_K2HDKC_CONF_PATH}
144
- K2HDKC_CTRL_PORT=${AUTO_K2HDKC_CTRL_PORT}
145
- elif [ ${OPTION_MODE} -eq 2 ]; then
146
- K2HDKC_CONF_PATH=${REMOTE_K2HDKC_CONF_PATH}
147
- K2HDKC_CTRL_PORT=${REMOTE_K2HDKC_CTRL_PORT}
148
- else
149
- echo "ERROR: wrong option is specified."
150
- exit 1
151
- fi
152
-
153
- if [ ! -f ${K2HDKC_CONF_PATH} ]; then
154
- echo "[ERROR] slave chmpx configuration file(${K2HDKC_CONF_PATH}) does not exist."
155
- exit 1
156
- fi
157
-
158
- expr ${K2HDKC_CTRL_PORT} + 0 >/dev/null 2>&1
159
- if [ $? -ne 0 ]; then
160
- echo "[ERROR] slave chmpx control port number(${K2HDKC_CTRL_PORT}) is not integer."
161
- exit 1
162
- fi
163
-
164
- #
165
- # hostname/ip
166
- #
167
- if [ ${OPTION_MODE} -eq 1 ]; then
168
- HOSTNAME=`hostname`
169
- IPADDR=127.10.10.10
170
- else
171
- HOSTNAME=`hostname`
172
- IPADDR=`nslookup $HOSTNAME | grep Address | grep -v '#' | awk '{print $2}'`
173
- fi
174
-
175
- #
176
- # Copy file with convert
177
- #
178
- cat ${MYSCRIPTDIR}/k2hdkc_test.data | sed "s/__LOCAL_HOST_NAME__/${HOSTNAME}/g" | sed "s/__LOCAL_HOST_IP__/${IPADDR}/g" | sed "s/__TENANT_NAME_MAIN__/${TENANT_MAIN}/g" | sed "s/__TENANT_NAME_SUB__/${TENANT_SUB}/g" > /tmp/k2hdkc_test.data 2> /dev/null
179
-
180
- #
181
- # Run process
182
- #
183
- k2hdkclinetool -conf ${K2HDKC_CONF_PATH} -ctlport ${K2HDKC_CTRL_PORT} -run /tmp/k2hdkc_test.data > /dev/null
184
- if [ $? -ne 0 ]; then
185
- echo "ERROR: Failed to load test data."
186
- rm -f /tmp/k2hdkc_test.data
187
- exit 1
188
- fi
189
-
190
- rm -f /tmp/k2hdkc_test.data
191
- echo "SUCCESS: Loaded test data."
192
- exit 0
193
-
194
- #
195
- # VIM modelines
196
- #
197
- # vim:set ts=4 fenc=utf-8:
198
- #
@@ -1,296 +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 Jul 12 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
- HOST=`hostname`
29
-
30
- #
31
- # Usage
32
- #
33
- PrintUsage()
34
- {
35
- echo "Usage: $1 [--inspect(-i)]"
36
- echo " [--debuglevel(-d) DBG/MSG/WARN/ERR/(custom debug level)]"
37
- echo " [--varlist(-v) \"variables JSON file path\"]"
38
- echo " {--templ(-t) \"template file path\" | --string(-s) \"template string\"}"
39
- echo " {--async(-a)}"
40
- echo ""
41
- echo " If you do not specify input file path or template string,"
42
- echo " $1 prompts you to enter a template string from stdin."
43
- echo ""
44
- }
45
-
46
- #
47
- # Parse arguments
48
- #
49
- INPUT_TEMPLFILE=""
50
- INPUT_TEMPLSTR=""
51
- INPUT_VARFILE=""
52
- INPUT_ASYNCMODE=0
53
- DEBUG_OPTION=""
54
- DEBUG_PIPE_LINE=""
55
- DEBUG_ENV_CUSTOM=""
56
- DEBUG_ENV_LEVEL=0
57
-
58
- OPTCOUNT=$#
59
- while [ ${OPTCOUNT} -ne 0 ]; do
60
- if [ "X$1" = "X" ]; then
61
- break
62
-
63
- elif [ "X$1" = "X--help" -o "X$1" = "X--HELP" -o "X$1" = "X-h" -o "X$1" = "X-H" ]; then
64
- PrintUsage ${PROGRAM_NAME}
65
- exit 0
66
-
67
- elif [ "X$1" = "X--inspect" -o "X$1" = "X--INSPECT" -o "X$1" = "X-i" -o "X$1" = "X-I" ]; then
68
- DEBUG_OPTION="--inspect --debug-brk"
69
- DEBUG_PIPE_LINE="sed s/127.0.0.1/${HOST}/"
70
-
71
- elif [ "X$1" = "X--debuglevel" -o "X$1" = "X--DEBUGLEVEL" -o "X$1" = "X-d" -o "X$1" = "X-D" ]; then
72
- #
73
- # DEBUG option
74
- #
75
- OPTCOUNT=`expr ${OPTCOUNT} - 1`
76
- if [ ${OPTCOUNT} -eq 0 ]; then
77
- echo "ERROR: --debuglevel(-d) option needs parameter(dbg/msg/warn/err)"
78
- exit 1
79
- fi
80
- shift
81
-
82
- if [ "X$1" = "Xdbg" -o "X$1" = "XDBG" -o "X$1" = "Xdebug" -o "X$1" = "XDEBUG" ]; then
83
- if [ ${DEBUG_ENV_LEVEL} -lt 4 ]; then
84
- DEBUG_ENV_LEVEL=4
85
- fi
86
-
87
- 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
88
- if [ ${DEBUG_ENV_LEVEL} -lt 3 ]; then
89
- DEBUG_ENV_LEVEL=3
90
- fi
91
-
92
- elif [ "X$1" = "Xwarn" -o "X$1" = "XWARN" -o "X$1" = "Xwarning" -o "X$1" = "XWARNING" ]; then
93
- if [ ${DEBUG_ENV_LEVEL} -lt 2 ]; then
94
- DEBUG_ENV_LEVEL=2
95
- fi
96
-
97
- elif [ "X$1" = "Xerr" -o "X$1" = "XERR" -o "X$1" = "Xerror" -o "X$1" = "XERROR" ]; then
98
- if [ ${DEBUG_ENV_LEVEL} -lt 1 ]; then
99
- DEBUG_ENV_LEVEL=1
100
- fi
101
-
102
- else
103
- if [ "X${DEBUG_ENV_CUSTOM}" != "X" ]; then
104
- DEBUG_ENV_CUSTOM="${DEBUG_ENV_CUSTOM},"
105
- fi
106
- DEBUG_ENV_CUSTOM="${DEBUG_ENV_CUSTOM}$1"
107
- fi
108
-
109
- elif [ "X$1" = "X--varlist" -o "X$1" = "X--VARLIST" -o "X$1" = "X-v" -o "X$1" = "X-V" ]; then
110
- #
111
- # input variable list file path
112
- #
113
- OPTCOUNT=`expr ${OPTCOUNT} - 1`
114
- if [ ${OPTCOUNT} -eq 0 ]; then
115
- echo "ERROR: --varlist(-v) option needs parameter( input variable JSON file path )"
116
- exit 1
117
- fi
118
- shift
119
-
120
- if [ "X${INPUT_VARFILE}" != "X" ]; then
121
- echo "ERROR: specified variable list file \"$1\", but already specified variable list file \"${INPUT_VARFILE}\""
122
- exit 1
123
- fi
124
- if [ ! -f $1 ]; then
125
- echo "ERROR: could not find variable list file \"$1\""
126
- exit 1
127
- fi
128
- INPUT_VARFILE=$1
129
-
130
- elif [ "X$1" = "X--template" -o "X$1" = "X--TEMPLATE" -o "X$1" = "X--templ" -o "X$1" = "X--TEMPL" -o "X$1" = "X-t" -o "X$1" = "X-T" ]; then
131
- #
132
- # input template file path
133
- #
134
- OPTCOUNT=`expr ${OPTCOUNT} - 1`
135
- if [ ${OPTCOUNT} -eq 0 ]; then
136
- echo "ERROR: --templ(-t) option needs parameter( input template file path )"
137
- exit 1
138
- fi
139
- shift
140
-
141
- if [ "X${INPUT_TEMPLFILE}" != "X" ]; then
142
- echo "ERROR: specified template file \"$1\", but already specified template file \"${INPUT_TEMPLFILE}\""
143
- exit 1
144
- fi
145
- if [ "X${INPUT_TEMPLSTR}" != "X" ]; then
146
- echo "ERROR: specified template file \"$1\", but already specified template string \"${INPUT_TEMPLSTR}\""
147
- exit 1
148
- fi
149
- if [ ! -f $1 ]; then
150
- echo "ERROR: could not find template file \"$1\""
151
- exit 1
152
- fi
153
- INPUT_TEMPLFILE=$1
154
-
155
- elif [ "X$1" = "X--string" -o "X$1" = "X--STRING" -o "X$1" = "X--str" -o "X$1" = "X--STR" -o "X$1" = "X-s" -o "X$1" = "X-S" ]; then
156
- #
157
- # input template string
158
- #
159
- OPTCOUNT=`expr ${OPTCOUNT} - 1`
160
- if [ ${OPTCOUNT} -eq 0 ]; then
161
- echo "ERROR: --string(-s) option needs parameter( input template string )"
162
- exit 1
163
- fi
164
- shift
165
-
166
- if [ "X${INPUT_TEMPLFILE}" != "X" ]; then
167
- echo "ERROR: specified template string \"$1\", but already specified template file \"${INPUT_TEMPLFILE}\""
168
- exit 1
169
- fi
170
- if [ "X${INPUT_TEMPLSTR}" != "X" ]; then
171
- echo "ERROR: specified template string \"$1\", but already specified template string \"${INPUT_TEMPLSTR}\""
172
- exit 1
173
- fi
174
- INPUT_TEMPLSTR=$1
175
-
176
- elif [ "X$1" = "X--async" -o "X$1" = "X--ASYNC" -o "X$1" = "X-a" -o "X$1" = "X-A" ]; then
177
- #
178
- # async mode
179
- #
180
- if [ ${INPUT_ASYNCMODE} -ne 0 ]; then
181
- echo "ERROR: --async(-a) option is already specified"
182
- exit 1
183
- fi
184
- INPUT_ASYNCMODE=1
185
-
186
- else
187
- echo "ERROR: unknown option \"$1\""
188
- echo ""
189
- PrintUsage ${PROGRAM_NAME}
190
- exit 0
191
- fi
192
-
193
- OPTCOUNT=`expr ${OPTCOUNT} - 1`
194
- shift
195
- done
196
-
197
- #
198
- # Make NODE_DEBUG environment
199
- #
200
- DEBUG_ENV_PARAM=""
201
- if [ ${DEBUG_ENV_LEVEL} -ge 4 ]; then
202
- DEBUG_ENV_PARAM="LOGLEVEL_DBG"
203
- elif [ ${DEBUG_ENV_LEVEL} -ge 3 ]; then
204
- DEBUG_ENV_PARAM="LOGLEVEL_MSG"
205
- elif [ ${DEBUG_ENV_LEVEL} -ge 2 ]; then
206
- DEBUG_ENV_PARAM="LOGLEVEL_WAN"
207
- elif [ ${DEBUG_ENV_LEVEL} -ge 1 ]; then
208
- DEBUG_ENV_PARAM="LOGLEVEL_ERR"
209
- fi
210
-
211
- #
212
- # Template file
213
- #
214
- rm -f /tmp/${PROGRAM_NAME}.templ.*
215
-
216
- if [ "X${INPUT_TEMPLFILE}" = "X" ]; then
217
- #
218
- # Temporary template file
219
- #
220
- INPUT_TEMPLFILE="/tmp/${PROGRAM_NAME}.templ.$$"
221
- echo -n "" > ${INPUT_TEMPLFILE}
222
-
223
- if [ "X${INPUT_TEMPLSTR}" != "X" ]; then
224
- #
225
- # Put input template string to temporary file
226
- #
227
- echo "${INPUT_TEMPLSTR}" >> ${INPUT_TEMPLFILE}
228
-
229
- else
230
- #
231
- # Get template string from stdin
232
- #
233
- echo "---------------------------------------------------------------"
234
- echo " Please input template string."
235
- echo " You can end template string input by entering \"EOF\"."
236
- echo "---------------------------------------------------------------"
237
-
238
- while true; do
239
- echo -n "> "
240
- read TEMPLLINE
241
-
242
- if [ "X${TEMPLLINE}" = "XEOF" -o "X${TEMPLLINE}" = "Xeof" ]; then
243
- break;
244
- fi
245
- echo "${TEMPLLINE}" >> ${INPUT_TEMPLFILE}
246
- done
247
- echo ""
248
- fi
249
- fi
250
-
251
- #
252
- # Checking async mode
253
- #
254
- if [ ${INPUT_ASYNCMODE} -eq 0 ]; then
255
- TEST_PROG="test/k2hr3template_test.js"
256
- else
257
- TEST_PROG="test/k2hr3template_test_async.js"
258
- fi
259
-
260
- #
261
- # Input template string
262
- #
263
- if [ ${DEBUG_ENV_LEVEL} -ge 4 ]; then
264
- echo "---------------------------------------------------------------"
265
- echo " Template string"
266
- echo "---------------------------------------------------------------"
267
- cat ${INPUT_TEMPLFILE}
268
- echo ""
269
- echo "---------------------------------------------------------------"
270
- fi
271
-
272
- #
273
- # Executing
274
- #
275
- cd ${SRCTOP}
276
- if [ "X${DEBUG_PIPE_LINE}" = "X" ]; then
277
- if [ ${DEBUG_ENV_LEVEL} -ge 4 ]; then
278
- echo "***** Run *****"
279
- echo "NODE_PATH=${NODE_PATH} NODE_DEBUG=${DEBUG_ENV_PARAM} R3TEMPLFILE=${INPUT_TEMPLFILE} R3VARFILE=${INPUT_VARFILE} node ${DEBUG_OPTION} ${TEST_PROG}"
280
- echo ""
281
- fi
282
- NODE_PATH=${NODE_PATH} NODE_DEBUG=${DEBUG_ENV_PARAM} R3TEMPLFILE=${INPUT_TEMPLFILE} R3VARFILE=${INPUT_VARFILE} node ${DEBUG_OPTION} ${TEST_PROG}
283
- else
284
- if [ ${DEBUG_ENV_LEVEL} -ge 4 ]; then
285
- echo "***** Run *****"
286
- echo "NODE_PATH=${NODE_PATH} NODE_DEBUG=${DEBUG_ENV_PARAM} R3TEMPLFILE=${INPUT_TEMPLFILE} R3VARFILE=${INPUT_VARFILE} node ${DEBUG_OPTION} ${TEST_PROG} 2>&1 | ${DEBUG_PIPE_LINE}"
287
- echo ""
288
- fi
289
- NODE_PATH=${NODE_PATH} NODE_DEBUG=${DEBUG_ENV_PARAM} R3TEMPLFILE=${INPUT_TEMPLFILE} R3VARFILE=${INPUT_VARFILE} node ${DEBUG_OPTION} ${TEST_PROG} 2>&1 | ${DEBUG_PIPE_LINE}
290
- fi
291
-
292
- #
293
- # VIM modelines
294
- #
295
- # vim:set ts=4 fenc=utf-8:
296
- #